diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..3351672 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,8 @@ +# EditorConfig is awesome: https://EditorConfig.org + +[*] +charset = utf-8 +end_of_line = lf +indent_size = 2 +indent_style = space +insert_final_newline = true diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..b6eb0c1 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,10 @@ +version: 2 +updates: + - package-ecosystem: github-actions + directory: / + schedule: + interval: daily + - package-ecosystem: npm + directory: / + schedule: + interval: daily diff --git a/.github/remark.yaml b/.github/remark.yaml index 70dddb2..a26695c 100644 --- a/.github/remark.yaml +++ b/.github/remark.yaml @@ -33,6 +33,7 @@ plugins: - - remark-lint-no-shortcut-reference-link - false # Lists + - remark-gfm - remark-lint-list-item-bullet-indent - remark-lint-ordered-list-marker-style - remark-lint-ordered-list-marker-value @@ -40,7 +41,6 @@ plugins: - - remark-lint-unordered-list-marker-style - '-' - - remark-lint-list-item-indent - - space # Tables - remark-lint-table-pipes - remark-lint-no-literal-urls diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 029974a..fc28054 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -10,7 +10,7 @@ jobs: uses: rlespinasse/github-slug-action@v4.4.1 - uses: actions/checkout@v4 - name: deploy JSON Schema for version ${{ env.GITHUB_REF_SLUG }} - uses: peaceiris/actions-gh-pages@v3.9.3 + uses: peaceiris/actions-gh-pages@v4 with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: json-schema diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 0b7a055..304fdcc 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -1,13 +1,26 @@ name: Check Markdown and Examples -on: [push, pull_request] +on: + pull_request: + push: + branches: + - master + workflow_dispatch: jobs: - deploy: + test: runs-on: ubuntu-latest steps: - - uses: actions/setup-node@v3 - with: - node-version: 'lts/*' + - uses: actions/setup-node@v3.7.0 - uses: actions/checkout@v4 - - run: | - npm install - npm test + - run: npm install + - run: npm test + finalise: + name: Verify all dependencies passed + if: always() + needs: + - test + runs-on: ubuntu-22.04 + steps: + - name: Decide whether the needed jobs succeeded or failed + uses: re-actors/alls-green@v1.2.2 + with: + jobs: ${{ toJSON(needs) }} diff --git a/.gitignore b/.gitignore index 8ab09c2..78e71c8 100644 --- a/.gitignore +++ b/.gitignore @@ -9,4 +9,6 @@ Thumbs.db # Node / npm .npm /node_modules/ -package-lock.json \ No newline at end of file +/.idea/ +/node_modules/ +/package-lock.json diff --git a/.kodiak.toml b/.kodiak.toml new file mode 100644 index 0000000..51806e5 --- /dev/null +++ b/.kodiak.toml @@ -0,0 +1,10 @@ +version = 1 + +[approve] +auto_approve_usernames = ["dependabot"] + +[merge] +method = "squash" + +[merge.message] +title = "pull_request_title" diff --git a/CHANGELOG.md b/CHANGELOG.md index dd0fd2f..21f26ba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [Unreleased] +## [Unreleased][] ### Added diff --git a/README.md b/README.md index bf65d0e..80ce2f2 100644 --- a/README.md +++ b/README.md @@ -1,36 +1,37 @@ # Template Extension Specification -- **Title:** Template -- **Identifier:** -- **Field Name Prefix:** template -- **Scope:** Item, Collection -- **Extension [Maturity Classification](https://github.com/radiantearth/stac-spec/tree/master/extensions/README.md#extension-maturity):** Proposal -- **Owner**: @your-gh-handles @person2 +- foo +- **Title:** Template +- **Identifier:** +- **Field Name Prefix:** template +- **Scope:** Item, Collection +- **Extension [Maturity Classification](https://github.com/radiantearth/stac-spec/tree/master/extensions/README.md#extension-maturity):** Proposal +- **Owner**: @your-gh-handles @person2 This document explains the Template Extension to the [SpatioTemporal Asset Catalog](https://github.com/radiantearth/stac-spec) (STAC) specification. This is the place to add a short introduction. -- Examples: - - [Item example](examples/item.json): Shows the basic usage of the extension in a STAC Item - - [Collection example](examples/collection.json): Shows the basic usage of the extension in a STAC Collection -- [JSON Schema](json-schema/schema.json) -- [Changelog](./CHANGELOG.md) +- Examples: + - [Item example](examples/item.json): Shows the basic usage of the extension in a STAC Item + - [Collection example](examples/collection.json): Shows the basic usage of the extension in a STAC Collection +- [JSON Schema](json-schema/schema.json) +- [Changelog](./CHANGELOG.md) ## Fields The fields in the table below can be used in these parts of STAC documents: -- [ ] Catalogs -- [x] Collections -- [x] Item Properties (incl. Summaries in Collections) -- [x] Assets (for both Collections and Items, incl. Item Asset Definitions in Collections) -- [ ] Links +- [ ] Catalogs +- [x] Collections +- [x] Item Properties (incl. Summaries in Collections) +- [x] Assets (for both Collections and Items, incl. Item Asset Definitions in Collections) +- [ ] Links -| Field Name | Type | Description | -| -------------------- | ------------------------- | -------------------------------------------- | +| Field Name | Type | Description | +| -------------------- | ------------------------- | ----------- | | template:new_field | string | **REQUIRED**. Describe the required field... | -| template:xyz | [XYZ Object](#xyz-object) | Describe the field... | -| template:another_one | \[number] | Describe the field... | +| template:xyz | [XYZ Object](#xyz-object) | Describe the field... | +| template:another_one | \[number] | Describe the field... | ### Additional Field Information @@ -42,8 +43,8 @@ This is a much more detailed description of the field `template:new_field`... This is the introduction for the purpose and the content of the XYZ Object... -| Field Name | Type | Description | -| ---------- | ------ | -------------------------------------------- | +| Field Name | Type | Description | +| ---------- | ------ | ----------- | | x | number | **REQUIRED**. Describe the required field... | | y | number | **REQUIRED**. Describe the required field... | | z | number | **REQUIRED**. Describe the required field... | @@ -53,8 +54,8 @@ This is the introduction for the purpose and the content of the XYZ Object... The following types should be used as applicable `rel` types in the [Link Object](https://github.com/radiantearth/stac-spec/tree/master/item-spec/item-spec.md#link-object). -| Type | Description | -| -------------- | ------------------------------------- | +| Type | Description | +| -------------- | ----------- | | fancy-rel-type | This link points to a fancy resource. | ## Contributing diff --git a/json-schema/schema.json b/json-schema/schema.json index 8eae23b..5141c23 100644 --- a/json-schema/schema.json +++ b/json-schema/schema.json @@ -3,143 +3,157 @@ "$id": "https://stac-extensions.github.io/template/v1.0.0/schema.json#", "title": "Template Extension", "description": "STAC Template Extension for STAC Items and STAC Collections.", - "oneOf": [ + "allOf": [ { - "$comment": "This is the schema for STAC Items. Remove this object if this extension only applies to Collections.", - "allOf": [ - { - "$ref": "#/definitions/stac_extensions" - }, - { - "type": "object", - "required": [ - "type", - "properties", - "assets" - ], - "properties": { - "type": { - "const": "Feature" - }, + "$ref": "#/definitions/stac_extensions" + }, + { + "if": { + "properties": { + "type": { + "const": "Feature" + } + } + }, + "then": { + "$comment": "This is the schema for STAC Items. Remove this object if this extension only applies to Collections.", + "allOf": [ + { + "$ref": "#/definitions/stac_extensions" + }, + { + "type": "object", + "required": [ + "type", + "properties", + "assets" + ], "properties": { - "allOf": [ - { - "$comment": "Require fields here for Item Properties.", - "required": [ - "template:new_field" - ] - }, - { + "properties": { + "allOf": [ + { + "$comment": "Require fields here for Item Properties.", + "required": [ + "template:new_field" + ] + }, + { + "$ref": "#/definitions/fields" + } + ] + }, + "assets": { + "$comment": "This validates the fields in Item Assets, but does not require them.", + "type": "object", + "additionalProperties": { "$ref": "#/definitions/fields" } - ] - }, - "assets": { - "$comment": "This validates the fields in Item Assets, but does not require them.", - "type": "object", - "additionalProperties": { - "$ref": "#/definitions/fields" } } } - } - ] - }, - { - "$comment": "This is the schema for STAC Collections.", - "type": "object", - "allOf": [ - { - "required": [ - "type" - ], + ] + }, + "else": { + "if": { "properties": { "type": { "const": "Collection" } } }, - { - "$ref": "#/definitions/stac_extensions" - } - ], - "anyOf": [ - { - "$comment": "This is the schema for the top-level fields in a Collection. Remove this if this extension does not define top-level fields for Collections.", + "then": { + "$comment": "This is the schema for STAC Collections.", + "type": "object", "allOf": [ { - "$comment": "Require fields here for Collections (top-level).", "required": [ - "template:new_field" + "type" ] }, { - "$ref": "#/definitions/fields" + "$ref": "#/definitions/stac_extensions" } - ] - }, - { - "$comment": "This validates the fields in Collection Assets, but does not require them.", - "required": [ - "assets" ], - "properties": { - "assets": { - "type": "object", - "not": { - "additionalProperties": { + "anyOf": [ + { + "$comment": "This is the schema for the top-level fields in a Collection. Remove this if this extension does not define top-level fields for Collections.", + "allOf": [ + { + "$comment": "Require fields here for Collections (top-level).", + "required": [ + "template:new_field" + ] + }, + { + "$ref": "#/definitions/fields" + } + ] + }, + { + "$comment": "This validates the fields in Collection Assets, but does not require them.", + "required": [ + "assets" + ], + "properties": { + "assets": { + "type": "object", "not": { - "allOf": [ - { - "$ref": "#/definitions/require_any_field" - }, - { - "$ref": "#/definitions/fields" + "additionalProperties": { + "not": { + "allOf": [ + { + "$ref": "#/definitions/require_any_field" + }, + { + "$ref": "#/definitions/fields" + } + ] } - ] + } } } } - } - } - }, - { - "$comment": "This is the schema for the fields in Item Asset Definitions. It doesn't require any fields.", - "required": [ - "item_assets" - ], - "properties": { - "item_assets": { - "type": "object", - "not": { - "additionalProperties": { + }, + { + "$comment": "This is the schema for the fields in Item Asset Definitions. It doesn't require any fields.", + "required": [ + "item_assets" + ], + "properties": { + "item_assets": { + "type": "object", "not": { - "allOf": [ - { - "$ref": "#/definitions/require_any_field" - }, - { - "$ref": "#/definitions/fields" + "additionalProperties": { + "not": { + "allOf": [ + { + "$ref": "#/definitions/require_any_field" + }, + { + "$ref": "#/definitions/fields" + } + ] } - ] + } } } } + }, + { + "$comment": "This is the schema for the fields in Summaries. By default, only checks the existence of the properties, but not the schema of the summaries.", + "required": [ + "summaries" + ], + "properties": { + "summaries": { + "$ref": "#/definitions/require_any_field" + } + } } - } + ] }, - { - "$comment": "This is the schema for the fields in Summaries. By default, only checks the existence of the properties, but not the schema of the summaries.", - "required": [ - "summaries" - ], - "properties": { - "summaries": { - "$ref": "#/definitions/require_any_field" - } - } - } - ] + "else": false + } } ], "definitions": { diff --git a/package.json b/package.json index c8eee26..0b1f5c9 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "stac-extension-template", + "name": "stac-extensions", "version": "1.0.0", "scripts": { "test": "npm run check-markdown && npm run check-examples", @@ -10,7 +10,7 @@ "dependencies": { "remark-cli": "^12.0.0", "remark-gfm": "^4.0.0", - "remark-lint": "^9.1.2", + "remark-lint": "^10.0.0", "remark-lint-no-html": "^3.1.2", "remark-preset-lint-consistent": "^5.1.2", "remark-preset-lint-markdown-style-guide": "^5.1.3", diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..b23077c --- /dev/null +++ b/shell.nix @@ -0,0 +1,15 @@ +{ pkgs ? import + ( + fetchTarball + { + name = "21.05"; + url = "https://github.com/NixOS/nixpkgs/archive/7e9b0dff974c89e070da1ad85713ff3c20b0ca97.tar.gz"; + sha256 = "1ckzhh24mgz6jd1xhfgx0i9mijk6xjqxwsshnvq789xsavrmsc36"; + }) + { } +}: +pkgs.mkShell { + buildInputs = [ + pkgs.nodejs + ]; +}