diff --git a/.changeset/two-colts-help.md b/.changeset/two-colts-help.md new file mode 100644 index 000000000..77ef44275 --- /dev/null +++ b/.changeset/two-colts-help.md @@ -0,0 +1,5 @@ +--- +"@gitbook/react-openapi": patch +--- + +Hide deprecated properties in examples diff --git a/packages/react-openapi/src/generateSchemaExample.ts b/packages/react-openapi/src/generateSchemaExample.ts index d1153afb6..37695b9fe 100644 --- a/packages/react-openapi/src/generateSchemaExample.ts +++ b/packages/react-openapi/src/generateSchemaExample.ts @@ -166,6 +166,11 @@ const getExampleFromSchema = ( // But if `emptyString` is set, we do want to see some values. const makeUpRandomData = !!options?.emptyString; + // If the property is deprecated we don't show it in examples. + if (schema.deprecated) { + return undefined; + } + // Check if the property is read-only/write-only if ( (options?.mode === 'write' && schema.readOnly) ||