Skip to content

Commit

Permalink
[wip] specify base rdf schema
Browse files Browse the repository at this point in the history
  • Loading branch information
FynnBe committed Jun 11, 2021
1 parent 4f46770 commit 666db26
Showing 1 changed file with 26 additions and 8 deletions.
34 changes: 26 additions & 8 deletions bioimageio/spec/v0_3/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,21 @@ class RDF(PyBioSchema):
f"models have a different format version.",
)

name = fields.String(required=True)
name = fields.String(required=True, bioimageio_description="name of the resource, a human-friendly name.")
description = fields.String(required=True, bioimageio_description="A string containing a brief description.")

authors = fields.List(
fields.Nested(Author),
required=True,
missing=None,
bioimageio_description="A list of authors. The authors are the creators of the specifications and the primary "
"points of contact.",
)
source = fields.URI(
validate=field_validators.URL(schemes=["http", "https"]),
missing=None,
bioimageio_description="url to the source of the resource",
)

cite = fields.Nested(
CiteEntry,
many=True,
Expand Down Expand Up @@ -163,7 +169,10 @@ def warn_about_deprecated_spdx_license(self, value: str):
bioimageio_description="Timestamp of the initial creation of this model in [ISO 8601]"
"(#https://en.wikipedia.org/wiki/ISO_8601) format.",
)
type = fields.String(validate=field_validators.OneOf(raw_nodes.Type.__args__))
type = fields.String(
validate=field_validators.OneOf(raw_nodes.Type.__args__),
bioimageio_description=f"type of the resource, one of {[f'`{t}`' for t in raw_nodes.Type.__args__]}",
)
version = fields.StrictVersion(
missing=None,
bioimageio_description="The version number of the model. The version number format must be a string in "
Expand Down Expand Up @@ -470,6 +479,18 @@ class ModelParent(PyBioSchema):


class Model(RDF):
bioimageio_description = f"""# BioImage.IO Model Description File Specification {raw_nodes.FormatVersion.__args__[-1]}
A model entry in the bioimage.io model zoo is defined by a configuration file model.yaml.
The configuration file must contain the following fields; optional fields are indicated by _optional_.
_optional*_ with an asterisk indicates the field is optional depending on the value in another field.
"""

authors = fields.List(
fields.Nested(Author),
required=True,
bioimageio_description="A list of authors. The authors are the creators of the specifications and the primary "
"points of contact.",
)

format_version = fields.String(
validate=field_validators.OneOf(raw_nodes.FormatVersion.__args__),
Expand All @@ -482,11 +503,8 @@ class Model(RDF):
{raw_nodes.FormatVersion.__args__[-1]}""",
)

bioimageio_description = f"""# BioImage.IO Model Description File Specification {raw_nodes.FormatVersion.__args__[-1]}
A model entry in the bioimage.io model zoo is defined by a configuration file model.yaml.
The configuration file must contain the following fields; optional fields are indicated by _optional_.
_optional*_ with an asterisk indicates the field is optional depending on the value in another field.
"""
type = fields.String(validate=field_validators.OneOf(["model"]))

name = fields.String(
# validate=field_validators.Length(max=36), # todo: enforce in future version
required=True,
Expand Down

0 comments on commit 666db26

Please sign in to comment.