Skip to content

Latest commit

 

History

History
82 lines (65 loc) · 2.1 KB

README.md

File metadata and controls

82 lines (65 loc) · 2.1 KB

Zally Server

This is Zally server: it implements all rule checks and offers an API to request an API check.

Installation

  1. Clone Zally repository

    git clone [email protected]:zalando-incubator/zally.git zally
  2. Switch to server folder:

    cd zally/server
  3. Build the server:

    ./gradlew clean build
  4. Run Zally server using:

    ./gradlew bootRun

    The bootRun task is configured to run with 'dev' profile by default.

Usage

We recommend to use Zally's CLI tool. Otherwise you can use any other tool to issue an HTTP request, see below for details.

  1. Generate OAuth2 token if needed

  2. 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"
      }
  3. 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