Skip to content

Commit d0fbbd5

Browse files
authored
[Bug] Respect readOnly/writeOnly when creating example from schema (#353)
* Respect readOnly/writeOnly when creating example from schema * Remove unused import
1 parent fa898d0 commit d0fbbd5

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

packages/docusaurus-plugin-openapi-docs/src/openapi/createRequestExample.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,10 @@ export const sampleRequestFromSchema = (schema: SchemaObject = {}): any => {
135135
}
136136
}
137137

138+
if (prop.readOnly && prop.readOnly === true) {
139+
continue;
140+
}
141+
138142
if (prop.deprecated) {
139143
continue;
140144
}

packages/docusaurus-plugin-openapi-docs/src/openapi/createResponseExample.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,10 @@ export const sampleResponseFromSchema = (schema: SchemaObject = {}): any => {
135135
}
136136
}
137137

138+
if (prop.writeOnly && prop.writeOnly === true) {
139+
continue;
140+
}
141+
138142
if (prop.deprecated) {
139143
continue;
140144
}

0 commit comments

Comments
 (0)