-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Description
When customizing your OpenAPI document currently the Attributes are applied first and then the XML Comments transformer.
This is because the applying of attributes is happening within the TransformJsonSchemaNode
and the XML Comments after that via a transformer.
In my humble opinion, [Attributes]
should be leading as it is more explicit than comments.
I see two ways to solve this:
- We add checks if a schema attribute is already set in the Xml Comment transformers.
- We move the transformations based on attributes to a SchemaTransformer.
For option 1 I see a lot of checks which need to be added in the transformer which would greatly decrease the maintainability of it.
For option 2 we need to be able to insert Transformers in a certain location because the XmlTransformer is added from the user-call-site, so that the order is XmlTransformer
-> AttributeTransformer
-> etc....
We could do this by exposing the transformers in an IList
on the OpenApiOptions
. This is unfortunatly an API change/addition.
Another benefit of Option 2 in my opinion is that that could enable disabling Validation Attributes for example, or other built-in transformations.
Tagging @captainsafia and @martincostello 😁