0.1.4 • Published 5 years ago

loas3 v0.1.4

Weekly downloads
650
License
MIT
Repository
github
Last release
5 years ago

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

ACHTUNG!

There is one important difference between our flavor of OpenAPI and the real OpenAPI spec. Here, items can be either a Schema or an array of schemas.

0.1.4

5 years ago

0.1.2

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago

0.0.0

5 years ago