Skip to content
This repository has been archived by the owner on Nov 16, 2023. It is now read-only.

Commit

Permalink
fix: no quotes for default values in header fields. (Redocly#1059)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jan Cerman committed Jun 5, 2020
1 parent f894a1f commit 929735e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/components/Fields/FieldDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export class FieldDetails extends React.PureComponent<FieldProps> {
const { enumSkipQuotes } = this.context;

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) {
Expand Down Expand Up @@ -57,15 +58,15 @@ export class FieldDetails extends React.PureComponent<FieldProps> {
{/*{schema.title && <TypeTitle> ({schema.title}) </TypeTitle>}*/}
<ConstraintsView constraints={schema.constraints} />
{schema.nullable && <NullableLabel> {l('nullable')} </NullableLabel>}
{schema.pattern && <PatternLabel>{schema.pattern}</PatternLabel>}
{schema.pattern && <PatternLabel> {schema.pattern} </PatternLabel>}
{schema.isCircular && <RecursiveLabel> {l('recursive')} </RecursiveLabel>}
</div>
{deprecated && (
<div>
<Badge type="warning"> {l('deprecated')} </Badge>
</div>
)}
<FieldDetail raw={enumSkipQuotes} label={l('default') + ':'} value={schema.default} />
<FieldDetail raw={rawDefault} label={l('default') + ':'} value={schema.default} />
{!renderDiscriminatorSwitch && <EnumValues type={schema.type} values={schema.enum} />}{' '}
{exampleField}
{<Extensions extensions={{ ...field.extensions, ...schema.extensions }} />}
Expand Down

0 comments on commit 929735e

Please sign in to comment.