Skip to content

Commit

Permalink
Merge pull request #509 from imperialCHEPI/disallow_additional_props_…
Browse files Browse the repository at this point in the history
…for_index

Disallow additional properties for data index files
  • Loading branch information
alexdewar authored Aug 29, 2024
2 parents e1aee17 + ca6da04 commit c608444
Show file tree
Hide file tree
Showing 8 changed files with 260 additions and 212 deletions.
7 changes: 6 additions & 1 deletion schemas/v1/data_index.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
"description": "Metadata and paths for Health-GPS input files",
"type": "object",
"properties": {
"$schema": {
"type": "string"
},
"country": {
"$ref": "data_index/country.json"
},
Expand All @@ -19,9 +22,11 @@
}
},
"required": [
"$schema",
"country",
"demographic",
"diseases",
"analysis"
]
],
"additionalProperties": false
}
90 changes: 55 additions & 35 deletions schemas/v1/data_index/analysis.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,49 +2,69 @@
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://raw.githubusercontent.com/imperialCHEPI/healthgps/main/schemas/v1/data_index/analysis.json",
"type": "object",
"allOf": [
{
"$ref": "../file_info.json"
"properties": {
"format": {
"const": "csv"
},
{
"delimiter": {
"const": ","
},
"encoding": {
"const": "UTF8"
},
"description": {
"type": "string"
},
"source": {
"type": "string"
},
"url": {
"type": "string",
"format": "uri"
},
"license": {
"type": "string"
},
"path": {
"type": "string"
},
"age_limits": {
"$ref": "../age_range.json"
},
"time_year": {
"type": "integer",
"minimum": 1900
},
"disability_file_name": {
"type": "string"
},
"lms_file_name": {
"type": "string"
},
"cost_of_disease": {
"type": "object",
"properties": {
"age_limits": {
"$ref": "../age_range.json"
},
"time_year": {
"type": "integer",
"minimum": 1900
},
"disability_file_name": {
"path": {
"type": "string"
},
"lms_file_name": {
"file_name": {
"type": "string"
},
"cost_of_disease": {
"type": "object",
"properties": {
"path": {
"type": "string"
},
"file_name": {
"type": "string"
}
},
"required": [
"path",
"file_name"
]
}
},
"required": [
"age_limits",
"time_year",
"disability_file_name",
"lms_file_name",
"cost_of_disease"
]
"path",
"file_name"
],
"additionalProperties": false
}
]
},
"required": [
"path",
"age_limits",
"time_year",
"disability_file_name",
"lms_file_name",
"cost_of_disease"
],
"additionalProperties": false
}
49 changes: 34 additions & 15 deletions schemas/v1/data_index/country.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,39 @@
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://raw.githubusercontent.com/imperialCHEPI/healthgps/main/schemas/v1/data_index/country.json",
"type": "object",
"allOf": [
{
"$ref": "../file_info.json"
},
{
"type": "object",
"properties": {
"file_name": {
"type": "string"
}
},
"required": [
"file_name"
]
"properties": {
"format": {
"const": "csv"
},
"delimiter": {
"const": ","
},
"encoding": {
"const": "UTF8"
},
"description": {
"type": "string"
},
"source": {
"type": "string"
},
"url": {
"type": "string",
"format": "uri"
},
"license": {
"type": "string"
},
"path": {
"type": "string"
},
"file_name": {
"type": "string"
}
]
},
"required": [
"path",
"file_name"
],
"additionalProperties": false
}
135 changes: 63 additions & 72 deletions schemas/v1/data_index/demographic.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,80 +2,71 @@
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://raw.githubusercontent.com/imperialCHEPI/healthgps/main/schemas/v1/data_index/demographic.json",
"type": "object",
"allOf": [
{
"$ref": "../file_info.json"
"properties": {
"format": {
"const": "csv"
},
{
"type": "object",
"properties": {
"age_limits": {
"$ref": "../age_range.json"
},
"time_limits": {
"type": "array",
"prefixItems": [
{
"type": "integer",
"minimum": 1900
},
{
"type": "integer",
"minimum": 1900
}
],
"minItems": 2,
"items": false
},
"projections": {
"type": "integer"
},
"population": {
"type": "object",
"properties": {
"description": {
"type": "string"
},
"path": {
"type": "string"
},
"file_name": {
"type": "string"
}
},
"required": [
"description",
"path",
"file_name"
]
"delimiter": {
"const": ","
},
"encoding": {
"const": "UTF8"
},
"description": {
"type": "string"
},
"source": {
"type": "string"
},
"url": {
"type": "string",
"format": "uri"
},
"license": {
"type": "string"
},
"path": {
"type": "string"
},
"age_limits": {
"$ref": "../age_range.json"
},
"time_limits": {
"type": "array",
"prefixItems": [
{
"type": "integer",
"minimum": 1900
},
"mortality": {
"type": "object",
"properties": {
"description": {
"type": "string"
},
"path": {
"type": "string"
},
"file_name": {
"type": "string"
}
},
"required": [
"description",
"path",
"file_name"
]
{
"type": "integer",
"minimum": 1900
}
},
"required": [
"age_limits",
"time_limits",
"projections",
"population",
"mortality"
]
],
"minItems": 2,
"items": false
},
"projections": {
"type": "integer"
},
"population": {
"$ref": "demographic_file_info.json"
},
"mortality": {
"$ref": "demographic_file_info.json"
},
"indicators": {
"$ref": "demographic_file_info.json"
}
]
},
"required": [
"path",
"age_limits",
"time_limits",
"projections",
"population",
"mortality",
"indicators"
],
"additionalProperties": false
}
22 changes: 22 additions & 0 deletions schemas/v1/data_index/demographic_file_info.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://raw.githubusercontent.com/imperialCHEPI/healthgps/main/schemas/v1/data_index/demographic_file_info.json",
"type": "object",
"properties": {
"description": {
"type": "string"
},
"path": {
"type": "string"
},
"file_name": {
"type": "string"
}
},
"required": [
"description",
"path",
"file_name"
],
"additionalProperties": false
}
Loading

0 comments on commit c608444

Please sign in to comment.