Skip to content

Contributing

LexLuengas edited this page Sep 6, 2022 · 7 revisions
Note
This page describes how developers who wish to contribute to openapi-cop can set up the project quickly on their local machine.
Note
Make sure you have also checked the contributing guidelines before you keep on reading.

Setup requirements

  • Git

  • Bash

  • Node.js 10 or 12

  • Docker ≥ 20.10

  • (Optional) nvm

Setup

First, clone the repository

git clone https://github.com/EXXETA/openapi-cop

If you are using NVM, switch to the suggested Node.js version (taken from the .nvmrc file)

nvm use

Install the dependencies

npm install

Project structure

  • 📁 /

    • 📁 docker/ — files related to the publishable Docker image.

    • 📁 mock-server/ — mock target server useful for testing and development.

      The mock will take the example objects from a given OpenAPI document to generate responses. You can feed it with a different OpenAPI document than openapi-cop to test validation of responses.

    • 📁 test/

      • 📄 01.unit.test.ts/ — tests ability to read valid OpenAPI files.

      • 📄 02.integration.test.ts/ — tests validation of requests/responses with different configurations against mock servers.

      • 📁 docker/ — contains a Docker setup in which tests can be run.

      • 📁 schemas/ — OpenAPI documents (valid and invalid) used in tests

      • 📁 test_data/ — contains tests for files in schemas/. These tests are run as part of the integration tests (02.integration.test.ts)

        • 📄 test-requests.ts — contains tests covering requests.

        • 📄 test-target-servers.ts — contains tests covering invalid responses where a validation error is expected. Coverage for valid responses is done during the invariance tests from 02.integration.test.ts.

    • 📁 types — custom TypeScript types

Clone this wiki locally