From 1ad5af3b934b816274871ce7b68e02e206a33e11 Mon Sep 17 00:00:00 2001 From: Matthias Mohr Date: Mon, 6 Mar 2023 15:43:03 +0100 Subject: [PATCH 1/3] v1.0.0 --- CHANGELOG.md | 5 +++++ README.md | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1427549..762f376 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,4 +16,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed +## [1.0.0] - 2023-03-06 + +- First release + [Unreleased]: +[1.0.0]: diff --git a/README.md b/README.md index 03f002c..6095a80 100644 --- a/README.md +++ b/README.md @@ -126,6 +126,12 @@ for(key in stac.assets) { } ``` +## Implementations + +The following client and/or server software implement this extension: + +- [STAC Browser](https://github.com/radiantearth/stac-browser) + ## Contributing All contributions are subject to the From 59d05d507d5f020236017b06c9166fe28cce384f Mon Sep 17 00:00:00 2001 From: yharby Date: Tue, 25 Aug 2026 14:58:52 +0900 Subject: [PATCH 2/3] fix: validate hreflang on links and assets --- json-schema/schema.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/json-schema/schema.json b/json-schema/schema.json index 4c00b37..ddecfde 100644 --- a/json-schema/schema.json +++ b/json-schema/schema.json @@ -17,7 +17,7 @@ "links": { "type": "array", "items": { - "$refs": "#/definitions/href_fields" + "$ref": "#/definitions/href_fields" } } }, @@ -122,7 +122,7 @@ "assets": { "type" : "object", "additionalProperties": { - "$refs": "#/definitions/href_fields" + "$ref": "#/definitions/href_fields" } }, "language_code": { From 284ed6ddf845294a8549a449ed6531fbad6be286 Mon Sep 17 00:00:00 2001 From: yharby Date: Tue, 25 Aug 2026 14:59:04 +0900 Subject: [PATCH 3/3] test: verify hreflang on STAC 1.1.0 examples --- CHANGELOG.md | 4 +++ examples/ar/catalog.json | 4 +-- examples/ar/item.json | 2 +- examples/catalog.json | 4 +-- examples/de/catalog.json | 4 +-- examples/de/item.json | 4 +-- examples/item.json | 2 +- package.json | 4 ++- tests/schema.js | 54 ++++++++++++++++++++++++++++++++++++++++ 9 files changed, 71 insertions(+), 11 deletions(-) create mode 100644 tests/schema.js diff --git a/CHANGELOG.md b/CHANGELOG.md index 762f376..e1bfe10 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,12 +10,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +- Update the examples to STAC 1.1.0. + ### Deprecated ### Removed ### Fixed +- Validate `hreflang` on links and assets. + ## [1.0.0] - 2023-03-06 - First release diff --git a/examples/ar/catalog.json b/examples/ar/catalog.json index cbdaa75..055fb8e 100644 --- a/examples/ar/catalog.json +++ b/examples/ar/catalog.json @@ -1,5 +1,5 @@ { - "stac_version": "1.0.0", + "stac_version": "1.1.0", "stac_extensions": [ "https://stac-extensions.github.io/language/v1.0.0/schema.json" ], @@ -73,4 +73,4 @@ "hreflang": "en-US" } ] -} \ No newline at end of file +} diff --git a/examples/ar/item.json b/examples/ar/item.json index d1deac9..6c47ee8 100644 --- a/examples/ar/item.json +++ b/examples/ar/item.json @@ -1,5 +1,5 @@ { - "stac_version": "1.0.0", + "stac_version": "1.1.0", "stac_extensions": [ "https://stac-extensions.github.io/language/v1.0.0/schema.json" ], diff --git a/examples/catalog.json b/examples/catalog.json index 9674022..99b6321 100644 --- a/examples/catalog.json +++ b/examples/catalog.json @@ -1,5 +1,5 @@ { - "stac_version": "1.0.0", + "stac_version": "1.1.0", "stac_extensions": [ "https://stac-extensions.github.io/language/v1.0.0/schema.json" ], @@ -73,4 +73,4 @@ "hreflang": "en-US" } ] -} \ No newline at end of file +} diff --git a/examples/de/catalog.json b/examples/de/catalog.json index d9abee0..9c09cd5 100644 --- a/examples/de/catalog.json +++ b/examples/de/catalog.json @@ -1,5 +1,5 @@ { - "stac_version": "1.0.0", + "stac_version": "1.1.0", "stac_extensions": [ "https://stac-extensions.github.io/language/v1.0.0/schema.json" ], @@ -73,4 +73,4 @@ "hreflang": "en-US" } ] -} \ No newline at end of file +} diff --git a/examples/de/item.json b/examples/de/item.json index 14500fe..1e327d3 100644 --- a/examples/de/item.json +++ b/examples/de/item.json @@ -1,5 +1,5 @@ { - "stac_version": "1.0.0", + "stac_version": "1.1.0", "stac_extensions": [ "https://stac-extensions.github.io/language/v1.0.0/schema.json" ], @@ -105,4 +105,4 @@ "hreflang": "de" } } -} \ No newline at end of file +} diff --git a/examples/item.json b/examples/item.json index 540d9d1..a690d03 100644 --- a/examples/item.json +++ b/examples/item.json @@ -1,5 +1,5 @@ { - "stac_version": "1.0.0", + "stac_version": "1.1.0", "stac_extensions": [ "https://stac-extensions.github.io/language/v1.0.0/schema.json" ], diff --git a/package.json b/package.json index 3defabd..0bd207d 100644 --- a/package.json +++ b/package.json @@ -2,12 +2,14 @@ "name": "stac-extensions", "version": "1.0.0", "scripts": { - "test": "npm run check-markdown && npm run check-examples", + "test": "npm run check-markdown && npm run check-examples && npm run check-schema", "check-markdown": "remark . -f -r .github/remark.yaml", "check-examples": "stac-node-validator . --lint --verbose --schemaMap https://stac-extensions.github.io/language/v1.0.0/schema.json=./json-schema/schema.json", + "check-schema": "node tests/schema.js", "format-examples": "stac-node-validator . --format --schemaMap https://stac-extensions.github.io/language/v1.0.0/schema.json=./json-schema/schema.json" }, "dependencies": { + "ajv": "^8.20.0", "remark-cli": "^8.0.0", "remark-lint": "^7.0.0", "remark-lint-no-html": "^2.0.0", diff --git a/tests/schema.js b/tests/schema.js new file mode 100644 index 0000000..9747ff6 --- /dev/null +++ b/tests/schema.js @@ -0,0 +1,54 @@ +const assert = require('node:assert/strict'); +const fs = require('node:fs'); +const path = require('node:path'); + +const Ajv = require('ajv'); + +const extensionId = 'https://stac-extensions.github.io/language/v1.0.0/schema.json'; +const schemaPath = path.join(__dirname, '..', 'json-schema', 'schema.json'); +const schema = JSON.parse(fs.readFileSync(schemaPath, 'utf8')); +const validate = new Ajv({allErrors: true, strict: false}).compile(schema); + +function assertInvalidHreflang(document, path) { + assert.equal(validate(document), false); + assert.ok( + validate.errors.some(error => error.instancePath === path), + `expected a validation error at ${path}` + ); +} + +assertInvalidHreflang( + { + stac_version: '1.1.0', + stac_extensions: [extensionId], + type: 'Catalog', + language: {code: 'en'}, + links: [ + { + rel: 'alternate', + href: 'de/catalog.json', + hreflang: 123 + } + ] + }, + '/links/0/hreflang' +); + +assertInvalidHreflang( + { + stac_version: '1.1.0', + stac_extensions: [extensionId], + type: 'Feature', + properties: {language: {code: 'en'}}, + links: [], + assets: { + metadata: { + href: 'metadata.xml', + hreflang: 123 + } + } + }, + '/assets/metadata/hreflang' +); + +console.log('Invalid hreflang values are rejected on links and assets.');