-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Fix/openapi schema xml comments ordering #62213
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
base: main
Are you sure you want to change the base?
Fix/openapi schema xml comments ordering #62213
Conversation
…d Update tests to write in the InvariantCulture
Update handling of nested schemas and referenced schemas
Thanks for your PR, @@desjoerd. Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
Did you mean to include 14dd22b in this PR? |
No, I am planning to rebase/cherry-pick when #62212 is merged. Otherwise I cannot run the unit tests 😅. I marked it as draft because it's also not completely correct at the moment. There needs to be some extra conditions to check whether it's a reference or not (to handle the two different descriptions, on the property with reference and on the schema in components). I currently only get either the correct description on the reference and wrong on the schema or the other way around. I am open to have a call about it, maybe tomorrow? Or to continue the discussion here or on the referenced issue. |
I've done some more fiddling. With the current ordering of applying schema transformers and resolving references it's as far as I can see impossible to give a different description to the Schema Reference and the Schema itself. Current behavior for the following classes: /// <summary>
/// An address.
/// </summary>
public class AddressNested
{
public string Street { get; set; }
}
public class Company
{
/// <summary>
/// Billing address.
/// </summary>
public AddressWithSummary BillingAddressClassWithSummary { get; set; }
/// <summary>
/// Visiting address.
/// </summary>
public AddressWithSummary VisitingAddressClassWithSummary { get; set; }
}
If we would copy the description from the I think the optional solution should be: Without changing the flow of applying schema transformers and resolving schema references we currently have to maybe go for:
This would mean that property comments are not used for schemas which become references, which in my opinion is the most "valid" option without changing the order. If we would change the order I propose to go for something like:
|
Fix openapi schema xml comments handling for nested schemas
Fix applying annotations from xml on properties, nested and referenced schemas.
Description
Changes:
Remarks
Fixes #61965