@kevinoid/openapi-transformer-pipeline

1.0.0 • Public • Published

OpenApiTransformerPipeline

Build Status Coverage Dependency Status Supported Node Version Version on NPM

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.

Package Sidebar

Install

npm i @kevinoid/openapi-transformer-pipeline

Weekly Downloads

4

Version

1.0.0

License

MIT

Unpacked Size

9.84 kB

Total Files

4

Last publish

Collaborators

  • kevinoid