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

Type missing from schema #85

Open
bgburton opened this issue Jul 25, 2022 · 0 comments
Open

Type missing from schema #85

bgburton opened this issue Jul 25, 2022 · 0 comments

Comments

@bgburton
Copy link

I have been validating the 1.3.0 schema with a json validator for an R project. It says that the schema is missing '"type": "object"' in several places, always before a properties field. This occurs directly within "additional_col_properties" and also within any of the "allOf" fields. The following appears to work. I only raise this because the schema will not validate without the corrections.

{
"$schema": "http://json-schema.org/draft-07/schema",
"definitions": {
"additional_col_properties": {
"type": "object",
"required": [
"name"
],
"properties": {
"name": {
"type": "string",
"title": "The column name"
},
"description": {
"type": "string",
"title": "A description of this field",
"default": ""
},
"nullable": {
"type": "boolean",
"title": "Specifies if column is nullable (can have missing values) or not (cannot have missing values)"
},
"sensitive": {
"type": "boolean",
"title": "Specifies if the column contains personal or special category data"
},
"alias": {
"type": "string",
"title": "If this column contains a standard ID or other linking field but has a non-standard name, the alias can provide the standard name",
"examples": [
"nomis_id"
]
},
"foreign_key": {
"type": "array",
"title": "The list of foreign key relationships this column has, if any",
"default": [],
"examples": [
[
{
"table": "",
"columns": []
}
]
],
"items": {
"anyOf": [
{
"type": "object",
"default": {},
"examples": [
{
"table": "",
"columns": []
}
],
"required": [
"table",
"columns"
],
"properties": {
"table": {
"type": "string",
"title": "The table name",
"default": "",
"examples": [
""
]
},
"columns": {
"type": "array",
"title": "The list of column names",
"default": []
}
},
"additionalProperties": true
}
]
}
},
"unique": {
"type": "boolean",
"title": "Specifies if the values in the column must be unique",
"default": false
},
"enum": {
"type": "array",
"title": "An array of valid values that can exist in this column. Note NULL/None is not required, please use nullable property to define if column is nullable.",
"examples": [
[
"Y",
"N"
],
[
0,
1,
2,
3,
4
],
[
"England",
"Northern Ireland",
"Scotland",
"Wales"
]
]
},
"pattern": {
"type": "string",
"title": "regex pattern that can be used to validate data in this column"
},
"minimum": {
"type": [
"null",
"number"
],
"title": "The minumum value a numerical type can take",
"default": null
},
"maximum": {
"type": [
"null",
"number"
],
"title": "The maximum value a numerical type can take",
"default": null
},
"minLength": {
"type": [
"null",
"number"
],
"title": "The minimum length a string type can have",
"default": null
},
"maxLength": {
"type": [
"null",
"number"
],
"title": "The maximum length a string type can have",
"default": null
}
},
"additionalProperties": true
},
"null_types": {
"allOf": [
{
"$ref": "#/definitions/additional_col_properties"
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"pattern": "^null$"
},
"type_category": {
"enum": [
"null"
]
}
}
}
]
},
"int_types": {
"allOf": [
{
"$ref": "#/definitions/additional_col_properties"
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"pattern": "^u?int(8|16|32|64)$"
},
"type_category": {
"enum": [
"integer"
]
}
}
}
]
},
"float_types": {
"allOf": [
{
"$ref": "#/definitions/additional_col_properties"
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"pattern": "^float(16|32|64)$|^decimal128\(\d+,\d+\)$"
},
"type_category": {
"enum": [
"float"
]
}
}
}
]
},
"string_types": {
"allOf": [
{
"$ref": "#/definitions/additional_col_properties"
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"pattern": "^string$|^large_string$|^utf8$|^large_utf8$"
},
"type_category": {
"enum": [
"string"
]
}
}
}
]
},
"timestamp_types": {
"allOf": [
{
"$ref": "#/definitions/additional_col_properties"
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"pattern": "^time32\((s|ms)\)$|^time64\((us|ns)\)$|^date(32|64)$|^timestamp\((s|ms|us|ns)\)$"
},
"type_category": {
"enum": [
"timestamp"
]
}
}
}
]
},
"binary_types": {
"allOf": [
{
"$ref": "#/definitions/additional_col_properties"
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"pattern": "^binary(\([0-9]+\))?$|^large_binary$"
},
"type_category": {
"enum": [
"binary"
]
}
}
}
]
},
"boolean_types": {
"allOf": [
{
"$ref": "#/definitions/additional_col_properties"
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"pattern": "^bool$|^bool_$"
},
"type_category": {
"enum": [
"boolean"
]
}
}
}
]
},
"list_types": {
"allOf": [
{
"$ref": "#/definitions/additional_col_properties"
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"pattern": "^large_list<.+>$|^list_<.+>$|^list<.+>$"
},
"type_category": {
"enum": [
"list"
]
}
}
}
]
},
"struct_types": {
"allOf": [
{
"$ref": "#/definitions/additional_col_properties"
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"pattern": "^map_<.+>$|^struct<.+>$"
},
"type_category": {
"enum": [
"struct"
]
}
}
}
]
}
},
"type": "object",
"title": "Metadata",
"description": "MoJ Data Catalogue Metadata",
"required": [
"name",
"columns"
],
"properties": {
"name": {
"type": "string",
"title": "The name of the table in the database"
},
"description": {
"type": "string",
"title": "A description of what this table contains"
},
"file_format": {
"type": "string",
"title": "The format the data is stored in"
},
"sensitive": {
"type": "boolean",
"title": "Specifies whether the table contains any sensitive data",
"default": false
},
"primary_key": {
"type": "array",
"uniqueItems": true,
"items": {
"type": "string"
},
"title": "Columns that form the primary key of the table",
"default": []
},
"partitions": {
"type": "array",
"uniqueItems": true,
"items": {
"type": "string"
},
"title": "Columns used to partition the table",
"default": []
},
"database_name": {
"type": "string",
"title": "Name of the database the table belongs to."
},
"table_location": {
"type": "string",
"title": "Path to your data can be a folder path, filepath or URL."
},
"columns": {
"type": "array",
"title": "The columns in the table. An array of objects",
"items": {
"oneOf": [
{
"$ref": "#/definitions/null_types"
},
{
"$ref": "#/definitions/int_types"
},
{
"$ref": "#/definitions/float_types"
},
{
"$ref": "#/definitions/string_types"
},
{
"$ref": "#/definitions/timestamp_types"
},
{
"$ref": "#/definitions/binary_types"
},
{
"$ref": "#/definitions/boolean_types"
},
{
"$ref": "#/definitions/list_types"
},
{
"$ref": "#/definitions/struct_types"
}
]
}
}
},
"additionalProperties": true
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant