Commit 8ef715db authored by Giuseppe Tropea's avatar Giuseppe Tropea
Browse files

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

Fix spec

See merge request NGSI-LD/NGSI-LD!7
parents 5a9b241b 18e91b13
Loading
Loading
Loading
Loading
Loading
+19 −14
Original line number Diff line number Diff line
# 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
+20 −1
Original line number Diff line number Diff line
@@ -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).
+0 −3052

File deleted.

Preview size limit exceeded, changes collapsed.

+0 −3052

File deleted.

Preview size limit exceeded, changes collapsed.

docker/Dockerfile

0 → 100644
+2 −0
Original line number Diff line number Diff line
FROM halverneus/static-file-server
ADD . /web
 No newline at end of file
Loading