diff --git a/demo/openapi.yaml b/demo/openapi.yaml index b7c1833a02..d10fdf731d 100644 --- a/demo/openapi.yaml +++ b/demo/openapi.yaml @@ -86,6 +86,14 @@ x-tagGroups: paths: /pet: parameters: + - name: Accept-Language + in: header + description: "The language you prefer for messages. Supported values are en-AU, en-CA, en-GB, en-US" + example: en-US + required: false + schema: + type: string + default: en-AU - name: cookieParam in: cookie description: Some cookie @@ -678,6 +686,7 @@ components: type: string description: The measured skill for hunting default: lazy + example: adventurous enum: - clueless - lazy @@ -890,7 +899,6 @@ components: type: string pattern: '/^\+(?:[0-9]-?){6,14}[0-9]$/' example: +1-202-555-0192 - nullable: true userStatus: description: User status type: integer diff --git a/src/components/Fields/FieldDetails.tsx b/src/components/Fields/FieldDetails.tsx index cdfa38b6df..0a564032e8 100644 --- a/src/components/Fields/FieldDetails.tsx +++ b/src/components/Fields/FieldDetails.tsx @@ -31,6 +31,8 @@ export class FieldDetails extends React.PureComponent { const { schema, description, example, deprecated } = field; + const rawDefault = !!enumSkipQuotes || field.in === 'header'; // having quotes around header field default values is confusing and inappropriate + let exampleField: JSX.Element | null = null; if (showExamples && example !== undefined) { @@ -59,7 +61,7 @@ export class FieldDetails extends React.PureComponent { {schema.title && ({schema.title}) } {schema.nullable && {l('nullable')} } - {schema.pattern && {schema.pattern}} + {schema.pattern && {schema.pattern} } {schema.isCircular && {l('recursive')} } {deprecated && ( @@ -67,7 +69,7 @@ export class FieldDetails extends React.PureComponent { {l('deprecated')} )} - + {!renderDiscriminatorSwitch && }{' '} {exampleField} {}