Closed yunsim closed 4 years ago
Note: after an initial investigation this appear to be happening only for schemas using oneOf/allOf
. It works correctly with plain schemas. I'm digging into the source code to understand what's wrong.
Ok apparently this is done on purpose by the library, so there's something going on we're missing.
Note 2: It works correctly if the oneOf
has only one element:
Note 3: Effectively when there's more than a schema in a oneOf
the derived target schema is missing the required properties:
@yunsim We have identified the bug and it's in the underlying library we're using to generate the data.
We're working with the author to fix this; there's not really any action point from our side at this point.
@yunsim https://github.com/json-schema-faker/json-schema-faker/pull/524 — we're now at their mercy :)
Thanks!
as das
Describe the bug I used
prism mock api.yaml -d
to spin up a mock server for my openAPI spec, the dynamically generated responses always miss some required fields.To Reproduce
prism mock api.yaml -d
Expected behavior The expected response should have field 'resourceType' for all, and should have 'name' field for A and B, but the actual responses never have those fields
Some actual responses;
{ "color": "elit irure voluptate sunt", "length": 80304934 }
{ "description": "deserunt ut in", "age": -65249860 }
{ "data": "exercitation", "password": "nisi", "hint": "magna enim ullamco Ut consequat" }
Environment (remove any that are not applicable):
Additional context if I use 'static' generation without '-d' in the command, I can see all the field but it will always return schema A.
e.g. { "resourceType": "string", "name": "string", "color": "string", "length": 0 }