diff --git a/json-schema/schema.json b/json-schema/schema.json index bbb9a53..8b7e68f 100644 --- a/json-schema/schema.json +++ b/json-schema/schema.json @@ -3,8 +3,10 @@ "$id": "https://stac-extensions.github.io/pointcloud/v2.0.0/schema.json#", "title": "Point Cloud Extension", "description": "STAC Point Cloud Extension for STAC Items and Collections.", + "type": "object", "required": [ - "stac_extensions" + "stac_extensions", + "type" ], "properties": { "stac_extensions": { @@ -14,85 +16,84 @@ } } }, - "oneOf": [ + "allOf": [ { - "$comment": "This is the schema for STAC Items.", - "allOf": [ - { - "type": "object", - "required": [ - "type", - "properties", - "assets" - ], + "$comment": "Item", + "if": { + "properties": { + "type": { + "const": "Feature" + } + } + }, + "then": { + "properties": { "properties": { - "type": { - "const": "Feature" - }, - "properties": { - "allOf": [ - { - "$comment": "Require fields here for item properties.", - "required": [ - "pc:count", - "pc:type" - ] - }, - { - "$ref": "#/definitions/fields" - } - ] - }, - "assets": { - "type": "object", - "additionalProperties": { - "$ref": "#/definitions/fields" - } - } + "$ref": "#/definitions/fields" } } - ] + } }, { - "$comment": "This is the schema for STAC Collections.", - "allOf": [ - { - "type": "object", - "required": [ - "type" - ], + "$comment": "Collections", + "if": { + "properties": { + "type": { + "const": "Collection" + } + } + }, + "then": { + "properties": { "properties": { - "type": { - "const": "Collection" - }, - "assets": { - "type": "object", - "additionalProperties": { - "$ref": "#/definitions/fields" - } - }, - "item_assets": { - "type": "object", - "additionalProperties": { - "$ref": "#/definitions/fields" - } - } + "$ref": "#/definitions/fields" } } - ] + } } ], "definitions": { + "require_assets": { + "required": [ + "assets" + ], + "properties": { + "assets": { + "$ref": "#/definitions/asset_contains" + } + } + }, + "validate_assets": { + "properties": { + "assets": { + "additionalProperties": { + "$ref": "#/definitions/fields" + } + } + } + }, + "asset_contains": { + "type": "object", + "not": { + "additionalProperties": { + "not": { + "$ref": "#/definitions/fields" + } + } + } + }, "fields": { "type": "object", + "required": [ + "pc:count", + "pc:type" + ], "properties": { "pc:count": { - "type": "integer", - "minimum": 0 + "$ref": "#/definitions/pc:count" }, "pc:type": { - "type": "string", - "minLength": 1 + "$ref": "#/definitions/pc:type" }, "pc:schemas": { "type": "array", @@ -102,8 +103,7 @@ } }, "pc:density": { - "type": "number", - "minimum": 0 + "$ref": "#/definitions/pc:density" }, "pc:statistics": { "type": "array", @@ -118,7 +118,39 @@ }, "additionalProperties": false }, + "pc:count": { + "title": "The number of points", + "type": "integer", + "minimum": 0 + }, + "pc:type": { + "title": "Phenomenology type for the point cloud", + "type": "string", + "minLength": 1 + }, + "pc:schemas": { + "title": "A sequential array of Items that define the dimensions and their types", + "type": "array", + "minItems": 1, + "items": { + "$ref": "#/definitions/schema" + } + }, + "pc:density": { + "title": "Number of points per square unit area", + "type": "number", + "minimum": 0 + }, + "pc:statistics": { + "title": "A sequential array of Items mapping to pc:schemas defines per-channel statistics", + "type": "array", + "minItems": 1, + "items": { + "$ref": "#/definitions/stats" + } + }, "schema": { + "title": "A sequential array of Items that define the dimensions or channels of the point cloud, their types, and their sizes (in full bytes)", "type": "object", "required": [ "name", @@ -144,6 +176,7 @@ } }, "stats": { + "title": "A sequential array of Items mapping to pc:schemas defines per-channel statistics", "type": "object", "minProperties": 2, "required": [