Commit 8ef715db authored by tropea's avatar tropea
Browse files

Merge branch 'fix-spec' from Stefan into 'master', makes the OpenAPI spec usable again

Fix spec

See merge request !7
parents 5a9b241b 18e91b13
Pipeline #6376 passed with stages
in 7 seconds
# This file is a template, and might need editing before it works on your project.
# Official framework image. Look for the different tagged releases at:
# https://hub.docker.com/r/library/node/tags/
image: node::13.7-alpine
# This folder is cached between builds
# http://docs.rep.com/ce/ci/yaml/README.html#cache
cache:
paths:
- node_modules/
before_script:
- yarn
- docker info
stages:
- prepare
- test
build:
stage: prepare
image: docker:19.03.12
script:
- scripts/setBasePath.sh https://forge.etsi.org/rep/NGSI-LD/NGSI-LD/raw/master http://localhost:8080
- docker build -t ngsi-local -f docker/Dockerfile .
allow_failure: false
test:
stage: test
image: docker:19.03.12
services:
- ngsi-local
script:
- echo "Running tests..."
- yarn test
allow_failure: true
- echo ${TEST}
- scripts/setBasePath.sh https://forge.etsi.org/rep/NGSI-LD/NGSI-LD/raw/master http://localhost:9090
- docker run --network host -i -v ${PWD}/:/data wistefan/redocly-openapi-cli bundle /data/spec/updated/ngsi-ld-spec-open-api.json -o /data/spec/updated/generated/full_api.json
- docker run --network host --rm -v ${PWD}/:/local openapitools/openapi-generator-cli validate -i /local/spec/updated/generated/full_api.json
allow_failure: false
# TODO: after gitlab update, the ci should publish the bundled api
......@@ -10,10 +10,29 @@ This repository contains OpenAPI descriptions for the NGSI-LD interface defined
To get an account on ETSI Forge and to learn how to contribute visit the [Forge Getting started wiki](https://forge.etsi.org/wiki/index.php/Get_started).
More info @ [CONTIBUTE](./CONTRIBUTE.md)
More info @ [CONTRIBUTE](./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 wistefan/redocly-openapi-cli bundle /data/spec/updated/ngsi-ld-spec-open-api.json -o /data/spec/updated/generated/full_api.json
```
And validate it with:
```
docker run --network host --rm -v ${PWD}/:/local openapitools/openapi-generator-cli validate -i /local/spec/updated/generated/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).
......
This diff is collapsed.
This diff is collapsed.
FROM halverneus/static-file-server
ADD . /web
\ No newline at end of file
{
"name": "ngsi-ld",
"version": "1.0.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"ajv": {
"version": "6.5.5",
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.5.5.tgz",
"integrity": "sha512-7q7gtRQDJSyuEHjuVgHoUa2VuemFiCMrfQc9Tc08XTAc4Zj/5U1buQJ0HU6i7fKjXU09SVgSmxa4sLvuvS8Iyg==",
"requires": {
"fast-deep-equal": "^2.0.1",
"fast-json-stable-stringify": "^2.0.0",
"json-schema-traverse": "^0.4.1",
"uri-js": "^4.2.2"
}
},
"fast-deep-equal": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz",
"integrity": "sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk="
},
"fast-json-stable-stringify": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz",
"integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I="
},
"json-schema-traverse": {
"version": "0.4.1",
"resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz",
"integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg=="
},
"punycode": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz",
"integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A=="
},
"uri-js": {
"version": "4.2.2",
"resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz",
"integrity": "sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==",
"requires": {
"punycode": "^2.1.0"
}
}
}
}
{
"name": "ngsi-ld",
"version": "1.0.1",
"description": "NGSI-LD Schema Compilation",
"main": "index.js",
"scripts": {
"test": "./scripts/validate_all.sh",
"validate-examples": "./scripts/validate_examples.sh",
"validate-locally": "./scripts/validate_locally.sh",
"validate-online": "./scripts/validate_online.sh",
"validate-schema": "./scripts/validate_schema.sh",
"combine-files": "./scripts/combine_files.sh"
},
"repository": {
"type": "git",
"url": "https://forge.etsi.org/rep/NGSI-LD/NGSI-LD"
},
"keywords": [
"NGSI-LD"
],
"author": "Jose Manuel Cantera",
"license": "ISC",
"dependencies": {
"ajv": "^6.12.5",
"swagger-cli": "^4.0.4"
}
}
{
"$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"
}
}
{
"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"
],
"allOf": [
{
"$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",
"enum": [
"Point"
]
},
"coordinates": {
"$ref": "#/definitions/position"
}
}
},
"MultiPoint": {
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"MultiPoint"
]
},
"coordinates": {
"$ref": "#/definitions/positionArray"
}
}
},
"Polygon": {
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"Polygon"
]
},
"coordinates": {
"$ref": "#/definitions/polygon"
}
}
},
"LineString": {
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"LineString"
]
},
"coordinates": {
"$ref": "#/definitions/lineString"
}
}
},
"MultiLineString": {
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"MultiLineString"
]
},
"coordinates": {
"type": "array",
"items": {
"$ref": "#/definitions/lineString"
}
}
}
},
"MultiPolygon": {
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"MultiPolygon"
]
},
"coordinates": {
"type": "array",
"items": {
"$ref": "#/definitions/polygon"
}
}
}
},
"Geometry": {
"description": " Avalid GeoJSON geometry object",
"oneOf": [
{
"$ref": "#/definitions/Point"
},
{
"$ref": "#/definitions/MultiPoint"
},
{
"$ref": "#/definitions/Polygon"
},
{
"$ref": "#/definitions/LineString"
},
{
"$ref": "#/definitions/MultiLineString"
},
{
"$ref": "#/definitions/MultiPolygon"
}
]
}
}
}
\ 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
{
"$schema": "http://json-schema.org/draft-04/schema#",