Maillol / aiohttp-pydantic

Aiohttp View that validates request body and query sting regarding the annotations declared in the View method
MIT License
67 stars 21 forks source link

Add display configurations swagger UI #43

Closed khrebtukov closed 2 months ago

khrebtukov commented 1 year ago

For a more flexible display of the swagger documentation, it is sometimes necessary to customize the display. What this documentation does not provide. This pull request provides the ability to add any of the listed options dynamically. Which adds some flexibility in customization

Display
Parameter name Docker variable Description
displayOperationId DISPLAY_OPERATION_ID Boolean=false. Controls the display of operationId in operations list. The default is false.
defaultModelsExpandDepth DEFAULT_MODELS_EXPAND_DEPTH Number=1. The default expansion depth for models (set to -1 completely hide the models).
defaultModelExpandDepth DEFAULT_MODEL_EXPAND_DEPTH Number=1. The default expansion depth for the model on the model-example section.
defaultModelRendering DEFAULT_MODEL_RENDERING String=["example"*, "model"]. Controls how the model is shown when the API is first rendered. (The user can always switch the rendering for a given model by clicking the 'Model' and 'Example Value' links.)
displayRequestDuration DISPLAY_REQUEST_DURATION Boolean=false. Controls the display of the request duration (in milliseconds) for "Try it out" requests.
docExpansion DOC_EXPANSION String=["list"*, "full", "none"]. Controls the default expansion setting for the operations and tags. It can be 'list' (expands only the tags), 'full' (expands the tags and operations) or 'none' (expands nothing).
filter FILTER Boolean=false OR String. If set, enables filtering. The top bar will show an edit box that you can use to filter the tagged operations that are shown. Can be Boolean to enable or disable, or a string, in which case filtering will be enabled using that string as the filter expression. Filtering is case sensitive matching the filter expression anywhere inside the tag.
maxDisplayedTags MAX_DISPLAYED_TAGS Number. If set, limits the number of tagged operations displayed to at most this many. The default is to show all operations.
operationsSorter Unavailable Function=(a => a). Apply a sort to the operation list of each API. It can be 'alpha' (sort by paths alphanumerically), 'method' (sort by HTTP method) or a function (see Array.prototype.sort() to know how sort function works). Default is the order returned by the server unchanged.
showExtensions SHOW_EXTENSIONS Boolean=false. Controls the display of vendor extension (x-) fields and values for Operations, Parameters, Responses, and Schema.
showCommonExtensions SHOW_COMMON_EXTENSIONS Boolean=false. Controls the display of extensions (pattern, maxLength, minLength, maximum, minimum) fields and values for Parameters.
tagsSorter Unavailable Function=(a => a). Apply a sort to the tag list of each API. It can be 'alpha' (sort by paths alphanumerically) or a function (see Array.prototype.sort() to learn how to write a sort function). Two tag name strings are passed to the sorter for each pass. Default is the order determined by Swagger UI.
useUnsafeMarkdown USE_UNSAFE_MARKDOWN Boolean=false. When enabled, sanitizer will leave style, class and data-* attributes untouched on all HTML Elements declared inside markdown strings. This parameter is Deprecated and will be removed in 4.0.0.
onComplete Unavailable Function=NOOP. Provides a mechanism to be notified when Swagger UI has finished rendering a newly provided definition.
syntaxHighlight Unavailable Set to false to deactivate syntax highlighting of payloads and cURL command, can be otherwise an object with the activate and theme properties.
syntaxHighlight.activate Unavailable Boolean=true. Whether syntax highlighting should be activated or not.
syntaxHighlight.theme Unavailable String=["agate"*, "arta", "monokai", "nord", "obsidian", "tomorrow-night"]. Highlight.js syntax coloring theme to use. (Only these 6 styles are available.)
tryItOutEnabled TRY_IT_OUT_ENABLED Boolean=false. Controls whether the "Try it out" section should be enabled by default.
requestSnippetsEnabled Unavailable Boolean=false. Enables the request snippet section. When disabled, the legacy curl snippet will be used.
requestSnippets Unavailable
Object={
  generators: {
    curl_bash: {
      title: "cURL (bash)",
      syntax: "bash"
    },
    curl_powershell: {
      title: "cURL (PowerShell)",
      syntax: "powershell"
    },
    curl_cmd: {
      title: "cURL (CMD)",
      syntax: "bash"
    },
  },
  defaultExpanded: true,
  languages: null, 
  // e.g. only show curl bash = ["curl_bash"]
}

This is the default configuration section for the the requestSnippets plugin.