rapi-doc / RapiDoc

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

Process extension values defined for properties of referenced objects #944

Closed charithe closed 2 months ago

charithe commented 1 year ago

Consider a parameter definition like the following:

        "parameters": [
          {
            "name": "body",
            "description": "Description",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/Foo"
            }
          }
        ]

The Foo object is defined as:

    "Foo": {
      "type": "object",
      "properties": {
        "bar_field": {
          "type": "string",
          "example": "bar_value",
          "x-example-show-value": false,
          "x-fill-example": false
        },
        "baz_field": {
          "type": "string",
          "example": "baz_value",
          "x-example-show-value": false,
          "x-fill-example": false
        }
      }
    }

It seems that the x-fill-example and x-example-show-value extension values are not processed by Rapidoc when generating the example. It'd be nice to be able to exclude certain properties from nested objects from appearing in the generated example.

mrin9 commented 2 months ago

x-fill-example and x-example-show-value are defined at request level If you like to include/exclude values from the schema then OpenAPI already provides an way to do that Ise One-Of and Any-Of combinations to define your schema and RapiDoc will generate various possible combinations of the example values checkout this test-case