Skip to content

Commit 23cedd2

Browse files
authored
Hide deprecated properties in examples (#3085)
1 parent 70c4182 commit 23cedd2

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

Diff for: .changeset/two-colts-help.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@gitbook/react-openapi": patch
3+
---
4+
5+
Hide deprecated properties in examples

Diff for: packages/react-openapi/src/generateSchemaExample.ts

+5
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,11 @@ const getExampleFromSchema = (
166166
// But if `emptyString` is set, we do want to see some values.
167167
const makeUpRandomData = !!options?.emptyString;
168168

169+
// If the property is deprecated we don't show it in examples.
170+
if (schema.deprecated) {
171+
return undefined;
172+
}
173+
169174
// Check if the property is read-only/write-only
170175
if (
171176
(options?.mode === 'write' && schema.readOnly) ||

0 commit comments

Comments
 (0)