diff --git a/src/schema/Feature.js b/src/schema/Feature.js index 5fb826c..587c314 100644 --- a/src/schema/Feature.js +++ b/src/schema/Feature.js @@ -20,7 +20,13 @@ export default { oneOf: [{type: 'number'}, {type: 'string'}], }, properties: { - oneOf: [{type: 'null'}, {type: 'object'}], + type: 'object', + required: ['path_class_name'], + properties: { + path_class_name: { + type: 'string', + }, + }, }, geometry: { oneOf: [ diff --git a/src/schema/FeatureCollection.js b/src/schema/FeatureCollection.js index 53b3cfe..20a0cff 100644 --- a/src/schema/FeatureCollection.js +++ b/src/schema/FeatureCollection.js @@ -4,7 +4,7 @@ import Feature from './Feature.js'; export default { title: 'GeoJSON FeatureCollection', type: 'object', - required: ['type', 'features'], + required: ['type', 'features', 'ontology_link', 'ontology_id'], properties: { type: { type: 'string', @@ -15,5 +15,11 @@ export default { items: Feature, }, bbox: BoundingBox, + ontology_link: { + type: 'string', + }, + ontology_id: { + type: 'string', + }, }, }; diff --git a/src/schema/ontology.js b/src/schema/ontology.js new file mode 100644 index 0000000..c7207af --- /dev/null +++ b/src/schema/ontology.js @@ -0,0 +1,23 @@ +export default { + title: 'JSON Ontology', + type: 'object', + // As we do not know key names in advance we cannot use `properties` + additionalProperties: { + type: 'array', + items: { + type: 'object', + required: ['type', 'color'], + properties: { + type: { + type: 'string', + }, + color: { + type: 'string', + pattern: '^#[0-9A-Fa-f]{6}$', // Ensure color is a valid hex code + }, + }, + additionalProperties: false, // No additional properties allowed within objects + }, + }, + }; + \ No newline at end of file