Skip to content

Commit 3a1796a

Browse files
committed
Merge branch 'main' into support-schema-property-examples-extract
2 parents 1591b79 + b0d2b7d commit 3a1796a

File tree

42 files changed

+856
-551
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+856
-551
lines changed

.github/workflows/deploy-live.yml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ jobs:
3939
name: Deploy
4040
needs: build
4141
runs-on: ubuntu-latest
42+
permissions:
43+
id-token: write
4244

4345
steps:
4446
- name: Checkout repository
@@ -50,6 +52,16 @@ jobs:
5052
node-version: "20"
5153
cache: "yarn"
5254

55+
- name: Authenticate to Google Cloud
56+
id: auth
57+
uses: google-github-actions/auth@b7593ed2efd1c1617e1b0254da33b86225adb2a5
58+
with:
59+
workload_identity_provider: ${{ secrets.WIF_PROVIDER }}
60+
service_account: ${{ secrets.WIF_SERVICE_ACCOUNT }}
61+
62+
- name: Export Google Cloud Credentials
63+
run: echo "GCP_SA_KEY=$(cat ${{ steps.auth.outputs.credentials_file_path }})" >> $GITHUB_ENV
64+
5365
- uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e # v4
5466
with:
5567
name: build
@@ -59,10 +71,10 @@ jobs:
5971

6072
- name: Deploy to Firebase
6173
id: deploy_live
62-
uses: FirebaseExtended/action-hosting-deploy@0cbcac4740c2bfb00d632f0b863b57713124eb5a # v0.9.0
74+
uses: FirebaseExtended/action-hosting-deploy@e2eda2e106cfa35cdbcf4ac9ddaf6c4756df2c8c # v0.10.0
6375
with:
6476
repoToken: "${{ secrets.GITHUB_TOKEN }}"
65-
firebaseServiceAccount: "${{ secrets.FIREBASE_SERVICE_ACCOUNT_PANDEV }}"
77+
firebaseServiceAccount: "${{ env.GCP_SA_KEY }}"
6678
projectId: pandev
6779
channelId: live
6880
target: docusaurus-openapi.tryingpan.dev

.github/workflows/deploy-preview.yml

Lines changed: 14 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: "Deploy Preview"
22

33
on:
44
pull_request_target:
5-
branches: [main, v3.0.0, v2.0.0]
5+
branches: [main]
66

77
jobs:
88
precheck:
@@ -130,6 +130,7 @@ jobs:
130130
contents: read
131131
pull-requests: write
132132
checks: write
133+
id-token: write
133134
outputs:
134135
preview_url: ${{ steps.deploy_preview.outputs.details_url }}
135136

@@ -143,6 +144,16 @@ jobs:
143144
node-version: "20"
144145
cache: "yarn"
145146

147+
- name: Authenticate to Google Cloud
148+
id: auth
149+
uses: google-github-actions/auth@b7593ed2efd1c1617e1b0254da33b86225adb2a5
150+
with:
151+
workload_identity_provider: ${{ secrets.WIF_PROVIDER }}
152+
service_account: ${{ secrets.WIF_SERVICE_ACCOUNT }}
153+
154+
- name: Export Google Cloud Credentials
155+
run: echo "GCP_SA_KEY=$(cat ${{ steps.auth.outputs.credentials_file_path }})" >> $GITHUB_ENV
156+
146157
- uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e # v4
147158
with:
148159
name: build
@@ -152,10 +163,10 @@ jobs:
152163

153164
- name: Deploy to Firebase
154165
id: deploy_preview
155-
uses: FirebaseExtended/action-hosting-deploy@0cbcac4740c2bfb00d632f0b863b57713124eb5a # v0.9.0
166+
uses: FirebaseExtended/action-hosting-deploy@e2eda2e106cfa35cdbcf4ac9ddaf6c4756df2c8c # v0.10.0
156167
with:
157168
repoToken: "${{ secrets.GITHUB_TOKEN }}"
158-
firebaseServiceAccount: "${{ secrets.FIREBASE_SERVICE_ACCOUNT_PANDEV }}"
169+
firebaseServiceAccount: "${{ env.GCP_SA_KEY }}"
159170
projectId: pandev
160171
expires: 30d
161172
channelId: "pr${{ github.event.number }}"
@@ -199,28 +210,3 @@ jobs:
199210
with:
200211
name: visual_diffs
201212
path: visual_diffs
202-
203-
# - name: Comment PR with results
204-
# if: github.event_name == 'pull_request' || github.event_name == 'pull_request_target'
205-
# uses: actions/github-script@v7
206-
# with:
207-
# github-token: ${{ secrets.GITHUB_TOKEN }}
208-
# script: |
209-
# const fs = require('fs');
210-
# const results = JSON.parse(fs.readFileSync('visual_diffs/results.json', 'utf8'));
211-
# const runUrl = `${process.env.GITHUB_SERVER_URL}/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}`;
212-
# let body = `### Visual Diff Summary\n\n[View Logs](${runUrl})\n\n`;
213-
# body += `Total: ${results.summary.total}, Matches: ${results.summary.matches}, Diffs: ${results.summary.mismatches}, Skipped: ${results.summary.skipped}\n\n`;
214-
# if (results.pages.length) {
215-
# body += '| Page | Status |\n| --- | --- |\n';
216-
# for (const p of results.pages) {
217-
# if (p.status !== 'match') {
218-
# body += `| ${p.path} | ${p.status} |\n`;
219-
# }
220-
# }
221-
# }
222-
# await github.rest.issues.createComment({
223-
# ...context.repo,
224-
# issue_number: context.issue.number,
225-
# body
226-
# });

