diff --git a/docs/usage/configuration.md b/docs/usage/configuration.md index 22c2f9b5..98515fe9 100644 --- a/docs/usage/configuration.md +++ b/docs/usage/configuration.md @@ -58,6 +58,7 @@ Parameter Name | Description `maxDisplayedTags` | `Number`. If set, limits the number of tagged operations displayed to at most this many. The default is to show all operations. `operationsSorter` | `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` | `Boolean=false`. Controls the display of vendor extension (`x-`) fields and values for Operations, Parameters, and Schema. +`showCommonExtensions` | `Boolean=false`. Controls the display of extensions (`pattern`, `maxLength`, `minLength`, `maximum`, `minimum`) fields and values for Parameters. `tagsSorter` | `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()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/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. `onComplete` | `Function=NOOP`. Provides a mechanism to be notified when Swagger-UI has finished rendering a newly provided definition. diff --git a/src/core/components/parameter-row.jsx b/src/core/components/parameter-row.jsx index 323fa8f9..1b10834a 100644 --- a/src/core/components/parameter-row.jsx +++ b/src/core/components/parameter-row.jsx @@ -3,7 +3,7 @@ import { Map } from "immutable" import PropTypes from "prop-types" import ImPropTypes from "react-immutable-proptypes" import win from "core/window" -import { getExtensions } from "core/utils" +import { getExtensions, getCommonExtensions } from "core/utils" export default class ParameterRow extends Component { static propTypes = { @@ -82,7 +82,7 @@ export default class ParameterRow extends Component { let { isOAS3 } = specSelectors - const { showExtensions } = getConfigs() + const { showExtensions, showCommonExtensions } = getConfigs() // const onChangeWrapper = (value) => onChange(param, value) const JsonSchemaForm = getComponent("JsonSchemaForm") @@ -106,15 +106,17 @@ export default class ParameterRow extends Component { const ParameterExt = getComponent("ParameterExt") let paramWithMeta = specSelectors.parameterWithMeta(pathMethod, param.get("name"), param.get("in")) - + let format = param.get("format") let schema = isOAS3 && isOAS3() ? param.get("schema") : param let type = schema.get("type") let isFormData = inType === "formData" let isFormDataSupported = "FormData" in win let required = param.get("required") let itemType = schema.getIn(["items", "type"]) + let value = paramWithMeta ? paramWithMeta.get("value") : "" - let extensions = getExtensions(param) + let commonExt = showCommonExtensions ? getCommonExtensions(param) : null + let extensions = showExtensions ? getExtensions(param) : null let paramItems // undefined let paramEnum // undefined @@ -153,11 +155,16 @@ export default class ParameterRow extends Component { { param.get("name") } { !required ? null : * } -