Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Output squashed structs #280

Draft
wants to merge 1 commit into
base: feature/implement-subschemas
Choose a base branch
from

Conversation

ptodev
Copy link

@ptodev ptodev commented Sep 19, 2024

A lot of Go projects use mapstructure's squash keyword. Being able to use squash would help those projects migrate to go-jsonschema without disrupting their codebase. This PR is a quick mockup I did so that I can unblock another project.

Squashing all objects inside allOf seems like the most natural way to incorporate this feature, because all the properties of the allOf object will become properties of the parent object. I suppose there will also be a Go compilation error if any of the property names from different allOf objects are the same.

I believe the corresponding yaml keyword would be inline. I'm not sure about json though.

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.

1 participant