Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Schema update based on final OGC API Records 1.0.0 #2

Merged
merged 4 commits into from
Dec 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .github/workflows/validation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: validate schema and examples

on:
push:
paths:
- '**.json'
- '**.yaml'
pull_request:
paths:
- '**.json'
- '**.yaml'

jobs:
main:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.11"]
steps:
- uses: actions/checkout@master
- uses: actions/setup-python@v5
name: Setup Python ${{ matrix.python-version }}
with:
python-version: ${{ matrix.python-version }}
- name: Install requirements 📦
run: |
python3 -m pip install --upgrade pip
pip3 install check-jsonschema
# - name: Run JSON Schema validation
# run: |
# check-jsonschema --check-metaschema schemas/resource.json
# for e in examples/*.json; do check-jsonschema --schemafile schemas/resource.json $e; done
157 changes: 66 additions & 91 deletions schemas/resource.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://raw.githubusercontent.com/EOEPCA/metadata-profile/refs/heads/master/resource.yaml",
"$id": "https://raw.githubusercontent.com/EOEPCA/metadata-profile/refs/heads/master/schemas/resource.json",
"title": "EOEPCA metadata profile",
"description": "EOEPCA metadata profile",
"allOf": [
Expand Down Expand Up @@ -67,10 +67,7 @@
},
"resolution": {
"type": "string",
"description": "Minimum time period resolvable in the dataset, as an ISO 8601 duration",
"example": [
"P1D"
]
"description": "Minimum time period resolvable in the dataset, as an ISO 8601 duration"
}
}
}
Expand Down Expand Up @@ -273,18 +270,18 @@
}
]
},
"conformsTo": {
"type": "array",
"description": "The extensions/conformance classes used in this record.",
"items": {
"type": "string"
}
},
"properties": {
"allOf": [
{
"type": "object",
"properties": {
"conformsTo": {
"type": "array",
"description": "The extensions/conformance classes used in this record.",
"items": {
"type": "string"
}
},
"created": {
"type": "string",
"description": "The date this record was created in the server.",
Expand Down Expand Up @@ -378,19 +375,16 @@
"properties": {
"code": {
"type": "string",
"description": "The language tag as per RFC-5646.",
"example": "el"
"description": "The language tag as per RFC-5646."
},
"name": {
"type": "string",
"minLength": 1,
"description": "The untranslated name of the language.",
"example": "Ελληνικά"
"description": "The untranslated name of the language."
},
"alternate": {
"type": "string",
"description": "The name of the language in another well-understood language, usually English.",
"example": "Greek"
"description": "The name of the language in another well-understood language, usually English."
},
"dir": {
"type": "string",
Expand Down Expand Up @@ -499,36 +493,7 @@
"description": "Graphic identifying a contact. The link relation should be `icon` and the media type should be an image media type.",
"allOf": [
{
"type": "object",
"required": [
"href",
"rel"
],
"properties": {
"href": {
"type": "string",
"example": "http://data.example.com/buildings/123"
},
"rel": {
"type": "string",
"example": "alternate"
},
"type": {
"type": "string",
"example": "application/geo+json"
},
"hreflang": {
"type": "string",
"example": "en"
},
"title": {
"type": "string",
"example": "Trierer Strasse 70, 53115 Bonn"
},
"length": {
"type": "integer"
}
}
"$ref": "#/allOf/0/properties/links/items"
},
{
"type": "object",
Expand Down Expand Up @@ -558,8 +523,7 @@
"value": {
"type": "string",
"description": "The value is the phone number itself.",
"pattern": "^\\+[1-9]{1}[0-9]{3,14}$",
"example": "+14165550142"
"pattern": "^\\+[1-9]{1}[0-9]{3,14}$"
},
"roles": {
"description": "The type of phone number (e.g. home, work, fax, etc.).",
Expand Down Expand Up @@ -631,7 +595,7 @@
"items": {
"allOf": [
{
"$ref": "#/allOf/0/properties/properties/allOf/0/properties/contacts/items/properties/logo/allOf/0"
"$ref": "#/allOf/0/properties/links/items"
},
{
"type": "object",
Expand All @@ -644,8 +608,7 @@
},
"hoursOfService": {
"type": "string",
"description": "Time period when the contact can be contacted.",
"example": "Hours: Mo-Fr 10am-7pm Sa 10am-22pm Su 10am-21pm"
"description": "Time period when the contact can be contacted."
},
"contactInstructions": {
"type": "string",
Expand Down Expand Up @@ -681,49 +644,62 @@
"type": "array",
"items": {
"type": "object",
"properties": {
"rel": {
"type": "string",
"description": "The type or semantics of the relation.",
"example": "alternate"
},
"type": {
"type": "string",
"description": "A hint indicating what the media type of the result of dereferencing the link should be.",
"example": "application/geo+json"
},
"hreflang": {
"type": "string",
"description": "A hint indicating what the language of the result of dereferencing the link should be.",
"example": "en"
},
"title": {
"type": "string",
"description": "Used to label the destination of a link such that it can be used as a human-readable identifier.",
"example": "Trierer Strasse 70, 53115 Bonn"
},
"length": {
"type": "integer"
},
"created": {
"type": "string",
"description": "Date of creation of the resource pointed to by the link.",
"format": "date-time"
"allOf": [
{
"type": "object",
"properties": {
"rel": {
"type": "string",
"description": "The type or semantics of the relation."
},
"type": {
"type": "string",
"description": "A hint indicating what the media type of the result of dereferencing the link should be."
},
"hreflang": {
"type": "string",
"description": "A hint indicating what the language of the result of dereferencing the link should be."
},
"title": {
"type": "string",
"description": "Used to label the destination of a link such that it can be used as a human-readable identifier."
},
"length": {
"type": "integer"
},
"created": {
"type": "string",
"description": "Date of creation of the resource pointed to by the link.",
"format": "date-time"
},
"updated": {
"type": "string",
"description": "Most recent date on which the resource pointed to by the link was changed.",
"format": "date-time"
}
}
},
"updated": {
"type": "string",
"description": "Most recent date on which the resource pointed to by the link was changed.",
"format": "date-time"
{
"type": "object",
"required": [
"href"
],
"properties": {
"href": {
"type": "string",
"format": "uri"
}
}
}
}
]
}
},
"linkTemplates": {
"type": "array",
"items": {
"allOf": [
{
"$ref": "#/allOf/0/properties/links/items"
"$ref": "#/allOf/0/properties/links/items/allOf/0"
},
{
"type": "object",
Expand All @@ -733,13 +709,12 @@
"properties": {
"uriTemplate": {
"type": "string",
"description": "Supplies a resolvable URI to a remote resource (or resource fragment).",
"example": "http://data.example.com/buildings/(building-id}"
"description": "Supplies a resolvable URI to a remote resource (or resource fragment)."
},
"varBase": {
"type": "string",
"description": "The base URI to which the variable name can be appended to retrieve the definition of the variable as a JSON Schema fragment.",
"format": "url"
"format": "uri"
},
"variables": {
"type": "object",
Expand Down Expand Up @@ -772,4 +747,4 @@
}
}
]
}
}
2 changes: 1 addition & 1 deletion schemas/resource.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ title: EOEPCA metadata profile
description: EOEPCA metadata profile

allOf:
- $ref: 'https://raw.githubusercontent.com/opengeospatial/ogcapi-records/refs/heads/master/core/openapi/schemas/recordGeoJSON.yaml'
- $ref: 'https://raw.githubusercontent.com/opengeospatial/ogcapi-records/refs/tags/1.0.0/core/openapi/schemas/recordGeoJSON.yaml'
- properties:
properties:
type: object
Expand Down
Loading