thunder-client-support icon indicating copy to clipboard operation
thunder-client-support copied to clipboard

Interpret OpenAPI examples and example fields

Open rangav opened this issue 2 years ago • 0 comments

    Hi @rangav 

Thank you, please find a Minimal reproducible example

openapi: 3.0.0
info:
  description: Api to handle client in daily database
  title: Client api
  version: "1.0"
servers:
- url: /
tags:
- name: client
paths:
  /clients:
    post:
      operationId: create
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ClientSearchCriteria'
            examples:
              default:
                $ref: '#/components/examples/defaultListRequest'
      responses:
        default:
          content:
            application/json:
              examples:
                default:
                  $ref: '#/components/examples/defaultListResponse'
              schema:
                items:
                  $ref: '#/components/schemas/ClientSearchCriteria'
                type: array
          description: default response

components:
  schemas:
    ClientSearchCriteria:
      properties:
        clientId:
          type:
            string
        name:
          type:
            string
      type: object
    
  examples:
    defaultListRequest:
      value:
        cliendId: "clientId body request"
        name: "name body request"
    defaultListResponse:
      value:
        cliendId: "clientId response"
        name: "name response"

Thunder interpretation

image

It could be good to have instead

{
  "clientId": "clientId body request",
  "name": "name body request"
}

Originally posted by @adrien1212 in https://github.com/rangav/thunder-client-support/discussions/1076#discussioncomment-5410391

rangav avatar Mar 25 '23 16:03 rangav