Forum Discussion

Peter_XXX's avatar
Peter_XXX
Occasional Visitor
4 years ago
Solved

is it possible to define multiple charset in the content type of a REST call in Swagger?

I'm trying to describe a call like this.    The issue I run into is that the charset that is returned is the charset of the DB.  And we have some DB that for historical reasons are not on th...
  • HKosova's avatar
    4 years ago

    Hi Peter,

    You'll need to define those different encodings as separate media types:

          requestBody:
            required: true
            content:
              application/json; charset=UTF-8:
                schema:
                  $ref: '#/components/schemas/Something'
              application/json; charset=iso-8859-1:
                schema:
                  $ref: '#/components/schemas/Something'

     

    There's an existing enhancement request to improve the syntax so that parameterized media types can be defined using a single Media Type Object:

    Parameters for Media Types