Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/expediagroup/spec-transformer

The API Spec Transformer Library
https://github.com/expediagroup/spec-transformer

json openapi openapi3 postman specs transformer yaml

Last synced: about 1 month ago
JSON representation

The API Spec Transformer Library

Awesome Lists containing this project

README

        

# Spec Transformer

The API Spec Transformer Library

## Installation

```bash
npm install @expediagroup/spec-transformer
```

## Usage

Pick one of the following ways to use the library:

### 1. Use spec-transformer as a library

Example:

```typescript
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);
```

### 2. Use spec-transformer as a CLI

```bash
npx -p @expediagroup/spec-transformer cli --help # Show help, and list all available commands.
```

Example:

```bash
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
```

### 3. Build and run spec-transformer locally

```bash
npm install
npm run build
```

### Test

```bash
npm test
```

---

## Development Team
- [Mohammad Noor Abu Khleif](https://github.com/mohnoor94)
- [Osama Salman](https://github.com/osama-salman99)