Skip to content

Conversation

@gadcam
Copy link

@gadcam gadcam commented Mar 19, 2024

Traverse paths until exhaustion of the tree before checking if a discriminator is needed.
With the previous code the example added in the test where we have a oneOf hidden inside an array would be enough to confuse the check.

@gadcam gadcam requested a review from a team as a code owner March 19, 2024 00:01
@gadcam
Copy link
Author

gadcam commented Mar 19, 2024

@microsoft-github-policy-service agree

Copy link
Member

@baywet baywet left a comment

Choose a reason for hiding this comment

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

Thank you for the contribution.
I do think we'll need to make a few tweaks before we can merge this.
Also, can you add an entry to the changelog please? (unreleased, changed)

return "object".Equals(schema?.Type, StringComparison.OrdinalIgnoreCase);
}

public static bool IsScalar(this OpenApiSchema? schema)
Copy link
Member

Choose a reason for hiding this comment

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

this method name is confusing. An array would technically return true even though semantically it's not scalar.

Also the implementation checks two separate concerns: the structure (object) and the location (reference) of the schema.

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

Labels

None yet

Projects

Status: In Progress 🚧

Development

Successfully merging this pull request may close these issues.

2 participants