Forum Discussion

Shashank_R's avatar
Shashank_R
New Contributor
8 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
    8 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"?>
    ---
    requestBody:
      required: true
      content:
        application/xml:
          schema:
            # ... your schema definition here 


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

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