Skip to content

Commit 378dbfe

Browse files
committed
Merge branch 'main' into steeve/rnd-8131-adapt-openapi-code-samples-to-inject-api-key-when-provided
2 parents 1402fc5 + 8e99871 commit 378dbfe

File tree

20 files changed

+169
-90
lines changed

20 files changed

+169
-90
lines changed

.changeset/dirty-mice-sleep.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@gitbook/react-openapi": patch
3+
"gitbook": patch
4+
---
5+
6+
Highlight discriminator properties in oneOf, allOf, anyOf objects
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"gitbook": minor
3+
---
4+
5+
Move inline expression evaluation from API to GBO

.changeset/mighty-bears-type.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"gitbook": patch
3+
---
4+
5+
Fix rounded outline items

bun.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@
304304
"react-dom": "^19.0.0",
305305
},
306306
"catalog": {
307-
"@gitbook/api": "^0.142.0",
307+
"@gitbook/api": "0.143.1",
308308
"bidc": "^0.0.2",
309309
},
310310
"packages": {
@@ -676,7 +676,7 @@
676676

677677
"@fortawesome/fontawesome-svg-core": ["@fortawesome/fontawesome-svg-core@6.6.0", "", { "dependencies": { "@fortawesome/fontawesome-common-types": "6.6.0" } }, "sha512-KHwPkCk6oRT4HADE7smhfsKudt9N/9lm6EJ5BVg0tD1yPA5hht837fB87F8pn15D8JfTqQOjhKTktwmLMiD7Kg=="],
678678

679-
"@gitbook/api": ["@gitbook/api@0.142.0", "", { "dependencies": { "event-iterator": "^2.0.0", "eventsource-parser": "^3.0.0" } }, "sha512-Lq1IbepAykHNG8y0fBvC7hQj3i/f1XATX58wLYXWCL3W1x6Z9f6Rs5K2qCOONswJh3l2NrX3ujrbxx3D8goRdw=="],
679+
"@gitbook/api": ["@gitbook/api@0.143.1", "", { "dependencies": { "event-iterator": "^2.0.0", "eventsource-parser": "^3.0.0" } }, "sha512-5k7PnMe9W8EhmSejqayCbAIIJDGB4C2m+o6+dD+asmlv+6jE/LqoxuAvbP8o+kG83tMnbsr5I5d73B/9cAYbag=="],
680680

681681
"@gitbook/browser-types": ["@gitbook/browser-types@workspace:packages/browser-types"],
682682

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"workspaces": {
3535
"packages": ["packages/*"],
3636
"catalog": {
37-
"@gitbook/api": "^0.142.0",
37+
"@gitbook/api": "0.143.1",
3838
"bidc": "^0.0.2"
3939
}
4040
},

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@
192192
.openapi-schema-name {
193193
/* To make double click on the property name select only the name,
194194
we disable selection on the parent and re-enable it on the children. */
195-
@apply select-none text-sm text-balance *:whitespace-nowrap flex flex-wrap gap-y-1.5 gap-x-2.5;
195+
@apply select-none text-sm text-balance *:whitespace-nowrap flex flex-wrap gap-y-1.5 gap-x-2.5 items-center;
196196
}
197197

198198
.openapi-schema-name .openapi-deprecated {
@@ -207,6 +207,10 @@
207207
@apply line-through opacity-9;
208208
}
209209

210+
.openapi-schema-discriminator {
211+
@apply text-primary-subtle/9 text-[0.813rem] lowercase;
212+
}
213+
210214
.openapi-schema-required {
211215
@apply text-warning-subtle text-[0.813rem] lowercase;
212216
}

packages/gitbook/src/components/PageAside/ScrollSectionsList.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ export function ScrollSectionsList({ sections }: { sections: DocumentSection[] }
110110
'opacity-8',
111111
'contrast-more:opacity-11',
112112

113-
'sidebar-list-default:rounded-l-none',
113+
'sidebar-list-default:rounded-l-none!',
114114
'sidebar-list-default:border-l',
115115
'sidebar-list-default:border-tint',
116116
],

packages/gitbook/src/lib/data/api.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ const getRevisionPageDocument = cache(
344344
params.revisionId,
345345
params.pageId,
346346
{
347-
evaluated: true,
347+
evaluated: 'deterministic-only',
348348
},
349349
{
350350
...noCacheFetchOptions,
@@ -377,7 +377,7 @@ const getRevisionReusableContentDocument = cache(
377377
params.revisionId,
378378
params.reusableContentId,
379379
{
380-
evaluated: true,
380+
evaluated: 'deterministic-only',
381381
},
382382
{
383383
...noCacheFetchOptions,

packages/react-openapi/src/OpenAPISchema.test.ts

Lines changed: 72 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,20 @@ describe('getSchemaAlternatives', () => {
2222
},
2323
],
2424
})
25-
).toEqual([
26-
{
27-
type: 'number',
28-
},
29-
{
30-
type: 'boolean',
31-
},
32-
{
33-
type: 'string',
34-
},
35-
]);
25+
).toEqual({
26+
type: 'oneOf',
27+
schemas: [
28+
{
29+
type: 'number',
30+
},
31+
{
32+
type: 'boolean',
33+
},
34+
{
35+
type: 'string',
36+
},
37+
],
38+
});
3639
});
3740

