Generates example request parameters from a Swagger specification
yarn add @springworks/request-baker
Bakes tasty example request parameters from a Swagger specification.
import { constructRequests } from '@springworks/request-baker';
const { requests } = await constructRequests(swagger_spec);
Each request
has the following structure:
import { Request } from '@springworks/request-baker';
const example_request: Request = {
path: '/pets/17',
original_path: '/pets/{id}',
base_path: '/api',
method: 'get',
body: { foo: 123 },
headers: { 'X-Request-ID': '77e1c83b-7bb0-437b-bc50-a7a58e5660ac' },
qs: { id: 1, name: 'daisy' },
};