Commit 530e7042 authored by Stefan Wiedemann's avatar Stefan Wiedemann
Browse files

update api

add tools for local dev
parent b4d17d35
......@@ -14,6 +14,24 @@ More info @ [CONTIBUTE](./CONTRIBUTE.md)
Change requests are managed using [Gerrit](https://forge.etsi.org/gerrit).
### Local editing
>:warning: The described setup requires [docker](https://docs.docker.com/engine/install/) to be installed.
In order to edit the api locally, the script [runLocalDevEnv.sh](scripts/runLocalDevEnv.sh) can be used. When executed from the root of this repository,
it replaces all paths to the master branch inside [spec](spec) and [schema](schema) and serves them through a local file-server. Without that, all
references are resolved with 'https://forge.etsi.org/rep/NGSI-LD/NGSI-LD/raw/master' and therefore changes will not be present locally.
With the local file-server still running, you can build the bundled api via:
```
docker run --network host -it -v ${PWD}/:/data broothie/redoc-cli bundle spec/updated/ngsi-ld-spec-open-api.json -o spec/updated/full_api.json
```
And validate it with:
```
docker run --network host --rm -v ${PWD}/:/local openapitools/openapi-generator-cli validate -i /local/spec/updated/full_api.json
```
When editing is finished, hit the enter button on your local dev env and push.
## Report issues
To report issues, bugs or requests please fill in a bug [at this location](https://forge.etsi.org/bugzilla/enter_bug.cgi?product=NGSI-LD).
......
{
"$schema": "http://json-schema.org/schema#",
"$id": "https://forge.etsi.org/rep/NGSI-LD/NGSI-LD/raw/master/schema/BatchOperationResult.json",
"title": "NGSI-LD Batch Operation Result",
"description": "NGSI-LD Batch Operation Result",
"definitions": {
"BatchEntityError": {
"entityId": {
"type": "string",
"format": "uri"
},
"error": {
"$ref": "https://forge.etsi.org/rep/NGSI-LD/NGSI-LD/raw/master/schema/common.json#/definitions/ProblemDetails"
"type": "object",
"properties": {
"entityId": {
"type": "string",
"format": "uri"
},
"error": {
"$ref": "https://forge.etsi.org/rep/NGSI-LD/NGSI-LD/raw/master/schema/common.json#/definitions/ProblemDetails"
}
}
},
"BatchOperationResult": {
......@@ -37,4 +38,4 @@
"$ref": "#/definitions/BatchOperationResult"
}
]
}
}
\ No newline at end of file
{
"$schema": "http://json-schema.org/schema#",
"$id": "https://forge.etsi.org/rep/NGSI-LD/NGSI-LD/raw/master/schema/Entity.json",
"title": "NGSI-LD Entity",
"description": "NGSI-LD Entity",
"definitions": {
......@@ -17,10 +15,10 @@
"properties": {
"type": {
"type": "string",
"const": "Property"
"enum": ["Property"]
},
"value": {
"type": [
"oneOf": [
"string",
"number",
"boolean",
......@@ -49,7 +47,7 @@
"value"
],
"additionalProperties": {
"anyOf": [
"oneOf": [
{
"$ref": "#/definitions/Property"
},
......@@ -64,7 +62,7 @@
"properties": {
"type": {
"type": "string",
"const": "Relationship"
"enum": ["Relationship"]
},
"object": {
"type": "string",
......@@ -91,7 +89,7 @@
"object"
],
"additionalProperties": {
"anyOf": [
"oneOf": [
{
"$ref": "#/definitions/Property"
},
......@@ -106,10 +104,10 @@
"properties": {
"type": {
"type": "string",
"const": "GeoProperty"
"enum": ["GeoProperty"]
},
"value": {
"$ref": "https://forge.etsi.org/rep/NGSI-LD/NGSI-LD/raw/master/schema/geometry-schema.json#"
"$ref": "https://forge.etsi.org/rep/NGSI-LD/NGSI-LD/raw/master/schema/Geometry.json#/definitions/Geometry"
},
"observedAt": {
"$ref": "https://forge.etsi.org/rep/NGSI-LD/NGSI-LD/raw/master/schema/common.json#/definitions/observedAt"
......@@ -132,7 +130,7 @@
"value"
],
"additionalProperties": {
"anyOf": [
"oneOf": [
{
"$ref": "#/definitions/Property"
},
......@@ -172,7 +170,7 @@
}
},
"additionalProperties": {
"anyOf": [
"oneOf": [
{
"$ref": "#/definitions/Property"
},
......@@ -183,9 +181,6 @@
"$ref": "#/definitions/GeoProperty"
}
]
},
"propertyNames": {
"$ref": "https://forge.etsi.org/rep/NGSI-LD/NGSI-LD/raw/master/schema/common.json#/definitions/PropertyNames"
}
},
"Entity": {
......
{
"$schema": "http://json-schema.org/schema#",
"$id": "https://forge.etsi.org/rep/NGSI-LD/NGSI-LD/raw/master/schema/EntityList.json",
"title": "NGSI-LD EntityList",
"description": "NGSI-LD EntityList",
"definitions": {
......@@ -11,7 +9,9 @@
}
}
},
"allOf": [{
"$ref": "#/definitions/EntityList"
}]
}
"allOf": [
{
"$ref": "#/definitions/EntityList"
}
]
}
\ No newline at end of file
{
"$schema": "http://json-schema.org/schema#",
"$id": "https://forge.etsi.org/rep/NGSI-LD/NGSI-LD/raw/master/schema/Entity_keyValues.json",
"title": "NGSI-LD Entity Key Values",
"description": "NGSI-LD Entity Simplified Representation",
"type": "object",
"properties": {
"id": {
"type": "string",
"format": "uri"
},
"type": {
"$ref": "https://forge.etsi.org/rep/NGSI-LD/NGSI-LD/raw/master/schema/common.json#/definitions/Name"
},
"@context": {
"$ref": "https://forge.etsi.org/rep/NGSI-LD/NGSI-LD/raw/master/schema/common.json#/definitions/LdContext"
},
"location": {
"$ref": "https://forge.etsi.org/rep/NGSI-LD/NGSI-LD/raw/master/schema/geometry-schema.json#"
},
"observationSpace": {
"$ref": "https://forge.etsi.org/rep/NGSI-LD/NGSI-LD/raw/master/schema/geometry-schema.json#"
},
"operationSpace": {
"$ref": "https://forge.etsi.org/rep/NGSI-LD/NGSI-LD/raw/master/schema/geometry-schema.json#"
},
"createdAt": {
"$ref": "https://forge.etsi.org/rep/NGSI-LD/NGSI-LD/raw/master/schema/common.json#/definitions/createdAt"
},
"modifiedAt": {
"$ref": "https://forge.etsi.org/rep/NGSI-LD/NGSI-LD/raw/master/schema/common.json#/definitions/modifiedAt"
}
},
"required": [
"type",
"id"
],
"additionalProperties": {
"type": [
"string",
"number",
"boolean",
"array",
"object"
]
},
"propertyNames": {
"$ref": "https://forge.etsi.org/rep/NGSI-LD/NGSI-LD/raw/master/schema/common.json#/definitions/PropertyNames"
}
}
{
"$schema": "http://json-schema.org/draft-04/schema#",
"$id": "https://forge.etsi.org/rep/NGSI-LD/NGSI-LD/raw/master/schema/geometry-schema.json",
"title": "geometry",
"title": "Geometry",
"description": "One geometry as defined by GeoJSON. Licensed as per original source is https://github.com/fge/sample-json-schemas/blob/master/geojson/geometry.json",
"type": "object",
"required": [
"type",
"coordinates"
],
"oneOf": [
"allOf": [
{
"title": "Point",
"$ref": "#/definitions/Geometry"
}
],
"definitions": {
"position": {
"description": "A single position",
"type": "array",
"minItems": 2,
"maxItems": 2,
"items": {
"type": "number"
},
"additionalProperties": false
},
"positionArray": {
"description": "An array of positions",
"type": "array",
"items": {
"$ref": "#/definitions/position"
}
},
"lineString": {
"description": "An array of two or more positions",
"allOf": [
{
"$ref": "#/definitions/positionArray"
},
{
"minItems": 2
}
]
},
"linearRing": {
"description": "An array of four positions where the first equals the last",
"allOf": [
{
"$ref": "#/definitions/positionArray"
},
{
"minItems": 4
}
]
},
"polygon": {
"description": "An array of linear rings",
"type": "array",
"items": {
"$ref": "#/definitions/linearRing"
}
},
"Point": {
"type": "object",
"properties": {
"type": {
"type": "string",
......@@ -23,8 +72,8 @@
}
}
},
{
"title": "MultiPoint",
"MultiPoint": {
"type": "object",
"properties": {
"type": {
"type": "string",
......@@ -37,53 +86,53 @@
}
}
},
{
"title": "LineString",
"Polygon": {
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"LineString"
"Polygon"
]
},
"coordinates": {
"$ref": "#/definitions/lineString"
"$ref": "#/definitions/polygon"
}
}
},
{
"title": "MultiLineString",
"LineString": {
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"MultiLineString"
"LineString"
]
},
"coordinates": {
"type": "array",
"items": {
"$ref": "#/definitions/lineString"
}
"$ref": "#/definitions/lineString"
}
}
},
{
"title": "Polygon",
"MultiLineString": {
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"Polygon"
"MultiLineString"
]
},
"coordinates": {
"$ref": "#/definitions/polygon"
"type": "array",
"items": {
"$ref": "#/definitions/lineString"
}
}
}
},
{
"title": "MultiPolygon",
"MultiPolygon": {
"type": "object",
"properties": {
"type": {
"type": "string",
......@@ -98,58 +147,29 @@
}
}
}
}
],
"definitions": {
"position": {
"description": "A single position",
"type": "array",
"minItems": 2,
"items": [
},
"Geometry": {
"description": " Avalid GeoJSON geometry object",
"oneOf": [
{
"type": "number"
"$ref": "#/definitions/Point"
},
{
"type": "number"
}
],
"additionalItems": false
},
"positionArray": {
"description": "An array of positions",
"type": "array",
"items": {
"$ref": "#/definitions/position"
}
},
"lineString": {
"description": "An array of two or more positions",
"allOf": [
"$ref": "#/definitions/MultiPoint"
},
{
"$ref": "#/definitions/positionArray"
"$ref": "#/definitions/Polygon"
},
{
"minItems": 2
}
]
},
"linearRing": {
"description": "An array of four positions where the first equals the last",
"allOf": [
"$ref": "#/definitions/LineString"
},
{
"$ref": "#/definitions/positionArray"
"$ref": "#/definitions/MultiLineString"
},
{
"minItems": 4
"$ref": "#/definitions/MultiPolygon"
}
]
},
"polygon": {
"description": "An array of linear rings",
"type": "array",
"items": {
"$ref": "#/definitions/linearRing"
}
}
}
}
}
\ No newline at end of file
{
"$schema": "http://json-schema.org/schema#",
"$id": "https://forge.etsi.org/rep/NGSI-LD/NGSI-LD/raw/master/schema/UpdateResult.json",
"title": "NGSI-LD Update Result",
"description": "NGSI-LD Update Result",
"definitions": {
"NotUpdatedDetails": {
"attributeName": {
"type": "string",
"pattern": ""
},
"reason": {
"type": "string",
"minLenght": 1
"type": "object",
"properties": {
"attributeName": {
"type": "string",
"pattern": ""
},
"reason": {
"type": "string",
"minLength": 1
}
}
},
"UpdateResult": {
......@@ -38,4 +39,4 @@
"$ref": "#/definitions/UpdateResult"
}
]
}
}
\ No newline at end of file
{
"$schema": "http://json-schema.org/schema#",
"$id": "https://forge.etsi.org/rep/NGSI-LD/NGSI-LD/raw/master/schema/common.json",
"title": "NGSI-LD Common Definitions",
"description": "NGSI-LD Common",
"definitions": {
......@@ -27,7 +25,7 @@
"format": "date-time"
},
"LdContext": {
"anyOf": [
"oneOf": [
{
"type": "object"
},
......@@ -39,7 +37,7 @@
"type": "array",
"minItems": 1,
"items": {
"anyOf": [
"oneOf": [
{
"type": "string",
"format": "uri"
......@@ -109,7 +107,7 @@
]
},
"georel": {
"anyOf": [
"oneOf": [
{
"type": "string",
"enum": [
......@@ -130,16 +128,16 @@
"coordinates": {
"oneOf": [
{
"$ref": "https://forge.etsi.org/rep/NGSI-LD/NGSI-LD/raw/master/schema/geometry-schema.json#/definitions/position"
"$ref": "https://forge.etsi.org/rep/NGSI-LD/NGSI-LD/raw/master/schema/Geometry.json#/definitions/position"
},
{
"$ref": "https://forge.etsi.org/rep/NGSI-LD/NGSI-LD/raw/master/schema/geometry-schema.json#/definitions/positionArray"
"$ref": "https://forge.etsi.org/rep/NGSI-LD/NGSI-LD/raw/master/schema/Geometry.json#/definitions/positionArray"
},
{
"$ref": "https://forge.etsi.org/rep/NGSI-LD/NGSI-LD/raw/master/schema/geometry-schema.json#/definitions/lineString"
"$ref": "https://forge.etsi.org/rep/NGSI-LD/NGSI-LD/raw/master/schema/Geometry.json#/definitions/lineString"
},
{
"$ref": "https://forge.etsi.org/rep/NGSI-LD/NGSI-LD/raw/master/schema/geometry-schema.json#/definitions/polygon"
"$ref": "https://forge.etsi.org/rep/NGSI-LD/NGSI-LD/raw/master/schema/Geometry.json#/definitions/polygon"
}
]
},
......@@ -163,4 +161,4 @@
]
}
}
}
}
\ No newline at end of file
......@@ -6,11 +6,6 @@
"definitions": {
"RegistrationInfo": {
"type": "object",
"anyOf": [
{"required": ["entities"]},
{"required": ["properties"]},
{"required": ["relationships"]}
],
"properties": {
"entities": {
"type": "array",
......@@ -73,13 +68,13 @@
"$ref": "#/definitions/TimeInterval"
},
"location": {
"$ref": "https://forge.etsi.org/rep/NGSI-LD/NGSI-LD/raw/fix-spec/schema/geometry-schema.json#"
"$ref": "https://forge.etsi.org/rep/NGSI-LD/NGSI-LD/raw/master/schema/Geometry.json#/definitions/Geometry"
},
"observationSpace": {
"$ref": "https://forge.etsi.org/rep/NGSI-LD/NGSI-LD/raw/fix-spec/schema/geometry-schema.json#"
"$ref": "https://forge.etsi.org/rep/NGSI-LD/NGSI-LD/raw/master/schema/Geometry.json#/definitions/Geometry"
},
"operationSpace": {
"$ref": "https://forge.etsi.org/rep/NGSI-LD/NGSI-LD/raw/fix-spec/schema/geometry-schema.json#"
"$ref": "https://forge.etsi.org/rep/NGSI-LD/NGSI-LD/raw/master/schema/Geometry.json#/definitions/Geometry"
},
"expires": {
"type": "string",
......@@ -98,15 +93,7 @@
"format": "uri"
}
},
"additionalProperties": {
"type": [
"string",
"number",
"boolean",
"array",
"object"
]
}
"additionalProperties": true
},
"ContextSourceRegistration": {
"allOf": [
......@@ -122,7 +109,7 @@
},
"type": {
"type": "string",
"const": "ContextSourceRegistration"
"enum": ["ContextSourceRegistration"]
},
"createdAt": {
"$ref": "https://forge.etsi.org/rep/NGSI-LD/NGSI-LD/raw/master/schema/common.json#/definitions/createdAt"
......
{
"$schema": "http://json-schema.org/schema#",
"$id": "https://forge.etsi.org/rep/NGSI-LD/NGSI-LD/raw/master/schema/subscriptions/Notification.json",
"title": "NGSI-LD Notification",
"description": "NGSI-LD Notification",
"type": "object",
......@@ -11,7 +9,9 @@
},
"type": {
"type": "string",
"const": "Notification"
"enum": [
"Notification"
]
},
"subscriptionId": {
"type": "string",
......@@ -38,4 +38,4 @@
"notifiedAt",
"data"
]
}
}
\ No newline at end of file
{
"$schema": "http://json-schema.org/schema#",
"$id": "https://forge.etsi.org/rep/NGSI-LD/NGSI-LD/raw/master/schema/subscriptions/Subscription.json",
"title": "NGSI-LD Subscription",
"description": "NGSI-LD Subscription",
"definitions": {
......@@ -138,7 +136,7 @@
},
"type": {