mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-16 15:45:13 +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) {
|
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) {
|
if (example !== undefined && param.name) {
|
||||||
headersObject[param.name] =
|
headersObject[param.name] =
|
||||||
typeof example !== 'string' ? stringifyOpenAPI(example) : example;
|
typeof example !== 'string' ? stringifyOpenAPI(example) : example;
|
||||||
}
|
}
|
||||||
} else if (param.in === 'query' && param.required) {
|
} 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) {
|
if (example !== undefined && param.name) {
|
||||||
searchParams.append(
|
searchParams.append(
|
||||||
param.name,
|
param.name,
|
||||||
|
|||||||
Reference in New Issue
Block a user