Skip to content

Commit

Permalink
feat: clean geocodejson schema
Browse files Browse the repository at this point in the history
Move OSM specific attributes out of GeocodeJSON schema.

Refs: #2
  • Loading branch information
jenkin committed Oct 4, 2023
1 parent a84ecf2 commit bc20470
Show file tree
Hide file tree
Showing 6 changed files with 224 additions and 173 deletions.
2 changes: 1 addition & 1 deletion docs/geocodejson.schema.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/geocodejson.schema.json.checksum
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sha512-c2190a6be0a9e25d046b5ba8ef301b5d534a41125d434351efc837e541e67fa0d8008e733bbad0c7606d8d7b7698415b26f4c0813a676d549d3dd0edbc1ef4c8
sha512-70edfabdacbbe4814c967585e99b58e80dda2dc963c5ab6bad16636acf081fc1c1608f0167930861db49e46a5de7e5b44079508370657873448dd36e0cc4d283
2 changes: 1 addition & 1 deletion docs/nominatim.openapi.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/nominatim.openapi.json.checksum
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sha512-9fcf7a7fbcf1cd54c39baba7cba2cc1a50734a324423c33bbfd0a2e482d13934369bcea3c258fe139d42bdaf6f9f85171c6024ff5c9bc05b46e514a82b7b0f69
sha512-f4188d4f6dd9b122c61691c340c8eb41e48bcc519d0978069e8b1e48fbf179b5cd44945c6aaa7ebc8e5b68aa9bb3f744396371e6baaa582a688fcd27dfb8cd61
330 changes: 165 additions & 165 deletions src/geocodejson.schema.json
Original file line number Diff line number Diff line change
@@ -1,200 +1,200 @@
{
"title": "GeocodeJSON schema",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://sparkfabrik.github.io/nominatim-openapi/geocodejson.schema.json",
"title": "GeocodeJSON Schema",
"description": "GeocodeJSON is an extension of the GeoJSON standard that aim to handle results from geocoding services.",
"type": "object",
"allOf": [
{
"$ref": "https://geojson.org/schema/GeoJSON.json"
}
],
"properties": {
"type": {
"const": "FeatureCollection"
"const": "FeatureCollection",
"description": "REQUIRED. GeocodeJSON result is a FeatureCollection."
},
"geocoding": {
"$ref": "#/$defs/GeocodeJsonMeta"
},
"features": {
"type": "array",
"items": {
"$ref": "#/$defs/GeocodeJsonFeature"
}
}
},
"required": [
"geocoding"
],
"$defs": {
"GeocodeJsonMeta": {
"type": "object",
"description": "REQUIRED. Namespace.",
"properties": {
"version": {
"type": "string",
"pattern": "^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$"
"pattern": "^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$",
"description": "REQUIRED. A semver.org compliant version number. Describes the version of the GeocodeJSON spec that is implemented by this instance.",
"examples": [
"0.1.0",
"1.0.0-beta1",
"2.2.4"
]
},
"licence": {
"type": "string"
},
"attribution": {
"type": "string"
},
"query": {
"type": "string"
}
},
"required": [
"version"
]
},
"GeocodeJsonFeature": {
"type": "object",
"properties": {
"type": {
"const": "Feature"
},
"properties": {
"type": "object",
"properties": {
"geocoding": {
"$ref": "#/$defs/OSMFeatureMeta"
}
},
"required": [
"geocoding"
]
}
}
},
"OSMFeatureMeta": {
"type": "object",
"allOf": [
{
"$ref": "#/$defs/GeocodeJsonFeatureMeta"
}
],
"properties": {
"osm_type": {
"type": "string",
"description": "OPTIONAL. Default: null. The licence of the data. In case of multiple sources, and then multiple licences, can be an object with one key by source.",
"examples": [
"node",
"way",
"relation"
"ODbL"
]
},
"osm_id": {
"type": "integer"
},
"osm_key": {
"attribution": {
"type": "string",
"description": "OPTIONAL. Default: null. The attribution of the data. In case of multiple sources, and then multiple attributions, can be an object with one key by source.",
"examples": [
"boundary",
"highway",
"amenity"
"OpenStreetMap Contributors"
]
},
"osm_value": {
"query": {
"type": "string",
"description": "OPTIONAL. Default: null. The query that has been issued to trigger the search.",
"examples": [
"residential",
"restaurant"
"24 allée de Bercy 75012 Paris"
]
}
}
},
"required": [
"version"
]
},
"GeocodeJsonFeatureMeta": {
"type": "object",
"properties": {
"type": {
"type": "string",
"examples": [
"house",
"street",
"district",
"city",
"county",
"state",
"country",
"locality"
]
},
"accuracy": {
"type": "integer",
"minimum": 0
},
"label": {
"type": "string"
},
"name": {
"type": "string"
},
"housenumber": {
"type": "string"
},
"street": {
"type": "string"
},
"locality": {
"type": "string"
},
"postcode": {
"type": "string"
},
"city": {
"type": "string"
},
"district": {
"type": "string"
},
"county": {
"type": "string"
},
"state": {
"type": "string"
},
"country": {
"type": "string"
},
"admin": {
"type": "object",
"features": {
"type": "array",
"description": "REQUIRED. As per GeoJSON spec.",
"items": {
"type": "object",
"description": "OPTIONAL. An array of feature objects.",
"properties": {
"type": {
"const": "Feature",
"description": "REQUIRED. As per GeoJSON spec."
},
"properties": {
"level2": {
"type": "string"
},
"level3": {
"type": "string"
},
"level4": {
"type": "string"
},
"level5": {
"type": "string"
},
"level6": {
"type": "string"
},
"level7": {
"type": "string"
},
"level8": {
"type": "string"
},
"level9": {
"type": "string"
"type": "object",
"description": "REQUIRED. As per GeoJSON spec.",
"properties": {
"geocoding": {
"type": "object",
"description": "REQUIRED. Namespace.",
"properties": {
"type": {
"type": "string",
"description": "REQUIRED. One of house, street, locality, city, region, country.",
"examples": [
"house",
"street",
"district",
"city",
"county",
"state",
"country",
"locality"
]
},
"accuracy": {
"type": "number",
"minimum": 0,
"description": "OPTIONAL. Result accuracy, in meters.",
"examples": [
20
]
},
"label": {
"type": "string",
"description": "RECOMMENDED. Suggested label for the result.",
"examples": [
"My Shoes Shop, 64 rue de Metz 59280 Armentières"
]
},
"name": {
"type": "string",
"description": "OPTIONAL. Name of the place.",
"examples": [
"My Shoes Shop"
]
},
"housenumber": {
"type": "string",
"description": "OPTIONAL. Housenumber of the place.",
"examples": [
"64"
]
},
"street": {
"type": "string",
"description": "OPTIONAL. Street of the place.",
"examples": [
"Rue de Metz"
]
},
"locality": {
"type": "string",
"description": "OPTIONAL. Locality of the place.",
"examples": [
"Les Clarons"
]
},
"postcode": {
"type": "string",
"description": "OPTIONAL. Postcode of the place.",
"examples": [
"59280"
]
},
"city": {
"type": "string",
"description": "OPTIONAL. City of the place.",
"examples": [
"Armentières"
]
},
"district": {
"type": "string",
"description": "OPTIONAL. District of the place."
},
"county": {
"type": "string",
"description": "OPTIONAL. County of the place."
},
"state": {
"type": "string",
"description": "OPTIONAL. State of the place."
},
"country": {
"type": "string",
"description": "OPTIONAL. Country of the place.",
"examples": [
"France"
]
},
"admin": {
"type": "object",
"description": "OPTIONAL. Administratives boundaries the feature is included in, as defined in http://wiki.osm.org/wiki/Key:admin_level#admin_level.",
"patternProperties": {
"^level[0-9]+": {
"type": "string"
}
}
},
"geohash": {
"type": "string",
"pattern": "^[a-zA-Z0-9]+(:.+)?$",
"description": "OPTIONAL. Geohash encoding of coordinates (see http://geohash.org/site/tips.html).",
"examples": [
"Ehugh5oofiToh9aWe3heemu7ighee8"
]
}
},
"required": [
"type"
]
}
},
"level10": {
"type": "string"
},
"level11": {
"type": "string"
}
"required": [
"geocoding"
]
}
},
"geohash": {
"type": "string",
"pattern": "^[a-zA-Z0-9]+(:.+)?$"
}
},
"required": [
"type"
]
}
}
}
},
"required": [
"geocoding"
]
}
Loading

0 comments on commit bc20470

Please sign in to comment.