consider the below schemas:
map:
type: object
additionalProperties:
$ref: "#/components/schemas/simpleObject"
example: { "key": "...", "key2": "..." }
arr:
type: array
items:
$ref: "#/components/schemas/simpleObject"
example: ["...", "..."]
These use an example expansion directive of "..." (btw this is a special directive value speakeasy uses to direct our generator how to generate examples, we would be open to discussing alternative directives that both speakeasy and wiretap could use if you didn't want to support this one) which tells our generator to expand the example with an example value generated from the child schema, ie the additionalProperties schema or items schema.
In the examples above we are saying we want the map example to contain two keys (key and key2) where the values are using the example generated from the simpleObject component. This provides a shorthand to avoid having to define the whole json object in the example at this level and instead take advantage of the fact the examples have already been defined in the component.
The array version is just saying I want two values of the example defined in the simpleObject component.
Would love if the mocking from wiretap also supported this (or something similar that we can converge on) as it does reduce the burden for the example implementor.
consider the below schemas:
These use an example expansion directive of
"..."(btw this is a special directive value speakeasy uses to direct our generator how to generate examples, we would be open to discussing alternative directives that both speakeasy and wiretap could use if you didn't want to support this one) which tells our generator to expand the example with an example value generated from the child schema, ie theadditionalPropertiesschema oritemsschema.In the examples above we are saying we want the
mapexample to contain two keys (keyandkey2) where the values are using the example generated from thesimpleObjectcomponent. This provides a shorthand to avoid having to define the whole json object in the example at this level and instead take advantage of the fact the examples have already been defined in the component.The array version is just saying I want
twovalues of the example defined in thesimpleObjectcomponent.Would love if the mocking from wiretap also supported this (or something similar that we can converge on) as it does reduce the burden for the example implementor.