Skip to content

fix: support schemas defined using allOf#93

Open
jordan-burnett wants to merge 1 commit intomswjs:mainfrom
jordan-burnett:combine-allof
Open

fix: support schemas defined using allOf#93
jordan-burnett wants to merge 1 commit intomswjs:mainfrom
jordan-burnett:combine-allof

Conversation

@jordan-burnett
Copy link
Copy Markdown

@jordan-burnett jordan-burnett commented Apr 10, 2026

The OpenAPI spec supports combining schemas with keywords like allOf or oneOf

Schemas that use one of these keywords currently produce empty response bodies due to seedSchema being passed the wrapper rather than the nested schemas.

I've resolved it for allOf by adding an extra step that merges any nested schemas so the seed function only sees the final schema and produces an output that matches all of them.

Supporting the other keywords would require making a decision about which schema to use (perhaps just choosing the first one would be reasonable?). For now I've only implemented for allOf to keep things simple.

@kettanaito
Copy link
Copy Markdown
Member

Hi, @jordan-burnett. Thank you for suggesting this, it's definitely a missing piece.

Do you think this fix makes more sense in https://github.com/yellow-ticket/seed-json-schema? There's also an open issues for anyOf (yellow-ticket/seed-json-schema#7). I believe if this library gives us a correctly seeded schema, then Source shouldn't have to change anything. Or am I misread this?

@jordan-burnett
Copy link
Copy Markdown
Author

Hey @kettanaito. You're right, it probably does makes more sense in there.

Think I understand a bit better now how the two libraries interact. I'll have a go at porting this over when I get a moment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants