Commit 26ef6680 authored by Ignacio Dominguez Martinez-Casanueva's avatar Ignacio Dominguez Martinez-Casanueva
Browse files

[WIP] 1.6.1 API

 - Entity API
 - Subscription API
 - CsourceRegistration API
 - CsourceSubscription API
 - entityOperations API
 - temporal API
 - JSON-LD Context API
parent b5eb2435
Loading
Loading
Loading
Loading

.gitlab-ci.yml

deleted100644 → 0
+0 −29
Original line number Original line Diff line number Diff line

before_script:
  - 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 ${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

CONTRIBUTE.md

deleted100644 → 0
+0 −26
Original line number Original line Diff line number Diff line
# CONTRIBUTE

## Install app
```
$ yarn
```

## Test

### Test all scripts
```
$ yarn test
```

### Test scripts individually
```
$ yarn validate-examples
$ yarn validate-locally
$ yarn validate-online
$ yarn validate-schema
```

### Bundle ngsi-ld-spec-open-api.json
```
$ yarn combine-files
```
 No newline at end of file
+9 −37
Original line number Original line Diff line number Diff line
# NGSI-LD OpenAPIs
# NGSI-LD OpenAPIs


This repository contains OpenAPI descriptions for the NGSI-LD interface defined by ETSI ISG CIM.
This repository contains OpenAPI descriptions for the NGSI-LD interface specified by ETSI ISG CIM 009.


## Online resources
## Online Resources


* [Navigate the API in the browser](https://forge.etsi.org/swagger/ui/?url=https://forge.etsi.org/rep/NGSI-LD/NGSI-LD/raw/master/spec/updated/generated/full_api.json).
* [Specification Document](https://www.etsi.org/deliver/etsi_gs/CIM/001_099/009/01.06.01_60/gs_CIM009v010601p.pdf)
## Navigate with Swagger UI
* [NGSI-LD API](https://forge.etsi.org/swagger/ui/?url=https://forge.etsi.org/rep/NGSI-LD/NGSI-LD/-/raw/1.6.1/ngsi-ld-api.yaml)


## Contribute
## Navigate with redocly
* [NGSI-LD API](https://redocly.github.io/redoc/?url=https://forge.etsi.org/rep/NGSI-LD/NGSI-LD/-/raw/1.6.1/ngsi-ld-api.yaml)


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).
## License


More info @ [CONTRIBUTE](./CONTRIBUTE.md)
The content of this repository and the files contained are released under the BSD-3-Clause license. See the attached LICENSE file or visit https://forge.etsi.org/legal-matters.

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).

Find the currently open issues [here](https://forge.etsi.org/bugzilla/buglist.cgi?component=NGSI%20OpenAPIs%20general&list_id=193&product=NGSI-LD&resolution=---).

## Contact information

Email at `cti_support` at `etsi` dot `org`.
+0 −42
Original line number Original line Diff line number Diff line
POST


/v2/csources

{
   "source": {
      "name": "My Context Source",
      "description": "Context source example 1",
      "endPoint": "http://broker.example.org/v2/entities",
      "scope": {
         "georel": "within",
         "geometry": {
            "type": "Polygon",
            "coordinates": [
               [
                   [-10.0, -10.0],
                   [10.0, -10.0],
                   [10.0, 10.0],
                   [-10.0, -10.0]
               ]
           ]
         }
      }
   },
   
   "dataProvided": {
      "entities": [{
         'id',
         'type',
         'typePattern'
         'idPattern'
      }],
      "properties": [
        "width"
      ]
   },
   
   "expires": ""
}

Properties cannot be empty array. 
 No newline at end of file
+0 −152
Original line number Original line Diff line number Diff line
{
    "definitions": {
        "CsourceRegistrationParams": {
            "allOf": [
                {
                    "type": "object",
                    "properties": {
                        "timestamp": {
                            "type": "array",
                            "minItems": 1,
                            "items": {
                                "$ref": "ngsild_schema.json#/definitions/TimeInterval"
                            }
                        },
                        "location": {
                            "$ref": "http://json.schemastore.org/geojson#/definitions/geometry"
                        },
                        "expires": {
                            "type": "string",
                            "format": "date-time"
                        },
                        "name": {
                            "type": "string",
                            "minLength": 1
                        },
                        "description": {
                            "type": "string",
                            "minLength": 1
                        }
                    }
                },
                {
                    "$ref": "ngsild_schema.json#/definitions/AtContext"
                }
            ]
        },
        "CsourceRegistrationMandatoryParams": {
            "type": "object",
            "required": [
                "endpoint",
                "type",
                "information"
            ],
            "properties": {
                "endpoint": {
                    "type": "string",
                    "format": "uri"
                },
                "type": {
                    "type": "string",
                    "enum": [
                        "ContextSourceRegistration"
                    ]
                },
                "information": {
                    "type": "array",
                    "minItems": 1,
                    "items": {
                        "$ref": "ngsild_schema.json#/definitions/RegistrationInfo"
                    }
                }
            }
        },
        "CsourceRegistration": {
            "allOf": [
                {
                    "type": "object",
                    "required": [
                        "id"
                    ],
                    "properties": {
                        "id": {
                            "type": "string",
                            "format": "uri"
                        }
                    }
                },
                {
                    "$ref": "ngsild_schema.json#/definitions/CommonMembers"
                },
                {
                    "$ref": "#/definitions/CsourceRegistrationParams"
                },
                {
                    "$ref": "#/definitions/CsourceRegistrationMandatoryParams"
                }
            ]
        },
        "CsourceRegistrationDescription": {
            "allOf": [
                {
                    "type": "object",
                    "properties": {
                        "id": {
                            "type": "string",
                            "format": "uri"
                        }
                    }
                },
                {
                    "$ref": "#/definitions/CsourceRegistrationParams"
                },
                {
                    "$ref": "#/definitions/CsourceRegistrationMandatoryParams"
                }
            ]
        },
        "CsourceRegistrationFragment": {
            "allOf": [
                {
                    "type": "object",
                    "required": [
                        "id"
                    ],
                    "properties": {
                        "id": {
                            "type": "string",
                            "format": "uri"
                        },
                        "endpoint": {
                            "type": "string",
                            "format": "uri"
                        },
                        "type": {
                            "type": "string",
                            "enum": [
                                "ContextSourceRegistration"
                            ]
                        },
                        "information": {
                            "type": "array",
                            "minItems": 1,
                            "items": {
                                "$ref": "ngsild_schema.json#/definitions/RegistrationInfo"
                            }
                        }
                    }
                },
                {
                    "$ref": "#/definitions/CsourceRegistrationParams"
                }
            ]
        },
        "CsourceRegistrationList": {
            "type": "array",
            "items": {
                "$ref": "#/definitions/CsourceRegistration"
            }
        }
    }
}
Loading