demo/customMdGenerators.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ export function myCustomApiMdGenerator({
4949
`import StatusCodes from "@theme/StatusCodes";\n`,
5050
`import OperationTabs from "@theme/OperationTabs";\n`,
5151
`import TabItem from "@theme/TabItem";\n`,
52-
`import Heading from "@theme/Heading";\n\n`,
52+
`import Heading from "@theme/Heading";\n`,
53+
`import Translate from "@docusaurus/Translate";\n\n`,
5354
createHeading(title),
5455
createMethodEndpoint(method, path),
5556
createServersTable(servers),

packages/docusaurus-plugin-openapi-docs/src/markdown/createRequestHeader.ts

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,14 @@ import { create } from "./utils";
99

1010
export function createRequestHeader(header: string) {
1111
return [
12-
create(
13-
"Heading",
14-
{
15-
children: header,
16-
id: header.replace(" ", "-").toLowerCase(),
17-
as: "h2",
18-
className: "openapi-tabs__heading",
19-
},
20-
{ inline: true }
21-
),
22-
`\n\n`,
12+
create("Heading", {
13+
id: header.replace(" ", "-").toLowerCase(),
14+
as: "h2",
15+
className: "openapi-tabs__heading",
16+
children: [
17+
`<Translate id="theme.openapi.request.title">${header}</Translate>`,
18+
],
19+
}),
20+
"\n\n",
2321
];
2422
}

packages/docusaurus-plugin-openapi-docs/src/markdown/createSchema.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,8 @@ function createDetailsNode(
375375
() => [
376376
create("span", {
377377
className: "openapi-schema__required",
378-
children: "required",
378+
children:
379+
"<Translate id='theme.openapi.schemaItem.required'>required</Translate>",
379380
}),
380381
]
381382
),
@@ -530,7 +531,8 @@ function createPropertyDiscriminator(
530531
guard(required, () => [
531532
create("span", {
532533
className: "openapi-schema__required",
533-
children: "required",
534+
children:
535+
"<Translate id='theme.openapi.schemaItem.required'>required</Translate>",
534536
}),
535537
]),
536538
],

packages/docusaurus-plugin-openapi-docs/src/markdown/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ export function createApiPageMD({
7272
`import StatusCodes from "@theme/StatusCodes";\n`,
7373
`import OperationTabs from "@theme/OperationTabs";\n`,
7474
`import TabItem from "@theme/TabItem";\n`,
75-
`import Heading from "@theme/Heading";\n\n`,
75+
`import Heading from "@theme/Heading";\n`,
76+
`import Translate from "@docusaurus/Translate";\n\n`,
7677
createHeading(title),
7778
createMethodEndpoint(method, path),
7879
infoPath && createAuthorization(infoPath),

packages/docusaurus-plugin-openapi-docs/src/plugin-content-docs-types.d.ts

Lines changed: 0 additions & 42 deletions
This file was deleted.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import type { FrontMatter as DocsFrontMatter } from "@docusaurus/types";
1111
import type { Props as DocsProps } from "@docusaurus/types";
1212

1313
declare module "docusaurus-plugin-openapi-docs" {
14-
import type { PropSidebars } from "@docusaurus/plugin-content-docs-types";
14+
import type { PropSidebars } from "@docusaurus/plugin-content-docs/lib/sidebars/types";
1515

1616
export type Options = Partial<import("./types").APIOptions>;
1717

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* LICENSE file in the root directory of this source tree.
66
* ========================================================================== */
77

8-
import { SidebarItemDoc } from "@docusaurus/plugin-content-docs/src/sidebars/types";
8+
import type { SidebarItemDoc } from "@docusaurus/plugin-content-docs/lib/sidebars/types";
99
import Request from "postman-collection";
1010

1111
import {
@@ -21,7 +21,7 @@ export type {
2121
SidebarItemLink,
2222
PropSidebar,
2323
PropSidebarItem,
24-
} from "@docusaurus/plugin-content-docs-types";
24+
} from "@docusaurus/plugin-content-docs/lib/sidebars/types";
2525
export interface PluginOptions {
2626
id?: string;
2727
docsPlugin?: string;

packages/docusaurus-theme-openapi-docs/src/markdown/schema.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
* LICENSE file in the root directory of this source tree.
66
* ========================================================================== */
77

8+
import { translate } from "@docusaurus/Translate";
9+
import { OPENAPI_SCHEMA_ITEM } from "../theme/translationIds";
810
import { SchemaObject } from "../types";
911

1012
function prettyName(schema: SchemaObject, circular?: boolean) {
@@ -72,7 +74,10 @@ export function getQualifierMessage(schema?: SchemaObject): string | undefined {
7274
return getQualifierMessage(schema.items);
7375
}
7476

75-
let message = "**Possible values:** ";
77+
let message = `**${translate({
78+
id: OPENAPI_SCHEMA_ITEM.POSSIBLE_VALUES,
79+
message: "Possible values:",
80+
})}** `;
7681

7782
let qualifierGroups = [];
7883

0 commit comments

Comments
 (0)