Skip to content


Switch branches/tags


Failed to load latest commit information.
Latest commit message
Commit time

CI CD Lob OpenAPI v3 Specification

What is this project?

We're writing an OpenAPI v3 authored specification for the current Lob API. This repo contains the spec as well as a growing set of tooling for working with OpenAPI v3 specs.


Contributing Guide


Our spec is a multifile spec organized semantically, by resource, instead of syntactically, by OpenAPI element. Organizing the spec semantically reduces cognitive friction, helping developers reason from interaction (endpoints) to data (and process) design. As developers from multiple teams work with the spec, the design surfaces business semantics rather than presenting the canonical wall-o-yaml (or json-schema) that typifies the traditional API spec.

├── lob-api-public.yml            # base file (metadata, tags, servers, ...)
├── resources
│   ├── postcards                 # elements specific to postcards
│   │   ├── postcards.yml         # operations on /postcards
│   │   ├── postcard.yml           # operations on /postcards/{id}
│   │   ├── attributes
│   │   │   └── ...
│   │   ├── models
│   │   │   └── postcard.yml
│   │   └── responses
│   │       ├── postcard.yml
│   │       └── all_postcards.yml
│   └── letters                 # elements specific to letters
│       ├── letters.yml         # operations on /letters
│       ├── letter.yml          # operations on /letters/{id}
│       └── ...
├── shared                        # elements used by multiple resources
│   ├── attributes                # properties not of type `object`
│   ├── headers
│   ├── models                    # properties of type `object`
│   ├── parameters
│   └── responses
├── actions                       # private github actions or resources needed by actions
│   ├── contract_tests
│   └── redoc
├── dist                          # contents created during CD by github actions
└── tests                         # contract tests
    ├── setup.js                  # contract test framework
    ├── addresses_test.js         # tests for addresses resource
    ├── us_verifications.test.js  # tests for us_verifications resource...
    └── ...

OpenAPI Style Guide and linting

Our OpenAPI style guide is an extension of Spectral's OpenAPI ruleset. Spectral's ruleset goes beyond the OpenAPI v3 standard to incorporate a recommended set of best practices.

Spectral runs in CI on push and pull request.


We use Prettier to ensure that all our code follows a consist format for maximum readability. If you have been given the green light to create a PR, you can run prettier as you work via npm run pretty and/or through editor integrations for many major editors.

In addition, a pre-commit githook runs prettier --check . (the same check run in CI).

OAS v3.1 compatibility

On February 15, 2021, the OpenAPI Initiative published OpenAPI v3.1. OAS 3.1 includes many extremely useful changes, including full JSON schema compatibility and the ability to extend discriminators with specification extensions.

We will move to v3.1 as soon as is practical. In the meantime, we're working to minimize the changes we'll need to make.

Previewing changes

If you've changed the css and js, you need to run npm run build to create the uglified js and css files that your local docs will depend on. The new chunks will show up in docs/chunks.

You can then generate documentation for the API from the spec by running npm run redoc, which uses redoc. The generated docs will apppear in docs/index.html. Then you can point your browser to the absolute path of that file to review your local version of the docs.

E2E Testing

You can run the currently available end-to-end tests with the command npm run docsTest.

Bundled spec

A lot of tooling for working with OpenAPI specs does not support the full specification. In particular, many tools do not support multiple file specs. We maintain a single file 'bundled' version of the spec for use with such tools. The bundled version is generated as part of CI/CD, and can be found on github at dist/lob-api-bundled.yml on the deployment branch.

Postman Collection

You can generate a big JSON representing a Postman Collection for this spec locally with npm run postman. The resulting dist/lob-api-postman.json can be imported into Postman so that you can get started on making requests to Lob API. Here's a video tutorial on that.