Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Comments

Close side panel

Appends format property value to root schema if contained in anyOf, oneOf or allOf when serializing as v2#1001

Merged
irvinesunday merged 5 commits intovnextmicrosoft/OpenAPI.NET:vnextfrom
fix/is/format-prop-paramsmicrosoft/OpenAPI.NET:fix/is/format-prop-paramsCopy head branch name to clipboard
Sep 7, 2022
Merged

Appends format property value to root schema if contained in anyOf, oneOf or allOf when serializing as v2#1001
irvinesunday merged 5 commits intovnextmicrosoft/OpenAPI.NET:vnextfrom
fix/is/format-prop-paramsmicrosoft/OpenAPI.NET:fix/is/format-prop-paramsCopy head branch name to clipboard

Conversation

@irvinesunday
Copy link
Contributor

Fixes #992

This PR:

  • Retrieves the format property value from the child schemas of anyOf, oneOf or allOf and appends this to the root schema when serializing as v2 (when writing items as properties).
  • Updates test to validate the above.

Comment on lines 569 to 571
Format ??= AllOf?.FirstOrDefault(static x => x.Format != null)?.Format ??
AnyOf?.FirstOrDefault(static x => x.Format != null)?.Format ??
OneOf?.FirstOrDefault(static x => x.Format != null)?.Format;
Copy link
Member

Choose a reason for hiding this comment

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

I'm not super familiar with the code base here. But shouldn't this have a condition to only do it when we are serializing to v2?

Also, the conditions should be string.IsNullOrEmpty, not just a null comparison.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This method is only called by methods that serialize as v2

Copy link
Member

Choose a reason for hiding this comment

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

thanks for the precision. for the string is null or empty comment, I was also referring to the lambdas

@baywet
Copy link
Member

baywet commented Sep 7, 2022

also we should probably bump the preview version to we can use it in the conversion lib PR

@irvinesunday irvinesunday merged commit 6ff3176 into vnext Sep 7, 2022
@irvinesunday irvinesunday deleted the fix/is/format-prop-params branch September 7, 2022 15:50
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.

Append Format property value to root schema when serializing as v2 if contained in anyOf, allOf, oneOf of child schemas

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.