README.md

June 13, 2024 ยท View on GitHub

X-Program API Documentation

Table of content:

Setup

Install all dependencies. NodeJS >=18.16 is at least required.

npm install

Then we need to fetch the current master of x-program api contracts.

npm run download-contracts

Eventually we can run the build step to generate the documentation HTML files for each contract.

npm run build

More information about what the build script does can be found here.

Usage

Serve Documentation (powered by Stoplight Elements)

You can serve the documentation via:

npm start

This will spin up a serve HTTP server on port 3000. You can adjust the server properties in serve.json

Linting (powered by Stoplight Spectral)

You can lint manually with spectral-cli:

npm run lint

Mocking (powered by Stoplight Prism)

You can run a mock server for a spec file:

npm run mock $path-to-file

e.g. npm run mock contracts/geo address/tmf673-arcgis.yaml

Contract testing (powered by Stoplight Prism)

You can validate a API spec file against an API implementation by:

npm run validate $path-to-file $url-to-implementation

e.g. npm run validate contracts/geo address/tmf673-arcgis.yaml https://tbd.io

Roadmap

  • Linting
  • Mocking server
  • Contract testing against API Implementations
  • Docs generation