encode / apistar

The Web API toolkit. 🛠
https://docs.apistar.com
BSD 3-Clause "New" or "Revised" License
5.57k stars 411 forks source link

requestBody media types are not handled generically #669

Open jcass77 opened 4 years ago

jcass77 commented 4 years ago

There's already a TODO in the code for this, but when parsing the OpenAPI schema, API Star does not seem to cater for media types other than application/json.

The OpenAPI 3 specification makes provision for operations to consume many different media types in requestBody, as per the example for Form Data below:

 /survey:
    post:
      requestBody:
        required: true
        content:
          application/x-www-form-urlencoded:  # <!--- API Star does not support using this media type
            schema:
              type: object
              properties:
                name:
                  type: string
                fav_number:
                  type: integer
              required:
                - name
                - email

At the moment, using anything other than application/json in the schema will raise a ClientError with code invalid_property.