-
Notifications
You must be signed in to change notification settings - Fork 495
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10109 from IQSS/9464-schema-creator-validator
JSON Schema creator and validator
- Loading branch information
Showing
14 changed files
with
692 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Functionality has been added to help validate dataset JSON prior to dataset creation. There are two new API endpoints in this release. The first takes in a collection alias and returns a custom dataset schema based on the required fields of the collection. The second takes in a collection alias and a dataset JSON file and does an automated validation of the JSON file against the custom schema for the collection. In this release funtionality is limited to json format validation and validating required elements. Future releases will address field types, controlled vocabulary, etc. (Issue #9464 and #9465) | ||
|
||
For documentation see the API changelog: http://preview.guides.gdcc.io/en/develop/api/changelog.html |
122 changes: 122 additions & 0 deletions
122
doc/sphinx-guides/source/_static/api/dataset-schema.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-04/schema#", | ||
"$defs": { | ||
"field": { | ||
"type": "object", | ||
"required": ["typeClass", "multiple", "typeName"], | ||
"properties": { | ||
"value": { | ||
"anyOf": [ | ||
{ | ||
"type": "array" | ||
}, | ||
{ | ||
"type": "string" | ||
}, | ||
{ | ||
"$ref": "#/$defs/field" | ||
} | ||
] | ||
}, | ||
"typeClass": { | ||
"type": "string" | ||
}, | ||
"multiple": { | ||
"type": "boolean" | ||
}, | ||
"typeName": { | ||
"type": "string" | ||
} | ||
} | ||
} | ||
}, | ||
"type": "object", | ||
"properties": { | ||
"datasetVersion": { | ||
"type": "object", | ||
"properties": { | ||
"license": { | ||
"type": "object", | ||
"properties": { | ||
"name": { | ||
"type": "string" | ||
}, | ||
"uri": { | ||
"type": "string", | ||
"format": "uri" | ||
} | ||
}, | ||
"required": ["name", "uri"] | ||
}, | ||
"metadataBlocks": { | ||
"type": "object", | ||
"properties": { | ||
"citation": { | ||
"type": "object", | ||
"properties": { | ||
"fields": { | ||
"type": "array", | ||
"items": { | ||
"$ref": "#/$defs/field" | ||
}, | ||
"minItems": 5, | ||
"allOf": [ | ||
{ | ||
"contains": { | ||
"properties": { | ||
"typeName": { | ||
"const": "title" | ||
} | ||
} | ||
} | ||
}, | ||
{ | ||
"contains": { | ||
"properties": { | ||
"typeName": { | ||
"const": "author" | ||
} | ||
} | ||
} | ||
}, | ||
{ | ||
"contains": { | ||
"properties": { | ||
"typeName": { | ||
"const": "datasetContact" | ||
} | ||
} | ||
} | ||
}, | ||
{ | ||
"contains": { | ||
"properties": { | ||
"typeName": { | ||
"const": "dsDescription" | ||
} | ||
} | ||
} | ||
}, | ||
{ | ||
"contains": { | ||
"properties": { | ||
"typeName": { | ||
"const": "subject" | ||
} | ||
} | ||
} | ||
} | ||
] | ||
} | ||
}, | ||
"required": ["fields"] | ||
} | ||
}, | ||
"required": ["citation"] | ||
} | ||
}, | ||
"required": ["metadataBlocks"] | ||
} | ||
}, | ||
"required": ["datasetVersion"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.