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

Update json schema #11

Merged
merged 5 commits into from
Dec 20, 2024
Merged
Changes from 2 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
187 changes: 186 additions & 1 deletion FormSchemas/jsonschema.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
"spatial_extent",
"temporal_extent",
"sample_files",
"data_type"
"data_type",
"providers",
"item_assets"
],
"properties": {
"collection": { "type": "string", "title": "Collection" },
Expand Down Expand Up @@ -91,13 +93,72 @@
"items": {
"type": "object",
"properties": {
"upload": {
"type": "boolean",
"title": "Upload",
"default": false
},
"cogify": {
"type": "boolean",
"title": "Cogify",
"default": false
},
"dry_run": {
"type": "boolean",
"title": "Dry Run",
"default": false
},
"discovery": {
"type": "string",
"enum": [
"s3"
],
"title": "Discovery"
},
"prefix": {
"type": "string",
"title": "Prefix"
},
"bucket": {
"type": "string",
"title": "Bucket"
},
"filename_regex": {
"type": "string",
"title": "Filename Regex",
"default": "[\\s\\S]*"
},
"datetime_range": {
"type": "string",
"title": "Datetime Range"
},
"start_datetime": {
"type": "string",
"format": "date-time",
"title": "Start Datetime"
},
"end_datetime": {
"type": "string",
"format": "date-time",
"title": "End Datetime"
},
"single_datetime": {
"type": "string",
"format": "date-time",
"title": "Single Datetime"
},
"id_regex": {
"type": "string",
"title": "Id Regex"
},
"id_template": {
"type": "string",
"title": "Id Template"
},
"use_multithreading":{
"type": "string",
Copy link
Collaborator

Choose a reason for hiding this comment

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

should this be a boolean?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yeah you're right should be boolean.

"title": "Use Multithreading",
"default": "false"
}
},
"required": ["prefix", "bucket"]
Expand All @@ -122,6 +183,130 @@
"items": {
"type": "string"
}
},
"item_assets": {
"type": "object",
"title": "Item Assets",
"properties": {
"cog_default": {
"type": "object",
"properties": {
"type": {
"type": "string",
"default":"image/tiff; application=geotiff; profile=cloud-optimized"
},
"roles": {
"type": "array",
"items": [
{
"type": "string"
}
],
"default":[
"data",
"layer"
]
},
"title": {
"type": "string",
"default":"Default COG Layer"
},
"description": {
"type": "string",
"default":"Cloud optimized default layer to display on map"
}
},
"required": [
"type",
"roles",
"title",
"description"
]
}
},
"required": [
"cog_default"
]
},
"renders": {
"type": "object",
"title": "Renders"
Copy link
Collaborator

Choose a reason for hiding this comment

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

looks like this is missing a type

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The renders object follows this schema: https://github.com/stac-extensions/render/blob/main/json-schema/schema.json

Do you think we should use that schema or just make it an object where someone can copy paste their renders object?

Copy link
Collaborator

Choose a reason for hiding this comment

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

without any properties defined, we will just get an empty fieldset from React-json-shema
Screenshot 2024-12-19 at 5 37 08 PM

I think the library will support references within the json schema, so I can try copying the file to this repo, adding the reference, and styling it like the others.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@smohiudd - It turns out that the react-jsonschema-form library "only supports local definition referencing". There is a separate json-schema-ref-parser library that does let us parse the json schema. I pulled that in and put a copy of the stac-extensions schema above in the public directory to try it out. Unfortunately, it seems to be hanging up with some references. I'm still trying to debug, but I pushed a commit with a partially working version.

Another work around would be something like allow some or all of the Renders object be a text area where users paste in the object.

Copy link
Collaborator Author

@smohiudd smohiudd Dec 20, 2024

Choose a reason for hiding this comment

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

i'm leaning more toward making all renders a text area where a user can paste in the render configs.

Copy link
Collaborator

Choose a reason for hiding this comment

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

ok, I made that change and pushed it up. I'm good with merging and trying it this way.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks!

},
"providers": {
"title": "Providers",
"type": "array",
"items": {
"type": "object",
"required": [
"name"
],
"properties": {
"name": {
"title": "Organization name",
"type": "string",
"minLength": 1
},
"description": {
"title": "Organization description",
"type": "string"
},
"roles": {
"title": "Organization roles",
"type": "array",
"items": {
"type": "string",
"enum": [
"producer",
"licensor",
"processor",
"host"
]
}
},
"url": {
"title": "Organization homepage",
"type": "string",
"format": "iri"
}
}
}
},
"assets": {
"type": "object",
"properties": {
"thumbnail": {
stephenkilbourn marked this conversation as resolved.
Show resolved Hide resolved
"type": "object",
"properties": {
"title": {
"type": "string"
},
"description": {
"type": "string"
},
"href": {
"type": "string"
},
"type": {
"type": "string"
},
"roles": {
"type": "array",
"items": [
{
"type": "string"
}
]
}
},
"required": [
"title",
"description",
"href",
"type",
"roles"
]
}
}
}
}
}