Skip to content

Contributing

Alexis Luengas edited this page Nov 15, 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

This list is non-exhaustive:

  • 📁 src/ — source files.

  • 📁 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.

    • 📁 schemas/ — OpenAPI documents used in tests * 📁 *test-requests/ and test-responses/ — contains test data covering requests/responses relative to files from schemas/. Tests in 02.integration.test.ts will use this data.

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

  • 📁 types/ — custom TypeScript types * 📁 docs/ — documentation resources.

Writing tests

See the guide found in Tests.

Clone this wiki locally