Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

XML support #300

Open
hiddewie opened this issue Jan 25, 2021 · 0 comments
Open

XML support #300

hiddewie opened this issue Jan 25, 2021 · 0 comments

Comments

@hiddewie
Copy link

hiddewie commented Jan 25, 2021

This is a feature request.

We have the following OpenAPI document:

# ... metadata
paths:
  /api/path:
    post:
      summary: ...
      description: ...
      operationId: operation
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Model'
          application/xml:
            schema:
              $ref: '#/components/schemas/Model'
      responses:
        # ...

The model contains an xml key to describe the XML tag which is used to instantiate the model.

components:
  schemas:
    Model:
      xml:
        name: model
      type: object
      properties:
        # ...

Then, we fire an XML request, but this fails the validation

# ./spec/controllers/api/...'
# ------------------
# --- Caused by: ---
# OpenAPIParser::ValidateError:
#   #/components/schemas/Model expected object, but received String: <?xml version="1.0" encoding="UTF-8"?>
#   <model>
#     <property>94cf1162-0897-42f9-9dcb-9bd9abe7aa17</property>
#   </model>
#   ./spec/controllers/api/...

The XML is returned correctly, and matches the OpenAPI specification. The request validator interprets the XML response (application/xml content type) as a String.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant