1.0.1 • Published 12 months ago

openapi-schema-retriever v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
12 months ago

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.

1.0.1

12 months ago

1.0.0

12 months ago