0.3.0 • Published 5 years ago

@throskam/oas-impl v0.3.0

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

OpenAPI Specification Implementation

An OpenAPI v3 specification implementation.

Features

  • Request and Response validation (based on ajv)
  • Request and Response coersion (type casting and defaults setting)
  • Response generation (customizable)

Dependencies

Installation

npm install @throskam/oas-impl

Usage

import oas from 'oas-impl'

/** Create a request dispatcher for the given openapi v3 specifcation. */
const dispatch = oas(document, option)

/**
 * Dispatch the request and get the corresponding route object containing
 * contextual information and dedicated utility methods.
 * See documentation for more details.
 */
const route = dispatch(method, path)

Documentation

See DOC.md

Contributing

See CONTRIBUTING.md

Roadmap

  • feature validator: security (apiKey, http, oauth2 and openIdConnect)
  • feature coercer: parameter style
  • feature coercer: parameter explode
  • feature coercer: content mediaType (JSON.parse, form, text, ...)
  • feature coercer: content encoding
  • feature coercer: response links
  • feature validator: response links
  • feature generator: response links
  • feature validator: parameter query allowReserved
  • feature validator: discrimator
  • feature validator: deprecated
  • feature generator: random
  • feature coercer: async
  • feature generator: async
  • feature validator: async