Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Align manifest and component spec schemas #39

Merged
merged 1 commit into from
Apr 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 44 additions & 4 deletions fondant/schemas/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,50 @@
"definitions": {
"subset_data_type": {
"type": "string",
"enum": ["bool", "int8", "int16", "int32", "uint8", "uint16", "uint32", "uint64",
"float16", "float32", "float64", "decimal",
"time32", "time64", "timestamp", "date32", "date64", "duration",
"utf8", "binary", "categorical", "list", "struct"]
"enum": [
"bool",
"int8",
"int16",
"int32",
"uint8",
"uint16",
"uint32",
"uint64",
"float16",
"float32",
"float64",
"decimal",
"time32",
"time64",
"timestamp",
"date32",
"date64",
"duration",
"utf8",
"binary",
"categorical",
"list",
"struct"
]
},
"field": {
"type": "object",
"properties": {
"type": {
"type": "string",
"$ref": "#/definitions/subset_data_type"
}
},
"required": [
"type"
]
},
"fields": {
"type": "object",
"minProperties": 1,
"additionalProperties": {
"$ref": "#/definitions/field"
}
}
}
}
117 changes: 51 additions & 66 deletions fondant/schemas/component_spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Example Component Schema",
"type": "object",
"required": ["name", "description", "image", "input_subsets", "output_subsets", "args"],
"required": [
"name",
"description",
"image",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was wondering whether the "image" is relevant for the Fondant spec, or whether this is only relevant for the Kubeflow spec. For the moment this field is not used

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's necessary to build the kubeflow spec. I think it's logical that fondant components need to define the image they'll be executed with.

"input_subsets",
"output_subsets",
"args"
],
"properties": {
"name": {
"type": "string",
Expand All @@ -16,82 +23,60 @@
"type": "string",
"description": "Docker image for the component"
},
"input_subsets": {
"input_subsets": {
"$ref": "#/definitions/subsets"
},
"output_subsets": {
"$ref": "#/definitions/subsets"
},
"args": {
"$ref": "#/definitions/args"
}
},
"definitions": {
"subset": {
"type": "object",
"properties": {
"fields": {
"$ref": "common.json#/definitions/fields"
}
},
"required": [
"fields"
]
},
"subsets": {
"type": "object",
"description": "Input subsets for the component",
"additionalProperties": {
"type": "object",
"properties": {
"fields": {
"type": "object",
"additionalProperties": {
"type": "object",
"properties": {
"type": {
"type": "string",
"$ref": "#/definitions/data_type"
},
"description": {
"type": "string"
}
},
"required": ["type"]
}
}
},
"required": ["fields"],
"additionalProperties": false
"$ref": "#/definitions/subset"
}
},
"output_subsets": {
"args": {
"type": "object",
"description": "Output subsets for the component",
"additionalProperties": {
"type": "object",
"properties": {
"fields": {
"type": "object",
"additionalProperties": {
"type": "object",
"properties": {
"type": {
"type": "string",
"$ref": "#/definitions/data_type"
},
"description": {
"type": "string"
}
},
"required": ["type"]
}
"type": {
"type": "string",
"enum": [
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have to remember to be able to pase those internally for the user since lists and dicts are often returned as json arrays.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll create a ticket for it

"list",
"str",
"int",
"float",
"bool",
"dict",
"tuple",
"set"
]
},
"description": {
"type": "string"
}
},
"required": ["fields"],
"additionalProperties": false
"required": [
"type"
]
}
},
"args": {
"type": "object",
"additionalProperties": {
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": ["list", "str", "int", "float", "bool", "dict", "tuple", "set"]
},
"description": {
"type": "string"
}
},
"required": ["type"]
}
}
},
"definitions": {
"data_type": {
"type": "string",
"$ref": "common.json#/definitions/subset_data_type",
"description": "Valid data types"
}
}
}
24 changes: 5 additions & 19 deletions fondant/schemas/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,23 +43,6 @@
"subsets"
],
"definitions": {
"field": {
"type": "object",
"properties": {
"type": {
"type": "string",
"$ref": "common.json#/definitions/subset_data_type"
}
},
"required": ["type"]
},
"fields": {
"type": "object",
"minProperties": 1,
"additionalProperties": {
"$ref": "#/definitions/field"
}
},
"subset": {
"type": "object",
"properties": {
Expand All @@ -68,10 +51,13 @@
"pattern": "/.*"
},
"fields": {
"$ref": "#/definitions/fields"
"$ref": "common.json#/definitions/fields"
}
},
"required": ["location", "fields"]
"required": [
"location",
"fields"
]
},
"subsets": {
"type": "object",
Expand Down