Forum Discussion

Shashank_R's avatar
New Member
3 months ago

Adding Processing attribute to an XML spec

I am trying to add a XML processing attribute like below <?TEST  TEST1="100"  TEST2="NONE"?> Can you please help me on how to define this using a open api spec in Swaggerhub?  Any help or suggesti...
  • Humashankar's avatar
    3 months ago

    Hi Shashank_R 

    OpenAPI specifications which are used in SwaggerHub don't directly support defining processing instructions-PIs like the one you provided at the beginning (<?TEST TEST1="100" TEST2="NONE"?>).

    While it is not ideal, you can use comments within your YAML or JSON spec file to document the presence of the PI. For example:

    # This API request expects an XML document with the following processing instruction:
    # <?TEST TEST1="100" TEST2="NONE"?>
      required: true
            # ... your schema definition here 

    You can also - use your client applications to handle the chosen's purely for documentation purposes.

    Hope this helps - Happy to help further!!
    Thank you very much and have a great one!
    Warm regards