XML Representing Attribute and Element
I'm in an urgent project and we are implementing an open api 3.0 solution in XML.
Want to try to define the following case (xml element and attribute):
<Direction index="4">Human Ressource</Fluss>
This implementation does not lead to the desired result:
I'm getting allways errors during rendering in swagger.
Is there any solution for this problem and how does it look like?
thx for (soon) your support.
To resolve the issue you're facing with rendering in Swagger for your XML implementation of the OpenAPI 3.0 solution, you can make the following adjustments to your schema:
- The <Header> element remains the same.
- The <Fluss> element is represented by the Fluss property within the Header object. It is defined as an object type with a single property #text to represent the text value of the element.
- The xml property under Fluss is set to wrapped: true, indicating that the Fluss element should be wrapped within the Header element.
- The Index attribute is represented as a separate property outside of the Fluss object, directly under Header. It is defined as a string type and uses the xml property with attribute: true to indicate that it should be rendered as an attribute in the XML.
With these adjustments, you should be able to render the desired XML structure in Swagger without encountering any errors.