Skip to content

Commit c60e9ba

Browse files
authored
Handle OpenAPI read-only properties (#2962)
1 parent 9bc3d50 commit c60e9ba

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

.changeset/gold-olives-build.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@gitbook/react-openapi': patch
3+
---
4+
5+
Handle read-only in OpenAPISchemaName

packages/gitbook/src/components/DocumentView/OpenAPI/style.css

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,11 @@
198198
}
199199

200200
.openapi-schema-required {
201-
@apply text-amber-600 text-[0.813rem];
201+
@apply text-warning-subtle text-[0.813rem];
202+
}
203+
204+
.openapi-schema-readonly {
205+
@apply text-primary-subtle/9 text-[0.813rem];
202206
}
203207

204208
.openapi-schema-type {

packages/react-openapi/src/OpenAPISchemaName.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ export function OpenAPISchemaName(props: OpenAPISchemaNameProps) {
3030
<span className="openapi-schema-type">{additionalItems}</span>
3131
) : null}
3232
</span>
33+
{schema?.readOnly ? <span className="openapi-schema-readonly">read-only</span> : null}
3334
{required ? <span className="openapi-schema-required">required</span> : null}
3435
{schema?.deprecated ? <span className="openapi-deprecated">Deprecated</span> : null}
3536
</div>

0 commit comments

Comments
 (0)