Skip to content

Specbook 0.7.0: better mock heuristics

Choose a tag to compare

@ajaishankar ajaishankar released this 19 Oct 13:27
· 21 commits to main since this release

Mock responses and generated examples now read your spec more closely.

  • Values come from the spec: examples, defaults, enums, descriptions ("Can be amex", "ISO currency code") and the same field elsewhere in the document. Nothing is invented for an enum.
  • Limits are honoured: pattern, length, minimum/maximum, multipleOf, minItems.
  • Responses are smaller: another resource embedded by value is null or left out (Stripe's Customer goes from 457 lines to 84), and errors keep only the usual fields (Stripe's error from 1,139 lines to 9).
  • A spec's own response example is used when it satisfies the schema.
  • The mock recognises a secret or client id header as a credential.

No breaking changes. Run specbook generate to refresh generated examples.

Full changelog: v0.6.1...v0.7.0