From fdb8a5138b3c8bf3ef98570270fbe2bfbc95d66f Mon Sep 17 00:00:00 2001 From: Matthias Mohr Date: Thu, 4 Mar 2021 22:28:49 +0100 Subject: [PATCH] Clean-up and JSON Schema fixes --- .remarkignore | 1 - CHANGELOG.md | 27 +--- README.md | 9 +- json-schema/schema.json | 319 ++++++++++++++++++++++++---------------- package.json | 2 +- 5 files changed, 204 insertions(+), 154 deletions(-) delete mode 100644 .remarkignore diff --git a/.remarkignore b/.remarkignore deleted file mode 100644 index 1b763b1..0000000 --- a/.remarkignore +++ /dev/null @@ -1 +0,0 @@ -CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md index c5908d6..95ac712 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,29 +8,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - assets should use role `labels` instead of an asset name of `labels` - -## [1.0.2] - 2021-03-02 -### Fixed -- Updated schema self link - -### Changed -- Ignored changelog for markdown lint - -## [1.0.0] - 2021-03-02 -### Changed -- foobar +- Clarified the role of geometries on items. [#875](https://github.com/radiantearth/stac-spec/pull/875) +- `label:description` now allows CommonMark for rich-text representation ([#950](https://github.com/radiantearth/stac-spec/issues/950)) ### Fixed -- Cleaned up lint and examples for 1.0.0 - -## 0.0.1 - 2021-03-02 -### Added -- Copied over assets / description from stac-spec - -### Changed -- Clarified the role of geometries on items. stac-spec [#875](https://github.com/radiantearth/stac-spec/pull/875) -- `label:description` now allows CommonMark for rich-text representation ([#950](https://github.com/radiantearth/stac-spec/issues/950)) +- Cleaned up examples -[Unreleased]: https://github.com/stac-extensions/label/compare/v1.0.2...HEAD -[1.0.2]: https://github.com/stac-extensions/label/compare/v1.0.0...v1.0.2 -[1.0.0]: https://github.com/stac-extensions/label/compare/v0.0.1...v1.0.0 +[Unreleased]: https://github.com/stac-extensions/label/compare/v1.0.0...HEAD diff --git a/README.md b/README.md index 1ee9517..0e339bc 100644 --- a/README.md +++ b/README.md @@ -6,8 +6,7 @@ - **Scope:** Item, Collection - **Extension [Maturity Classification](https://github.com/radiantearth/stac-spec/tree/master/extensions/README.md#extension-maturity):** Proposal - **Owner**: @jisantuc -- [**Changelog**](./CHANGELOG.md) -- **History**: [Prior to March 2, 2021](https://github.com/radiantearth/stac-spec/tree/3d19e978e8aec2fb9268dfd31abfe308c4656998/extensions/label) +- **History**: [Prior to March 2, 2021](https://github.com/radiantearth/stac-spec/commits/v1.0.0-rc.1/extensions/label) This extension is meant to support using labeled AOIs with Machine Learning models, particularly training data sets, but can be used in any application where labeled @@ -31,7 +30,7 @@ to be contained with a GeoJSON FeatureCollection: --- -- Examples +- Examples: - Roads - [Example Roads Item](examples/spacenet-roads/roads_item.json) - [Example Roads Asset (labels)](examples/spacenet-roads/spacenetroads_AOI_3_Paris_img101.geojson) @@ -46,8 +45,8 @@ to be contained with a GeoJSON FeatureCollection: - [Example World Bank Zanzibar Buildings Collection](examples/multidataset/zanzibar/collection.json) - [Example World Bank Zanzibar Building Item 1](examples/multidataset/zanzibar/znz001.json) - [Example World Bank Zanzibar Building Item 2](examples/multidataset/zanzibar/znz029.json) -- Schema - - [JSON Schema](json-schema/schema.json) +- [JSON Schema](json-schema/schema.json) +- [Changelog](./CHANGELOG.md) ## Item Properties diff --git a/json-schema/schema.json b/json-schema/schema.json index b6a02d4..ec79e1f 100644 --- a/json-schema/schema.json +++ b/json-schema/schema.json @@ -1,154 +1,219 @@ { "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "https://stac-extensions.github.io/label/v1.0.2/schema.json", + "$id": "https://stac-extensions.github.io/label/v1.0.0/schema.json#", "title": "Label Extension", - "description": "STAC Label Data Item Extension Spec", - "allOf": [ + "description": "STAC Label Extension for STAC Items and STAC Collections.", + "oneOf": [ { - "$ref": "#/definitions/label" - } - ], - "definitions": { - "label": { - "type": "object", - "required": [ - "stac_extensions", - "properties" - ], - "properties": { - "stac_extensions": { - "type": "array", - "contains": { - "enum": [ - "label", - "https://schemas.stacspec.org/v1.0.0-beta.2/extensions/label/json-schema/schema.json" - ] - } - }, - "properties": { + "$comment": "This is the schema for STAC Items.", + "allOf": [ + { "type": "object", "required": [ - "label:properties", - "label:description", - "label:type" + "type", + "properties", + "assets" ], "properties": { - "label:properties": { - "title": "Property", - "oneOf": [ + "type": { + "const": "Feature" + }, + "properties": { + "allOf": [ { - "type": "array", - "items": { - "type": "string" - } + "$comment": "Require fields here for item properties.", + "required": [ + "label:properties", + "label:description", + "label:type" + ] }, { - "type": "null" + "$ref": "#/definitions/fields" } ] }, - "label:classes": { - "title": "Classes", - "type": "array", - "items": { - "type": "object", - "required": [ - "name", - "classes" - ], - "properties": { - "name": { - "title": "Name", - "type": "string" - }, - "classes": { - "title": "Classes", - "oneOf": [ - { - "type": "array", - "items": { - "type": "string" - } - }, - { - "type": "array", - "items": { - "type": "number" - } - } - ] - } - } + "assets": { + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/fields" } + } + } + }, + { + "$ref": "#/definitions/stac_extensions" + } + ] + }, + { + "$comment": "This is the schema for STAC Collections.", + "allOf": [ + { + "type": "object", + "required": [ + "type" + ], + "properties": { + "type": { + "const": "Collection" }, - "label:description": { - "title": "Description", - "type": "string" - }, - "label:type": { - "title": "Type", - "type": "string", - "enum": [ - "raster", - "vector" - ] - }, - "label:tasks": { - "title": "Task", - "type": "array", - "items": { - "type": "string" + "assets": { + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/fields" } }, - "label:methods": { - "title": "Method", + "item_assets": { + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/fields" + } + } + } + }, + { + "$comment": "Remove this and the following object if this is not an extension to a Collection.", + "$ref": "#/definitions/stac_extensions" + }, + { + "$ref": "#/definitions/fields" + } + ] + } + ], + "definitions": { + "stac_extensions": { + "type": "object", + "required": [ + "stac_extensions" + ], + "properties": { + "stac_extensions": { + "type": "array", + "contains": { + "const": "https://stac-extensions.github.io/label/v1.0.0/schema.json" + } + } + } + }, + "fields": { + "type": "object", + "properties": { + "label:properties": { + "title": "Property", + "oneOf": [ + { "type": "array", "items": { "type": "string" } }, - "label:overviews": { - "title": "Overview", - "type": "array", - "items": { - "type": "object", - "properties": { - "property_key": { - "title": "Property Key", - "type": "string" - }, - "counts": { - "title": "Counts", + { + "type": "null" + } + ] + }, + "label:classes": { + "title": "Classes", + "type": "array", + "items": { + "type": "object", + "required": [ + "name", + "classes" + ], + "properties": { + "name": { + "title": "Name", + "type": "string" + }, + "classes": { + "title": "Classes", + "oneOf": [ + { "type": "array", "items": { - "type": "object", - "properties": { - "name": { - "title": "Class Name", - "type": "string" - }, - "count": { - "title": "Count", - "type": "integer" - } - } + "type": "string" } }, - "statistics": { - "title": "Statistics", + { "type": "array", "items": { - "type": "object", - "properties": { - "name": { - "title": "Stat Name", - "type": "string" - }, - "value": { - "title": "Value", - "type": "number" - } - } + "type": "number" + } + } + ] + } + } + } + }, + "label:description": { + "title": "Description", + "type": "string" + }, + "label:type": { + "title": "Type", + "type": "string", + "enum": [ + "raster", + "vector" + ] + }, + "label:tasks": { + "title": "Task", + "type": "array", + "items": { + "type": "string" + } + }, + "label:methods": { + "title": "Method", + "type": "array", + "items": { + "type": "string" + } + }, + "label:overviews": { + "title": "Overview", + "type": "array", + "items": { + "type": "object", + "properties": { + "property_key": { + "title": "Property Key", + "type": "string" + }, + "counts": { + "title": "Counts", + "type": "array", + "items": { + "type": "object", + "properties": { + "name": { + "title": "Class Name", + "type": "string" + }, + "count": { + "title": "Count", + "type": "integer" + } + } + } + }, + "statistics": { + "title": "Statistics", + "type": "array", + "items": { + "type": "object", + "properties": { + "name": { + "title": "Stat Name", + "type": "string" + }, + "value": { + "title": "Value", + "type": "number" } } } @@ -156,7 +221,13 @@ } } } - } + }, + "patternProperties": { + "^(?!label:)": { + "$comment": "Above, change `template` to the prefix of this extension" + } + }, + "additionalProperties": false } } -} +} \ No newline at end of file diff --git a/package.json b/package.json index 45716e3..fd904e3 100644 --- a/package.json +++ b/package.json @@ -15,6 +15,6 @@ "remark-preset-lint-markdown-style-guide": "^3.0.0", "remark-preset-lint-recommended": "^4.0.0", "remark-validate-links": "^10.0.0", - "stac-node-validator": "^1.0.1" + "stac-node-validator": "^1.0.0" } }