openapi: 3.0.0
info:
  title: Request Body
  description:  Request Body
  version: 1.0.0
paths:
  /item-price:
    post:
      summary: Multiple Request body
      description: Request body with multiple `media types` 
      requestBody:
        description: Even though you can define multiple request bodies, but only one can be submitted 
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/Price"
            examples:
              USD:
                description: Cost in `US Dollars`
                value: |
                  {
                    amount: 10,
                    currency: USD,
                    converstion: 'use-avg',
                    taxes: ['federal', 'state']
                  }
              INR:
                description: Cost in `Indian Price`
                value: |
                  {
                    amount: 700,
                    currency: INR,
                    converstion: 'use-min'
                    taxes: ['exchange']
                  }
          application/xml:
            schema:
              $ref: "#/components/schemas/Price"
          application/text:
            schema:
              $ref: "#/components/schemas/Price"
            examples:
              price-in-indian-rupee:
                value: |
                  amount: 700,
                  currency: INR,
                  converstion: 'use-avg'
              price-in-us-dollars:
                value: |
                  amount: 10,
                  currency: USD,
                  converstion: 'use-avg'
          multipart/form-data: 
            schema:         
              $ref: "#/components/schemas/Price"
          application/x-www-form-urlencoded:
            schema:         
              $ref: "#/components/schemas/Price"
          application/octet-stream:
            schema:
              $ref: "#/components/schemas/Price"
      responses:
        200:
          description: Updated with provided values
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Price"
            text/html:
              schema:
                description: Updated 
                type: string
                example: Successfully updated 
        400:
          description: Internal server error occurred.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Price"
components:
  schemas:
    Price:
      type: object
      properties:
        amount:
          type: integer
          required: true
          description: Amount rounded to nearest integer
          example: 10
          default: 20
          minimum: 5
          maximum: 100
          format: int32
        currency:
          type: string
          description: Currency code
          examples:
            - USD
            - INR
        converstion:
          type: string
          enum:
            - use-min
            - use-max
            - use-avg
          default: use-avg   
          examples:
            - use-avg
            - use-min
        taxes:
          type: array
          items:
            type: string
          examples:
            - 'exchange'
            - ['state', 'federal']
            - ['exchange', 'federal']
            - 'federal'