3841
it('merges string enum', () => {
@@ -54,13 +57,16 @@ describe('getSchemaAlternatives', () => {
5457
},
5558
],
5659
})
57-
).toEqual([
58-
{
59-
type: 'string',
60-
enum: ['a', 'b', 'c', 'd'],
61-
nullable: true,
62-
},
63-
]);
60+
).toEqual({
61+
type: 'oneOf',
62+
schemas: [
63+
{
64+
type: 'string',
65+
enum: ['a', 'b', 'c', 'd'],
66+
nullable: true,
67+
},
68+
],
69+
});
6470
});
6571

6672
it('merges objects with allOf', () => {
@@ -93,26 +99,29 @@ describe('getSchemaAlternatives', () => {
9399
},
94100
],
95101
})
96-
).toEqual([
97-
{
98-
type: 'object',
99-
properties: {
100-
name: {
101-
type: 'string',
102-
},
103-
map: {
104-
type: 'string',
105-
},
106-
description: {
107-
type: 'string',
108-
},
109-
externalId: {
110-
type: 'string',
102+
).toEqual({
103+
type: 'allOf',
104+
schemas: [
105+
{
106+
type: 'object',
107+
properties: {
108+
name: {
109+
type: 'string',
110+
},
111+
map: {
112+
type: 'string',
113+
},
114+
description: {
115+
type: 'string',
116+
},
117+
externalId: {
118+
type: 'string',
119+
},
111120
},
121+
required: ['name', 'map', 'externalId'],
112122
},
113-
required: ['name', 'map', 'externalId'],
114-
},
115-
]);
123+
],
124+
});
116125
});
117126

118127
it('should not flatten oneOf and allOf', () => {
@@ -134,21 +143,24 @@ describe('getSchemaAlternatives', () => {
134143
},
135144
],
136145
})
137-
).toEqual([
138-
{
139-
allOf: [
140-
{
141-
type: 'number',
142-
},
143-
{
144-
type: 'boolean',
145-
},
146-
],
147-
},
148-
{
149-
type: 'string',
150-
},
151-
]);
146+
).toEqual({
147+
type: 'oneOf',
148+
schemas: [
149+
{
150+
allOf: [
151+
{
152+
type: 'number',
153+
},
154+
{
155+
type: 'boolean',
156+
},
157+
],
158+
},
159+
{
160+
type: 'string',
161+
},
162+
],
163+
});
152164
});
153165

154166
it('should stop at circular references', () => {
@@ -162,11 +174,14 @@ describe('getSchemaAlternatives', () => {
162174

163175
a.anyOf?.push(a);
164176

165-
expect(getSchemaAlternatives(a)).toEqual([
166-
{
167-
type: 'string',
168-
},
169-
a,
170-
]);
177+
expect(getSchemaAlternatives(a)).toEqual({
178+
type: 'anyOf',
179+
schemas: [
180+
{
181+
type: 'string',
182+
},
183+
a,
184+
],
185+
});
171186
});
172187
});

0 commit comments

Comments
 (0)