Skip to content

Commit 4a97ad1

Browse files
committed
Add template
1 parent d52ba2d commit 4a97ad1

File tree

9 files changed

+370
-2
lines changed

9 files changed

+370
-2
lines changed

.github/remark.yaml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
plugins:
2+
# Check links
3+
- validate-links
4+
# Apply some recommended defaults for consistency
5+
- remark-preset-lint-consistent
6+
- remark-preset-lint-recommended
7+
- lint-no-html
8+
# General formatting
9+
- - remark-lint-emphasis-marker
10+
- '*'
11+
- remark-lint-hard-break-spaces
12+
- remark-lint-blockquote-indentation
13+
- remark-lint-no-consecutive-blank-lines
14+
- - remark-lint-maximum-line-length
15+
- 150
16+
# Code
17+
- remark-lint-fenced-code-flag
18+
- remark-lint-fenced-code-marker
19+
- remark-lint-no-shell-dollars
20+
- - remark-lint-code-block-style
21+
- 'fenced'
22+
# Headings
23+
- remark-lint-heading-increment
24+
- remark-lint-no-duplicate-headings
25+
- remark-lint-no-multiple-toplevel-headings
26+
- remark-lint-no-heading-punctuation
27+
- - remark-lint-maximum-heading-length
28+
- 70
29+
- - remark-lint-heading-style
30+
- atx
31+
# Lists
32+
- remark-lint-list-item-bullet-indent
33+
- remark-lint-ordered-list-marker-style
34+
- remark-lint-ordered-list-marker-value
35+
- remark-lint-checkbox-character-style
36+
- - remark-lint-unordered-list-marker-style
37+
- '-'
38+
- - remark-lint-list-item-indent
39+
- space
40+
# Tables
41+
- remark-lint-table-pipes
42+
- remark-lint-no-literal-urls

.github/workflows/publish.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Publish JSON Schema
2+
on:
3+
release:
4+
types: [published]
5+
jobs:
6+
deploy:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: Inject env variables
10+
uses: rlespinasse/[email protected]
11+
- uses: actions/checkout@v2
12+
- name: deploy JSON Schema for version ${{ env.GITHUB_REF_SLUG }}
13+
uses: peaceiris/actions-gh-pages@v3
14+
with:
15+
github_token: ${{ secrets.GITHUB_TOKEN }}
16+
publish_dir: json-schema
17+
destination_dir: ${{ env.GITHUB_REF_SLUG }}

.github/workflows/test.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: Check Markdown and Examples
2+
on: [push, pull_request]
3+
jobs:
4+
deploy:
5+
runs-on: ubuntu-latest
6+
strategy:
7+
matrix:
8+
node-version: [14.x]
9+
steps:
10+
- uses: actions/setup-node@v1
11+
- uses: actions/checkout@v2
12+
- run: |
13+
npm install
14+
npm test

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/package-lock.json
2+
/node_modules

README.md

