Skip to content

Options to specify output #245

@rnphilp

Description

@rnphilp

OpenAPI version
3

Is your feature request related to a problem? Please describe.
When using the toSatisfyApiSpec function, the output often overruns the history limit of the terminal. This is the case when the API route being tested returns an array of items (even if only one of the objects in the whole array is invalid), or when running a full test suite, where there are multiple errors returned. The output of the body response can be too large, making it difficult/impossible to navigate to the actual issues, when the key information is just the initial message at the top.

Describe the solution you'd like
An options object that passed into the function allowing you to suppress certain sections of the output. Something like:

toSatisfyApiSpec({ message: true, response: false, schema: false })

Everything can be true by default to avoid changing the current functionality.

Describe alternatives you've considered
Reducing the request body logs to remove the valid items in the array and only include the errors. So the output would be more like:

{
  my_response: [
    ...
    {
       foo: 'bar',
       error: 'in_just_this_object',
    }
    ...
  ]
}

Or just displaying a reduced snapshot of that section of the body, with say 5 lines above and below.

Additional context
No

Are you going to resolve the issue?
Not currently got the opportunity.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions