Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/onmax/openapi-graph-core
A TS library to manage large API projects defined by OpenAPIv3 specification.
https://github.com/onmax/openapi-graph-core
graph-structures openapi3 ts-library
Last synced: 10 days ago
JSON representation
A TS library to manage large API projects defined by OpenAPIv3 specification.
- Host: GitHub
- URL: https://github.com/onmax/openapi-graph-core
- Owner: onmax
- License: mit
- Created: 2021-03-19T11:59:15.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2023-03-05T22:42:32.000Z (almost 2 years ago)
- Last Synced: 2025-01-28T21:16:45.077Z (11 days ago)
- Topics: graph-structures, openapi3, ts-library
- Language: TypeScript
- Homepage:
- Size: 2.37 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
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](https://github.com/onmax/openAPI-graph-cli)
## API
OpenAPI-graph provide two major classes that are accesible called: [`OpenAPIGraphs`](#OpenAPIGraphs) and [`Analyzer`](#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:
```javascript
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`):
```javascript
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](https://github.com/onmax/openapi-graph-types/blob/main/src/model/Analyzer.ts#L6) |
| getDeprecatedSchemasBeingUsed() | It will check all the deprecated schemas declared being in used | [JSON](https://github.com/onmax/openapi-graph-types/blob/main/src/model/Analyzer.ts#L7) |