Skip to content

v2.2.1

Choose a tag to compare

@pmcelhaney pmcelhaney released this 20 Mar 12:26
· 2190 commits to main since this release
bf994d4

Patch Changes

  • 304cbfe: Add example(name) method to response builder for selecting named OpenAPI examples

    Developers can now select a specific named example from the OpenAPI specification using the strongly-typed example() method on a response builder:

    return $.response[200].example("namedExample1");

    The method is fully type-safe: TypeScript will autocomplete the example names defined in the OpenAPI document and report a type error if an unknown name is used.

    Example names are collected from the examples field of each media type in the response content (OpenAPI 3.x). The method can be chained with other response builder methods:

    return $.response[200]
      .example("namedExample1")
      .header("some-header", "some-value");