mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-12 05:48:57 +00:00
Remove read-only properties from codesample (#2965)
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@gitbook/react-openapi': patch
|
||||
---
|
||||
|
||||
Remove read-only properties from codesample
|
||||
@@ -26,13 +26,17 @@ export function OpenAPICodeSample(props: {
|
||||
}
|
||||
|
||||
if (param.in === 'header' && param.required) {
|
||||
const example = param.schema ? generateSchemaExample(param.schema) : undefined;
|
||||
const example = param.schema
|
||||
? generateSchemaExample(param.schema, { mode: 'write' })
|
||||
: undefined;
|
||||
if (example !== undefined && param.name) {
|
||||
headersObject[param.name] =
|
||||
typeof example !== 'string' ? stringifyOpenAPI(example) : example;
|
||||
}
|
||||
} else if (param.in === 'query' && param.required) {
|
||||
const example = param.schema ? generateSchemaExample(param.schema) : undefined;
|
||||
const example = param.schema
|
||||
? generateSchemaExample(param.schema, { mode: 'write' })
|
||||
: undefined;
|
||||
if (example !== undefined && param.name) {
|
||||
searchParams.append(
|
||||
param.name,
|
||||
|
||||
Reference in New Issue
Block a user