Skip to content

Conversation

@soartec-lab
Copy link
Member

Follow-up to #2672
I had the same problem with oneOf, so I fixed it.

@soartec-lab soartec-lab marked this pull request as ready for review December 23, 2025 10:08
Copilot AI review requested due to automatic review settings December 23, 2025 10:08
@soartec-lab soartec-lab added this to the 8.0.0 milestone Dec 23, 2025
@soartec-lab soartec-lab added bug Something isn't working zod Zod related issue labels Dec 23, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a bug where oneOf schemas were not properly handling additional properties. The change updates the condition for merging additional properties to explicitly check for the presence of allOf, oneOf, or anyOf schemas before processing, rather than just checking if properties exist.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

// Handle allOf/oneOf/anyOf with additional properties
if (schema.properties && Object.keys(schema.properties).length > 0) {
// Handle allOf/oneOf/anyOf with additional properties - merge additional properties into the schema
if ((schema.allOf || schema.oneOf || schema.anyOf) && schema.properties) {
Copy link

Copilot AI Dec 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The condition uses a logical OR to check if any of these properties exist, which evaluates to true even if the property is an empty array. This could lead to unnecessary processing when the array is empty. Consider checking both existence and non-emptiness: ((schema.allOf?.length || schema.oneOf?.length || schema.anyOf?.length) && schema.properties)

Copilot uses AI. Check for mistakes.
@melloware melloware merged commit 9ea86fc into orval-labs:master Dec 23, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working zod Zod related issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants