The API Spec Transformer Library
npm install @expediagroup/spec-transformer
Pick one of the following ways to use the library:
Example:
import { HeaderRemovalTransformer, TransformerChain, YamlReader, YamlWriter } from '@spec-transformer';
const openapispecs = '...'; // OpenAPI specs in JSON or YAML format
const transformers = new TransformerChain([
new HeaderRemovalTransformer() // Add more transformers here
]);
const transformedSpecs = transformers.transform(openapispecs, YamlReader, YamlWriter);
console.log(transformedSpecs);
npx -p @expediagroup/spec-transformer cli --help # Show help, and list all available commands.
Example:
npx -p @expediagroup/spec-transformer cli --input specs.yaml --output out.yaml --headers # Read specs from specs.yaml, remove headers, and write to out.yaml
npm install
npm run build
npm test