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

Issue with default value for additional property (oneOf) #270

Merged
merged 2 commits into from
Mar 6, 2024

Conversation

ulrikandersen
Copy link
Collaborator

@ulrikandersen ulrikandersen commented Mar 6, 2024

After #268 was merged it seems like additional properties in the generated model has an incorrect default value.

The test for discriminatedOneOf illustrates the issue: StateBMode has it's default value set to a non existent enum value - which looks like the value of the discriminator field.

Screenshot 2024-03-06 at 14 42 29

I would love to assist with a fix, but I am simply not familiar enough with the codebase to be able to identify where to start.

I have taken my best shot at fixing the issue. Let me know what you think.

I notice that the ordering of properties in the model is different from the order in the spec, but perhaps that's intentional?

@ulrikandersen ulrikandersen force-pushed the one-of-additional-properties branch from 15085eb to 39fcc45 Compare March 6, 2024 15:11
@cjbooms
Copy link
Owner

cjbooms commented Mar 6, 2024

Nice work! 👍

@cjbooms cjbooms merged commit cabeb0a into cjbooms:master Mar 6, 2024
1 check passed
@ulrikandersen ulrikandersen deleted the one-of-additional-properties branch March 6, 2024 15:16
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