@kevinoid/openapi-transformer-pipeline
v1.0.0
Published
Transform OpenAPI documents by applying multiple OpenApiTransforer instances.
Downloads
62
Maintainers
Readme
OpenApiTransformerPipeline
Class for traversing or transforming
OpenAPI documents by applying
transformers with a transformOpenApi
method which takes an input OpenAPI
document and returns the output document, optionally in a Promise
.
Transformers may be implemented using
OpenApiTransformerBase
,
but it is not required.
Introductory Example
To create a transformer which removes response headers, then converts
patternProperties
to additionalProperties
:
import OpenApiTransformerPipeline
from '@kevinoid/openapi-transformer-pipeline';
import RemoveResponseHeadersTransformer
from '@kevinoid/openapi-transformers/remove-response-headers.js';
import PatternPropertiesToAdditionalPropertiesTransformer
from '@kevinoid/openapi-transformers/pattern-properties-to-additional-properties.js';
export default class MyTransformer extends OpenApiTransformerPipeline {
constructor() {
super([
new RemoveResponseHeadersTransformer(),
new PatternPropertiesToAdditionalPropertiesTransformer(),
]);
}
}
Installation
This package can be installed using npm, either globally or locally, by running:
npm install @kevinoid/openapi-transformer-pipeline
API Docs
To use this module as a library, see the API Documentation.
Contributing
Contributions are appreciated. Contributors agree to abide by the Contributor Covenant Code of Conduct. If this is your first time contributing to a Free and Open Source Software project, consider reading How to Contribute to Open Source in the Open Source Guides.
If the desired change is large, complex, backwards-incompatible, can have significantly differing implementations, or may not be in scope for this project, opening an issue before writing the code can avoid frustration and save a lot of time and effort.
License
This project is available under the terms of the MIT License. See the summary at TLDRLegal.