openapi-schema-retriever
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

Openapi Schema Retriever

Typescript package to get an OpenApi-specification-compliant dereferenced object from an object or an json, yaml or yml file path string. For 3.1.x and 3.0.x OpenAPI versions.

Installation

npm install openapi-schema-retriever 

or

yarn add openapi-schema-retriever

Usage

import schemaRetriever from 'openapi-schema-retriever'

const main = async () => {

    /* schemaRetriever  gets, checks and parses the openapi specification that can be an object or an file path string.
     * If the specification input is a file path string, a second argument standing for the current working directory is mandatory.
     * We recommend to use '__dirname' as second argument.
     * The file must be either a json, a yaml or a yml file. 
     * schemaRetriever returns an dereferenced object in accordance with OpenAPI scpecification.
    */
    const schema = await schemaRetriever('./openapi.yaml', __dirname)

    console.log(schema) /* => {
                                openapi: '3.1.0'
                                ...............
                              }
                        */
}

main()

License

This package is licensed under the MIT License.

Contact

If you have any questions or issues, please contact the package maintainer at ekoulemaneng@gmail.com.

Package Sidebar

Install

npm i openapi-schema-retriever

Weekly Downloads

0

Version

1.0.1

License

MIT

Unpacked Size

7.64 kB

Total Files

5

Last publish

Collaborators

  • ekoulemaneng