Basic usage

You send an https request with links to your service and to the openapi specification of your service.

The service then runs a number of tests on your service and returns a test report. The test report describes which test passed or failed or was skipped.

The EDR service is dependent on a functional OpenApi specification. It is suggested the OpenApi specification is validated before testing the EDR service. Use the /openapi testpoint to validate the OpenApi specification only.

Expected behaviour in your service

OpenApi tests

Running the /openapi test with curl curl -X 'GET' \ 'http://edrvalidator.k8s.met.no/validate/openapi?apiDefinition=https://example.com/api/openapi.yaml' \ -H 'accept: text/plain; charset=utf-8'

Support slash at the end of paths

You service must support paths both with and without a / at the end. So for example this validator assumes that your service support the following: /collection? /collection/?

These two paths are assumed to represent the same resource.

Web report

curl -X 'GET' \ 'http://edrvalidator.k8s.met.no/validate/edr?iut=https://example.com&apiDefinition=https://example.com/api/openapi.yaml' \ -H 'accept: application/json'

This will return a json document. In that document there are links to the validation report in several formats. Get the link for the `html-report` and paste it into a browser to view the result.

Gitlab-ci integration

Versioning

At the moment the service is in an alpha stage, so expect breaking changes with no warning.

When the service stabilises we will handle major changes to the service by versioning the url path.

We will also update the changelog.

Run locally in docker

start the service

Start the EDR validator service in docker: docker run -ti --rm --name edrvalidator --network host -p 8000:8000 registry.met.no/team-punkt/edr/edrvalidator:v0.0.10

In the web browser

http://edrvalidator.k8s.met.no

Test with curl

Run the openapi testes

curl -X 'GET' \ 'http://edrvalidator.k8s.met.no/validate/openapi?apiDefinition=https://example.com/api/openapi.yaml' \ -H 'accept: text/plain; charset=utf-8'

Run the EDR testes

curl -X 'GET' \ 'http://edrvalidator.k8s.met.no/validate/edr?iut==https://example.com&apiDefinition=https://example.com/api/openapi.yaml' \ -H 'accept: text/plain; charset=utf-8'

Error handling

We use regular 4xx and 5xx http status codes, as close as possible to the HTTP specification. Some errors will have a message of what went wrong in it. Some errors will respons with json. Do not encode those json error responses, as they might change without proper versioning as described above.

Examples