A micro-service to validate SpaceAPI data
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.circleci
validator
.gitignore
.gitmodules
Dockerfile
LICENSE-APACHE
LICENSE-MIT
Pipfile
Pipfile.lock
README.md

README.md

Validation server for SpaceAPI endpoints

Written in Python 3 with Bottle.

https://validator.spaceapi.io/v1/

CircleCI Docker Image

Dev setup

Dependencies

Install Python 3 and pipenv.

Then:

pipenv install --dev

Enable env:

pipenv shell

(Or prefix every Python command with pipenv run.)

Starting the Server

Start the server:

cd validator
python server.py

Testing

To run tests:

cd validator
py.test -v

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.