Lines changed: 47 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,47 @@
1-
# template
2-
A template repository for new extensions. It enables CI for schema publishing and proposes some core structures.
1+
# Template Extension Specification
2+
3+
- **Title:** Template
4+
- **Identifier:** <https://stac-extensions.github.io/template/v1.0.0/schema.json>
5+
- **Field Name Prefix:** template
6+
- **Scope:** Item, Collection
7+
- **Extension [Maturity Classification](https://github.com/radiantearth/stac-spec/tree/master/extensions/README.md#extension-maturity):** Proposal
8+
- **Owner**: @your-gh-handles @person2
9+
10+
This is the place to add a short introduction.
11+
12+
- Examples:
13+
- [Item example](examples/item.json): Shows the basic usage of the extension in a STAC Item
14+
- [Collection example](examples/collection.json): Shows the basic usage of the extension in a STAC Collection
15+
- [JSON Schema](json-schema/schema.json)
16+
17+
## Item Properties and Collection Fields
18+
19+
| Field Name | Type | Description |
20+
| ----------- | ------------------------- | ----------- |
21+
| new_field | [XYZ Object](#xyz-object) | **REQUIRED**. Describe the required field... |
22+
| another_one | \[number] | Describe the field... |
23+
24+
### Additional Field Information
25+
26+
#### new_field
27+
28+
This is a much more detailed description of the field `new_field`...
29+
30+
### XYZ Object
31+
32+
This is the introduction for the purpose and the content of the XYZ Object...
33+
34+
| Field Name | Type | Description |
35+
| ----------- | ------ | ----------- |
36+
| x | number | **REQUIRED**. Describe the required field... |
37+
| y | number | **REQUIRED**. Describe the required field... |
38+
| z | number | **REQUIRED**. Describe the required field... |
39+
40+
## Relation types
41+
42+
The following types should be used as applicable `rel` types in the
43+
[Link Object](https://github.com/radiantearth/stac-spec/tree/master/item-spec/item-spec.md#link-object).
44+
45+
| Type | Description |
46+
| ------------------- | ----------- |
47+
| fancy-rel-type | This link points to a fancy resource. |

examples/collection.json

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
{
2+
"stac_version": "1.0.0-rc.1",
3+
"stac_extensions": [
4+
"https://stac-extensions.github.io/template/v1.0.0/schema.json"
5+
],
6+
"type": "Collection",
7+
"id": "collection",
8+
"title": "A title",
9+
"description": "A description",
10+
"license": "Apache-2.0",
11+
"extent": {
12+
"spatial": {
13+
"bbox": [
14+
[
15+
172.9,
16+
1.3,
17+
173,
18+
1.4
19+
]
20+
]
21+
},
22+
"temporal": {
23+
"interval": [
24+
[
25+
"2015-06-23T00:00:00Z",
26+
null
27+
]
28+
]
29+
}
30+
},
31+
"new_field": {
32+
"x": 1,
33+
"y": 2,
34+
"z": 3
35+
},
36+
"another_one": [
37+
1,
38+
2,
39+
3
40+
],
41+
"summaries": {
42+
"datetime": {
43+
"minimum": "2015-06-23T00:00:00Z",
44+
"maximum": "2019-07-10T13:44:56Z"
45+
}
46+
},
47+
"links": [
48+
{
49+
"href": "https://example.com/examples/collection.json",
50+
"rel": "self"
51+
}
52+
]
53+
}

examples/item.json

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
{
2+
"stac_version": "1.0.0-rc.1",
3+
"stac_extensions": [
4+
"https://stac-extensions.github.io/template/v1.0.0/schema.json"
5+
],
6+
"type": "Feature",
7+
"id": "item",
8+
"bbox": [
9+
172.9,
10+
1.3,
11+
173,
12+
1.4
13+
],
14+
"geometry": {
15+
"type": "Polygon",
16+
"coordinates": [
17+
[
18+
[
19+
172.9,
20+
1.3
21+
],
22+
[
23+
173,
24+
1.3
25+
],
26+
[
27+
173,
28+
1.4
29+
],
30+
[
31+
172.9,
32+
1.4
33+
],
34+
[
35+
172.9,
36+
1.3
37+
]
38+
]
39+
]
40+
},
41+
"properties": {
42+
"datetime": "2020-12-11T22:38:32Z",
43+
"new_field": {
44+
"x": 1,
45+
"y": 2,
46+
"z": 3
47+
},
48+
"another_one": [
49+
1,
50+
2,
51+
3
52+
]
53+
},
54+
"links": [
55+
{
56+
"href": "https://example.com/examples/item.json",
57+
"rel": "self"
58+
}
59+
],
60+
"assets": {
61+
"data": {
62+
"href": "https://example.com/examples/file.xyz"
63+
}
64+
}
65+
}

json-schema/schema.json

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"$id": "https://stac-extensions.github.io/template/v1.0.0/schema.json#",
4+
"title": "Template Extension",
5+
"description": "STAC Template Extension for STAC Items and STAC Collections.",
6+
"oneOf": [
7+
{
8+
"allOf": [
9+
{
10+
"type": "object",
11+
"required": [
12+
"type"
13+
],
14+
"properties": {
15+
"type": {
16+
"const": "Feature"
17+
}
18+
}
19+
},
20+
{
21+
"$ref": "#/definitions/stac_extensions"
22+
},
23+
{
24+
"type": "object",
25+
"required": [
26+
"properties"
27+
],
28+
"properties": {
29+
"properties": {
30+
"$ref": "#/definitions/template"
31+
}
32+
}
33+
}
34+
]
35+
},
36+
{
37+
"allOf": [
38+
{
39+
"type": "object",
40+
"required": [
41+
"type"
42+
],
43+
"properties": {
44+
"type": {
45+
"const": "Collection"
46+
}
47+
}
48+
},
49+
{
50+
"$ref": "#/definitions/stac_extensions"
51+
},
52+
{
53+
"$ref": "#/definitions/template"
54+
}
55+
]
56+
}
57+
],
58+
"definitions": {
59+
"stac_extensions": {
60+
"type": "object",
61+
"required": [
62+
"stac_extensions"
63+
],
64+
"properties": {
65+
"stac_extensions": {
66+
"type": "array",
67+
"contains": {
68+
"const": "https://stac-extensions.github.io/template/v1.0.0/schema.json"
69+
}
70+
}
71+
}
72+
},
73+
"template": {
74+
"type": "object",
75+
"required": [
76+
"new_field"
77+
],
78+
"properties": {
79+
"new_field": {
80+
"$ref": "#/definitions/xyz_object"
81+
},
82+
"another_one": {
83+
"type": "array",
84+
"items": {
85+
"type": "number"
86+
}
87+
}
88+
}
89+
},
90+
"xyz_object": {
91+
"type": "object",
92+
"required": [
93+
"x",
94+
"y",
95+
"z"
96+
],
97+
"properties": {
98+
"x": {
99+
"type": "number"
100+
},
101+
"y": {
102+
"type": "number"
103+
},
104+
"z": {
105+
"type": "number"
106+
}
107+
}
108+
}
109+
}
110+
}

package.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"name": "stac-extensions",
3+
"version": "1.0.0",
4+
"scripts": {
5+
"test": "npm run check-markdown && npm run check-examples",
6+
"check-markdown": "remark . -f -r .github/remark.yaml",
7+
"check-examples": "stac-node-validator . --lint --verbose --schemaMap https://stac-extensions.github.io/template/v1.0.0/schema.json=./json-schema/schema.json",
8+
"format-examples": "stac-node-validator . --format --schemaMap https://stac-extensions.github.io/template/v1.0.0/schema.json=./json-schema/schema.json"
9+
},
10+
"dependencies": {
11+
"remark-cli": "^8.0.0",
12+
"remark-lint": "^7.0.0",
13+
"remark-lint-no-html": "^2.0.0",
14+
"remark-preset-lint-consistent": "^3.0.0",
15+
"remark-preset-lint-markdown-style-guide": "^3.0.0",
16+
"remark-preset-lint-recommended": "^4.0.0",
17+
"remark-validate-links": "^10.0.0",
18+
"stac-node-validator": "^1.0.0"
19+
}
20+
}

0 commit comments

Comments
 (0)