This is Zally server: it implements all rule checks and offers an API to request an API check.
-
Clone Zally repository
git clone [email protected]:zalando-incubator/zally.git zally
-
Switch to
server
folder:cd zally/server
-
Build the server:
./gradlew clean build
-
Run Zally server using:
./gradlew bootRun
The bootRun task is configured to run with 'dev' profile by default.
We recommend to use Zally's CLI tool. Otherwise you can use any other tool to issue an HTTP request, see below for details.
-
Generate OAuth2 token if needed
-
Prepare request body in
test.json
file:-
You can either wrap the existing Swagger file inside
api_definition
JSON object:{ "api_definition": { "swagger": "2.0", "info": { "version": "1.0.0", "title": "Swagger Petstore", "description": "A sample API that uses a petstore as an example to demonstrate features in the swagger-2.0 specification", "termsOfService": "http://swagger.io/terms/", "contact": { "name": "Swagger API Team" }, "license": { "name": "MIT" } } } }
-
Or send an existing Swagger definition URL:
{ "api_definition_url": "https://raw.githubusercontent.com/zalando-incubator/zally/master/server/src/test/resources/fixtures/api_spp.json" }
-
-
Run
curl
agains the API:curl -X POST \ -H "Authorization: Bearer OAUTH2_TOKEN" \ -H "Content-Type: application/json" \ --data "@test.json" \ localhost:8080/api-violations
The 'downloadSwaggerSchema' task can be used to update Swagger schema in project resources (/src/main/resources/schemas):
./gradlew downloadSwaggerSchema