interagent / interagent/committee

XML support

Open
#300 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
955
Forks
145
Avg merge
5d 4h
Merged PRs (30d)
6

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the request validator exercised by spec/controllers/api/... and trace how the application/xml request body is parsed before schema validation. Done means the XML body is validated as the Model object described by the OpenAPI document, while the existing XML response behavior remains correct.

Written by the indexing model from the issue text.

Assessment

Tech stack
openapi, ruby
Domain
api
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.