Skip to content

Commit

Permalink
feat: new option hideSchemaTitles
Browse files Browse the repository at this point in the history
  • Loading branch information
RomanHotsiy committed Dec 12, 2019
1 parent 4a25aae commit 11cc4c4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/components/Fields/FieldDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export class FieldDetails extends React.PureComponent<FieldProps> {
static contextType = OptionsContext;
render() {
const { showExamples, field, renderDiscriminatorSwitch } = this.props;
const { enumSkipQuotes } = this.context;
const { enumSkipQuotes, hideSchemaTitles } = this.context;

const { schema, description, example, deprecated } = field;

Expand Down Expand Up @@ -59,7 +59,7 @@ export class FieldDetails extends React.PureComponent<FieldProps> {
&gt;{' '}
</TypeFormat>
)}
{schema.title && <TypeTitle> ({schema.title}) </TypeTitle>}
{schema.title && !hideSchemaTitles && <TypeTitle> ({schema.title}) </TypeTitle>}
<ConstraintsView constraints={schema.constraints} />
{schema.nullable && <NullableLabel> {l('nullable')} </NullableLabel>}
{schema.pattern && <PatternLabel> {schema.pattern} </PatternLabel>}
Expand Down
3 changes: 3 additions & 0 deletions src/services/RedocNormalizedOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export interface RedocRawOptions {
hideSingleRequestSampleTab?: boolean | string;
menuToggle?: boolean | string;
jsonSampleExpandLevel?: number | string | 'all';
hideSchemaTitles?: boolean | string;

unstable_ignoreMimeParameters?: boolean;

Expand Down Expand Up @@ -144,6 +145,7 @@ export class RedocNormalizedOptions {
menuToggle: boolean;
jsonSampleExpandLevel: number;
enumSkipQuotes: boolean;
hideSchemaTitles: boolean;

/* tslint:disable-next-line */
unstable_ignoreMimeParameters: boolean;
Expand Down Expand Up @@ -182,6 +184,7 @@ export class RedocNormalizedOptions {
raw.jsonSampleExpandLevel,
);
this.enumSkipQuotes = argValueToBoolean(raw.enumSkipQuotes);
this.hideSchemaTitles = argValueToBoolean(raw.hideSchemaTitles);

this.unstable_ignoreMimeParameters = argValueToBoolean(raw.unstable_ignoreMimeParameters);

Expand Down

0 comments on commit 11cc4c4

Please sign in to comment.