1.0.9 • Published 3 years ago

post-collection-to-yaml v1.0.9

Weekly downloads
2
License
MIT
Repository
github
Last release
3 years ago

How to use

Install dependency

npm i post-collection-to-yaml

Import and use

const postToYaml = require('post-collection-to-yaml');

const fileIn = 'path/to/post-collection.json';
const fileOut = 'path/to/save.yaml';

const stringInput = path.join(__dirname, fileIn);
const stringOutput = path.join(__dirname, fileOut);
await postToYaml.convert(stringInput, stringOutput);

Make responses easy!

Save you responses on postman, and we will make example for response on swagger

Params

Recive 2 params: a string of path and file from Postman Collection and a string of output, place to save you swagger file. Can create your report when lifting your service.

Personalize some params v1 (Optional)

const postToYaml = require('post-collection-to-yaml');

const fileIn = 'path/to/post-collection.json';
const fileOut = 'path/to/save.yaml';

  const options = {
    url: 'localhost:3030',
    description: 'server description',
    title: 'titulo de prueba',
    version: '1.2.3',
    descriptionInfo: 'service description',
    email: 'my.awesome.email@mail.com'
  }

const stringInput = path.join(__dirname, fileIn);
const stringOutput = path.join(__dirname, fileOut);
await postToYaml.convert(stringInput, stringOutput, options);

Personalize some params v2 (Optional, with many servers url's)

const postToYaml = require('post-collection-to-yaml');

const fileIn = 'path/to/post-collection.json';
const fileOut = 'path/to/save.yaml';

  const options = {
    title: 'titulo de prueba',
    version: '1.2.3',
    descriptionInfo: 'service description',
    email: 'my.awesome.email@mail.com',
     server: [{
      url: 'localhost:3030',
      description: 'server local'
    }, {
      url: 'localhost:3031',
      description: 'server produccion'
    }
    ]
  }

const stringInput = path.join(__dirname, fileIn);
const stringOutput = path.join(__dirname, fileOut);
await postToYaml.convert(stringInput, stringOutput, options);

Note for path server

if you put array of server thats cancel the url and description for single server

Example

npm.io

Credits

By Paulo Ariel Pareja

1.0.9

3 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago