JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 28
  • Score
    100M100P100Q41810F
  • License MIT

A TS library to manage large API projects defined by OpenAPIv3 specification.

Package Exports

  • openapi-graph-core

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (openapi-graph-core) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

OpenAPI-graph-core

A TS library to manage large API projects defined by OpenAPIv3 specification.

Installation

Just run

npm install openapi-graph-core

and you are good to go.

CLI

This README.md is only for the API of this library. You can check the cli to run it in the console here

API

OpenAPI-graph provide two major classes that are accesible called: OpenAPIGraphs and Analyzer.

OpenAPIGraphs

This class will create the graphs of the APIs. You can provide a root path, which will be used to look for the API specifications. For example, a valid root path if we use one of the examples would be:

const OpenAPIGrahCore = require('openapi-graph-core');

(async () => {
    const graphs = await new OpenAPIGrahCore.OpenAPIGraphs('./tests/resources/social-network').build()

    /* It will return 
    
    {
        "social-network.yaml": { Omitting graph ... },
        "./posts/posts.yaml": { Omitting graph ... },
        "./users/users.yaml": { Omitting graph ... },
    }
    */
})();

Analyzer

It will analyze the graphs checking different conditions. You can initiazlie as follows (you need to initialize OpenAPIGrahps):

const OpenAPIGrahCore = require('openapi-graph-core');

(async () => {
    const graphs = await new OpenAPIGrahCore.OpenAPIGraphs('./tests/resources/social-network').build()
    const analyzer = OpenAPIGrahCore.Analyzer(graphs)
})();

For now, these function have been developed:

Unused schemas

Function Description Returns
getUnusedSchemas() It will check all the schemas declared but not being used in the components.schemas container JSON
getDeprecatedSchemasBeingUsed() It will check all the deprecated schemas declared being in used JSON