rapi-doc / RapiDoc

RapiDoc -WebComponent for OpenAPI Spec
https://rapidocweb.com
MIT License
1.65k stars 277 forks source link

[Info] Custom vendor extensions display #969

Closed everybytecounts closed 1 week ago

everybytecounts commented 11 months ago

How can I display custom extensions from a Swagger 2.0 JSON file? Specifically, I'd like to show the x-customvalue field on the UI, whose value varies for different endpoint

paths:
  /pet:
    post:
      tags:
      - "pet"
      summary: "Add a new pet to the store"
      x-customvalue: "someCustomvalue"
      description: ""
      operationId: "addPet"
      consumes:
      - "application/json"
      - "application/xml"
      produces:
      - "application/xml"
      - "application/json"
      parameters:
      - in: "body"
        name: "body"
        description: "Pet object that needs to be added to the store"
        required: true
        schema:
          $ref: "#/definitions/Pet"
      responses:
        "405":
          description: "Invalid input"
      security:
      - petstore_auth:
        - "write:pets"
        - "read:pets"
    put:
      tags:
      - "pet"
      summary: "Update an existing pet"
      description: ""
      x-customvalue: "someCustomvalue"
      operationId: "updatePet"
      consumes:
      - "application/json"
      - "application/xml"
      produces:
      - "application/xml"
      - "application/json"
      parameters:
      - in: "body"
        name: "body"
        description: "Pet object that needs to be added to the store"
        required: true
        schema:
          $ref: "#/definitions/Pet"
      responses:
        "400":
          description: "Invalid ID supplied"
        "404":
          description: "Pet not found"
        "405":
          description: "Validation exception"
mrin9 commented 1 week ago

vendor extensions are vendor specific. in this case it will work only with swagger (the vendor) not in RapiDoc

the vendor-extensions supported by rapidoc are listed here

I would still suggest unless its too important do not rely on vendor-extensions that way you will keep your spec vendor neutral