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

Disallow properties with type array and no items #1221

Merged
merged 6 commits into from
Jan 15, 2025
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ ENV/
*.iml
*.swp
.DS_Store
.vscode/

/scratch
datasets/index.json
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ repos:
rev: "v5.14.2"
hooks:
- id: validate-schema
args: ['https://schemas.data.amsterdam.nl/schema@v1.3.0', "--extra_meta_schema_url", "https://schemas.data.amsterdam.nl/schema@v2"]
args: ['https://schemas.data.amsterdam.nl/schema@v1.4.0', "--extra_meta_schema_url", "https://schemas.data.amsterdam.nl/schema@v2.1.0"]
files: '^datasets/.*\.json$'
verbose: true # so we can see against which metaschema it is valid
exclude: "^schema@.+" # exclude meta schemas
- id: validate-publishers
args: ['https://schemas.data.amsterdam.nl/schema@v2', '--schema-url', './publishers']
args: ['https://schemas.data.amsterdam.nl/schema@v2.1.0', '--schema-url', './publishers']
verbose: true # so we can see against which metaschema it is valid
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ In order to develop a new metaschema version locally and run structural and sema
4) generate-index > datasets/index.json

*Point the references in the dataset that we will use for development to the devserver*
5) sed -i 's/https:\/\/schemas\.data\.amsterdam\.nl/http:\/\/localhost:8000/g' datasets/<some-dataset>/{,**/}*.json
5) ```sed -i 's/https:\/\/schemas\.data\.amsterdam\.nl/http:\/\/localhost:8000/g' datasets/<some-dataset>/{,**/}*.json```

*Start an nginx server with the source mounted and which rewrites URIs so*
*that it supports the URL structure expected by the schema references.*
Expand Down
136 changes: 136 additions & 0 deletions [email protected]/dataset.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://schemas.data.amsterdam.nl/[email protected]",
"type": "object",
"allOf": [
{
"$ref": "./[email protected]#/definitions/basicProperties"
}
],
"required": [
"tables",
"status",
"creator",
"authorizationGrantor",
"owner",
"publisher",
"auth"
],
"properties": {
"schema": {
"const": "dataset"
},
"version": {
"$ref": "./[email protected]#/definitions/version"
},
"status": {
"type": "string",
"enum": [
"beschikbaar",
"niet_beschikbaar"
]
},
"homepage": {
"type": "string",
"format": "uri"
},
"language": {
"type": "string",
"minLength": 2,
"maxLength": 3
},
"accrualPeriodicity": {
"type": "string"
},
"spatialDescription": {
"type": "string"
},
"spatialCoordinates": {
"$ref": "https://geojson.org/schema/Geometry.json"
},
"theme": {
"type": "array",
"items": {
"type": "string"
}
},
"publisher": {
"description": "Naam van het datateam.",
"type": "string",
"minLength": 1
},
"creator": {
"description": "Naam van de bronhouder.",
"type": "string",
"minLength": 1
},
"owner": {
"type": "string",
"default": "Gemeente Amsterdam",
"minLength": 1
},
"authorizationGrantor": {
"type": "string",
"minLength": 1
},
"keywords": {
"type": "array",
"items": {
"type": "string"
}
},
"hasBeginning": {
"type": "string",
"format": "date-time"
},
"hasEnd": {
"type": "string",
"format": "date-time"
},
"objective": {
"type": "string"
},
"temporalUnit": {
"type": "string"
},
"spatial": {
"type": "string"
},
"legalBasis": {
"type": "string"
},
"contactPoint": {
"description": "Person and (optional) e-mail.",
"$ref": "./[email protected]#/definitions/contactPoint",
"default": {
"name": "datapunt",
"email": "[email protected]"
}
},
"crs": {
"description": "Coordinate reference system",
"$ref": "./[email protected]#/definitions/crs"
},
"tables": {
"type": "array",
"minItems": 1,
"items": {
"oneOf": [
{
"$ref": "./[email protected]"
},
{
"type": "object",
"additionalProperties": false,
"properties": {
"$ref": {
"type": "string",
"format": "uri-reference"
}
}
}
]
}
}
}
}
13 changes: 13 additions & 0 deletions [email protected]/distribution.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://schemas.data.amsterdam.nl/[email protected]",
"type": "object",
"properties": {
"title": {
"type": "string"
},
"description": {
"type": "string"
}
}
}
24 changes: 24 additions & 0 deletions [email protected]/meta/auth.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://schemas.data.amsterdam.nl/meta/[email protected]",
"$vocabulary": {
"https://schemas.data.amsterdam.nl/meta/[email protected]": true
},
"$recursiveAnchor": true,
"title": "Amsterdam Schema authorization",
"properties": {
"ams.auth": {
"oneOf": [
{
"type": "array",
"items": {
"type": "string"
}
},
{
"type": "null"
}
]
}
}
}
22 changes: 22 additions & 0 deletions [email protected]/meta/provenance.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://schemas.data.amsterdam.nl/meta/[email protected]",
"$vocabulary": {
"https://schemas.data.amsterdam.nl/meta/[email protected]": true
},
"$recursiveAnchor": true,
"title": "Amsterdam Schema provenance",
"properties": {
"provenance": {
"$comment": "This field can hold provenance data, per dataset, table or field.",
"oneOf": [
{
"type": "string"
},
{
"type": "object"
}
]
}
}
}
14 changes: 14 additions & 0 deletions [email protected]/meta/relation.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://schemas.data.amsterdam.nl/meta/[email protected]",
"$vocabulary": {
"https://schemas.data.amsterdam.nl/meta/[email protected]": true
},
"$recursiveAnchor": true,
"properties": {
"relation": {
"type": "string",
"format": "uri-reference"
}
}
}
15 changes: 15 additions & 0 deletions [email protected]/meta/unit.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://schemas.data.amsterdam.nl/meta/[email protected]",
"$vocabulary": {
"https://schemas.data.amsterdam.nl/meta/[email protected]": true
},
"$recursiveAnchor": true,
"title": "Amsterdam Schema unit",
"properties": {
"unit": {
"type": "string",
"$comment": "UCUM strings, see https://ucum.nlm.nih.gov/"
}
}
}
58 changes: 58 additions & 0 deletions [email protected]/publisher.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://schemas.data.amsterdam.nl/[email protected]",
"type": "object",
"allOf": [
{
"$ref": "./[email protected]#/definitions/basicProperties"
}
],
"required": [
"name",
"id",
"shortname",
"tags"
],
"properties": {
"schema": {
"const": "publisher"
},
"name": {
"description": "Naam van de publisher.",
"type": "string",
"minLength": 1
},
"id": {
"description": "ID van de publisher.",
"type": "string",
"minLength": 1,
"pattern": "[A-Za-z]"
},
"shortname": {
"description": "Verkorte naam van de publisher. (voor resources)",
"type": "string",
"minLength": 1,
"maxLength": 12,
"pattern": "[a-z]"
},
"tags": {
"description": "Labels met metagegevens die aan resources van deze publisher moeten worden gehangen",
"type": "object",
"required": [
"costcenter"
],
"properties": {
"costcenter": {
"description": "Costcenter tag van de publisher.",
"type": "string",
"minLength": 1
},
"team": {
"description": "Team tag van de publisher.",
"type": "string",
"minLength": 1
}
}
}
}
}
Loading
Loading