English 中文(简体)
• 如何利用部件在欧安普森软件中树立榜样?
原标题:How to create example in OPEN API using components?

My example is showing up as ref instead of getting rendered. enter image description here

我对使用部件向化工分配价值找到了一些答案。 但我不肯定为什么不正确工作。 任何建议都将受到高度赞赏。

我的安普森pec切期望看到这一点。

  responses:
     200 :
      description: Successful response
      content:
        application/json:
          schema:
            $ref:  #/components/schemas/deduction_charge 
          example:
            deduction_charge:
              $ref:  #/components/examples/deduction_charge 

我的各位成员都希望这样做。

components:
  examples:
    deduction_charge:
      summary: Example deduction charge
      value:
        deduction_charge:
        - id: "ct_h5e599d3-0000-4d46-9a52-1a37e7b5b8ef"
          status: "SUCCESS"
          description: "Super HD plan"
          amount: 10000
          amount_refunded: 0
          currency: "JPY"
          deduction_token: "dt_f5e599d3-8b9e-4d46-9a52-1a37e7b5b8ef"
          metadata:
            customerID: "123"
            customerName: "Yamada Taro"
            transactionID: "A123"
          created_at: "2023-11-07T15:30:00.000+09:00"
          updated_at: "2023-11-07T15:30:00.000+09:00"
问题回答

页: 1

你的亚穆勒 in不正确

引言

openapi: 3.0.3
info:
  title: test
  version: "1"
servers:
  - url: https://www.example.com/v1
paths:
   /thing :
    get:
      summary: thing api
      responses:
         200 :
          description: Successful response
          content:
            application/json:
              schema:
                $ref:  #/components/schemas/deduction_charge 
              examples:
                deduction_charge:
                  $ref:  #/components/examples/deduction_charge 

components:
  examples:
    deduction_charge:
      summary: Example deduction charge
      value:
        deduction_charge:
          - id: "ct_h5e599d3-0000-4d46-9a52-1a37e7b5b8ef"
            status: "SUCCESS"
            description: "Super HD plan"
            amount: 10000
            amount_refunded: 0
            currency: "JPY"
            deduction_token: "dt_f5e599d3-8b9e-4d46-9a52-1a37e7b5b8ef"
            metadata:
              customerID: "123"
              customerName: "Yamada Taro"
              transactionID: "A123"
            created_at: "2023-11-07T15:30:00.000+09:00"
            updated_at: "2023-11-07T15:30:00.000+09:00"
  schemas:
    deduction_charge:
      type: object
      properties:
        deduction_charge:
          type: array
          items:
            type: object
            properties:
              id:
                type: string
              status:
                type: string
              description:
                type: string
              amount:
                type: number
              amount_refunded:
                type: number
              currency:
                type: string
              deduction_token:
                type: string
              metadata:
                type: object
                properties:
                  customerID:
                    type: string
                  customerName:
                    type: string
                  transactionID:
                    type: string
              created_at:
                type: string
                format: date-time
              updated_at:
                type: string
                format: date-time

“examples”/

“swagger”/





相关问题
Golang OpenAPI Generator add custom header to request

Is it possible to add a custom header that is not specified in the openapi.yaml to the request? I have something like: res, err := s.client.MyApi. SomeOperation(context.Background(), id). ...

Open AI finish response LENGTH

I am calling open AI api with below details and I am getting below response { value : { outputs : [{ finishReason : LENGTH , text : The summary in this JSON format is as follows: short_ , ...

Redoc HTML rendering empty

I m trying to create a standalone HTML file in Redoc. Following the example from https://redocly.com/docs/redoc/deployment/html/, this is my HTML below. Both HTML and openapi.json are inside docs ...

热门标签