/validator

A micro-service to validate SpaceAPI data

Primary LanguageGoApache License 2.0Apache-2.0

Validation server for SpaceAPI endpoints

https://validator.spaceapi.io/v2/

CircleCI Docker Image

Dev setup

Dependencies

Install golang

Then:

go get -d  ./...
go generate
go install  ./...

Starting the Server

Start the server:

validator

Testing

To run tests:

go test ./...

API

Request

To send a validation request, send a POST request to /v1/validate/ with Content-Type: application/json. The payload (in JSON format) should look like this:

{
    "data": "..."
}

The data field should contain the SpaceAPI endpoint data as a JSON string.

Example (curl):

curl \
    -X POST \
    -H "Content-Type: application/json" \
    https://validator.spaceapi.io/v1/validate/ \
    -d'{"data": "{\"api\": \"0.13\"}"}'

Example (httpie):

http POST \
    https://validator.spaceapi.io/v1/validate/ \
    data='{"api": "0.13"}'

Response

If the request is not malformed, the endpoint returns a HTTP 200 response with Content-Type: application/json.

The success response looks like this:

{
    "valid": true,
    "message": null
}

The error response looks like this:

{
    "valid": false,
    "message": "Error details"
}

It is planned that more error details (like row/col) will be added in the future.

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.