Skip to content

Commit 2f487aa

Browse files
committed
Remove duplicated infos
1 parent 3c4b418 commit 2f487aa

File tree

1 file changed

+38
-33
lines changed

1 file changed

+38
-33
lines changed

packages/react-openapi/src/OpenAPISchema.tsx

Lines changed: 38 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -388,39 +388,44 @@ export function OpenAPISchemaPresentation(props: {
388388
required={required}
389389
context={context}
390390
/>
391-
{circularRefId ? <OpenAPISchemaCircularRef id={circularRefId} schema={schema} /> : null}
392-
{typeof schema['x-deprecated-sunset'] === 'string' ? (
393-
<div className="openapi-deprecated-sunset openapi-schema-description openapi-markdown">
394-
Sunset date:{' '}
395-
<span className="openapi-deprecated-sunset-date">
396-
{schema['x-deprecated-sunset']}
397-
</span>
398-
</div>
399-
) : null}
400-
{description ? (
401-
<Markdown source={description} className="openapi-schema-description" />
402-
) : null}
403-
{schema.default !== undefined ? (
404-
<span className="openapi-schema-default">
405-
Default:{' '}
406-
<code>
407-
{typeof schema.default === 'string' && schema.default
408-
? schema.default
409-
: stringifyOpenAPI(schema.default)}
410-
</code>
411-
</span>
412-
) : null}
413-
{typeof example === 'string' ? (
414-
<span className="openapi-schema-example">
415-
Example: <code>{example}</code>
416-
</span>
417-
) : null}
418-
{schema.pattern ? (
419-
<span className="openapi-schema-pattern">
420-
Pattern: <code>{schema.pattern}</code>
421-
</span>
422-
) : null}
423-
<OpenAPISchemaEnum schema={schema} context={context} />
391+
{circularRefId ? (
392+
<OpenAPISchemaCircularRef id={circularRefId} schema={schema} />
393+
) : (
394+
<>
395+
{typeof schema['x-deprecated-sunset'] === 'string' ? (
396+
<div className="openapi-deprecated-sunset openapi-schema-description openapi-markdown">
397+
Sunset date:{' '}
398+
<span className="openapi-deprecated-sunset-date">
399+
{schema['x-deprecated-sunset']}
400+
</span>
401+
</div>
402+
) : null}
403+
{description ? (
404+
<Markdown source={description} className="openapi-schema-description" />
405+
) : null}
406+
{schema.default !== undefined ? (
407+
<span className="openapi-schema-default">
408+
Default:{' '}
409+
<code>
410+
{typeof schema.default === 'string' && schema.default
411+
? schema.default
412+
: stringifyOpenAPI(schema.default)}
413+
</code>
414+
</span>
415+
) : null}
416+
{typeof example === 'string' ? (
417+
<span className="openapi-schema-example">
418+
Example: <code>{example}</code>
419+
</span>
420+
) : null}
421+
{schema.pattern ? (
422+
<span className="openapi-schema-pattern">
423+
Pattern: <code>{schema.pattern}</code>
424+
</span>
425+
) : null}
426+
<OpenAPISchemaEnum schema={schema} context={context} />
427+
</>
428+
)}
424429
</div>
425430
);
426431
}

0 commit comments

Comments
 (0)