Skip to content
OpenAPI 3 for lazy people
TypeScript JavaScript
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci
src
test
.gitignore
.npmignore
.prettierrc.yaml
README.md
jest.config.js
package.json
tsconfig.json
yarn.lock

README.md

CircleCI

loas3

OpenAPI 3 for lazy people.

tl;dr

This:

paths:
  /foo: 1

becomes:

openapi: 3.0.0
info:
  name: lazy
  version: 0.0.0
paths:
  /foo:
    get:
      responses:
        default:
          description: too lazy
          content:
            application-json:
              schema:
                type: integer
                format: int64
                default: 1

Why

Because sometimes you need to write an OpenAPI spec.

TODO

  • Better (lazy) types.
  • More examples.

How does it work?

Lazy JSON schema is defined in src/schema/lazy.ts. These, along with the "un"-lazy types from the JSON schema for the official OpenAPI 3.0 Specification are translated into TypeScript types and validators. The lazy OAS3 is expanded into full OAS 3 based on various sensible conventions.

Examples

See the tests.

Command-line usage

yarn

// Install loas3
yarn add loas3

// Convert a lazy specification into OpenAPI
yarn loas3 /path/to/lazy-spec.yaml

npx

// Install loas3
npm i loas3

// Convert a lazy specification into OpenAPI
npx loas3 /path/to/lazy-spec.yaml

Development

Install dependencies and run tests:

yarn

Run the CLI

yarn cli /path/to/lazy-spec.yml
You can’t perform that action at this time.