OAI / Arazzo-Specification

The Arazzo Specification - A Tapestry for Deterministic API Workflows
https://spec.openapis.org/arazzo/latest.html
Apache License 2.0
224 stars 44 forks source link

Improvement request: Support literal values in Criterion object when `type: simple` and context provided #246

Open TristanSpeakEasy opened 2 months ago

TristanSpeakEasy commented 2 months ago

I had this question in the official open-api slack community here: https://open-api.slack.com/archives/C022K8VD7AP/p1724764208525069

For a simple "Criterion" condition can the condition just be a "literal" that matches the provided context for example the context of $response.body matches a json object literal?

- context: $response.body
  condition: {"some": "json object"}
  type: simple

would:

- condition: '$response.body == {"some": "json object"}'

also work?

Basically after some discussion it was determined the first form is not compatible with the spec and json schema as it is today.

But I would like to request that either a value field or the condition field is made capable of providing a literal to match against the provided context when simple is provided.

Similar to how you can provide an "example value" in an OpenAPI document for Media Type Object that represents the request or response body.

This would ease the job of certain tooling to generate Arazzo documents but also consume simple criterion that is just trying to assert a response body for example matches something