OpenAPI 3 for lazy people.
paths: /foo: 1
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
Because sometimes you need to write an OpenAPI spec.
- 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.
See the tests.
// Install loas3 yarn add loas3 // Convert a lazy specification into OpenAPI yarn loas3 /path/to/lazy-spec.yaml
// Install loas3 npm i loas3 // Convert a lazy specification into OpenAPI npx loas3 /path/to/lazy-spec.yaml
Install dependencies and run tests:
Run the CLI
yarn cli /path/to/lazy-spec.yml