Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Each service documents its own endpoints and behaviour:
| Extensions | `/extensions/v1`, `/extensions/v2` | [`src/services/extensions/v2/README.md`](src/services/extensions/v2/README.md) |
| Previews | `/previews/v1` | [`src/services/previews/v1/README.md`](src/services/previews/v1/README.md) |

Extensions v2 and Previews v1 also publish a live OpenAPI document (`/extensions/v2/openapi.json`, `/previews/v1/openapi.json`) and a reference UI (`/extensions/v2/docs`, `/previews/v1/docs`).
Extensions v2 and Previews v1 also publish a live OpenAPI document (`/extensions/v2/docs/openapi.json`, `/previews/v1/docs/openapi.json`) and a reference UI (`/extensions/v2/docs`, `/previews/v1/docs`).

## Configuration

Expand Down
88 changes: 44 additions & 44 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/services/extensions/v2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ This service owns the complete Extensions domain and its `DB_EXTENSIONS` schema:

Endpoints are not listed here. The service publishes its own contract:

- **OpenAPI document:** `GET /extensions/v2/openapi.json`
- **OpenAPI document:** `GET /extensions/v2/docs/openapi.json`
- **Reference UI:** `GET /extensions/v2/docs`

## The Extension Lifecycle
Expand Down
28 changes: 14 additions & 14 deletions src/services/extensions/v2/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,21 +57,20 @@ registerModerationRoutes(extensionsV2);
// are covered by the same migration 0020 check.
registerDeveloperProfileRoutes(extensionsV2);

extensionsV2.doc31("/openapi.json", {
openapi: "3.1.0",
info: {
title: "FOSSBilling Extensions API (v2)",
version: "2.0.0",
description:
"Self-service extension publishing, ownership, moderation, and public browsing. v1 (/extensions/v1) remains available for existing integrations."
},
servers: [{ url: "/extensions/v2" }]
});

extensionsV2.get(
extensionsV2.route(
"/docs",
Scalar({
url: "/extensions/v2/openapi.json",
Scalar.serve({
document: () =>
extensionsV2.getOpenAPI31Document({
Comment thread
admdly marked this conversation as resolved.
openapi: "3.1.0",
info: {
title: "FOSSBilling Extensions API (v2)",
version: "2.0.0",
description:
"Self-service extension publishing, ownership, moderation, and public browsing. v1 (/extensions/v1) remains available for existing integrations."
},
servers: [{ url: "/extensions/v2" }],
}),
pageTitle: "FOSSBilling Extensions API (v2)",
agent: { disabled: true },
documentDownloadType: "none",
Expand All @@ -86,6 +85,7 @@ extensionsV2.get(
go: true,
java: true,
js: ["axios", "jquery", "ofetch"],
julia: true,
kotlin: true,
node: ["axios", "ofetch", "undici"],
objc: true,
Expand Down
2 changes: 1 addition & 1 deletion src/services/previews/v1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ it only resolves and redirects.

Endpoints are not listed here. The service publishes its own contract:

- **OpenAPI document:** `GET /previews/v1/openapi.json`
- **OpenAPI document:** `GET /previews/v1/docs/openapi.json`
- **Reference UI:** `GET /previews/v1/docs`

## Resource Model
Expand Down
50 changes: 36 additions & 14 deletions src/services/previews/v1/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,26 +30,48 @@ registerMainRoutes(previewsV1);
registerPrRoutes(previewsV1);
registerCommitRoutes(previewsV1);

previewsV1.doc31("/openapi.json", {
openapi: "3.1.0",
info: {
title: "FOSSBilling Previews API (v1)",
version: "1.0.0",
description:
"Read-only lookup of FOSSBilling preview builds - the current main preview and per-PR/per-commit builds produced by FOSSBilling/FOSSBilling's GitHub Actions workflows."
},
servers: [{ url: "/previews/v1" }]
});

previewsV1.get(
previewsV1.route(
Comment thread
admdly marked this conversation as resolved.
"/docs",
Scalar({
url: "/previews/v1/openapi.json",
Scalar.serve({
document: () =>
previewsV1.getOpenAPI31Document({
openapi: "3.1.0",
info: {
title: "FOSSBilling Previews API (v1)",
version: "1.0.0",
description:
"Read-only lookup of FOSSBilling preview builds - the current main preview and per-PR/per-commit builds produced by FOSSBilling/FOSSBilling's GitHub Actions workflows."
},
servers: [{ url: "/previews/v1" }]
}),
pageTitle: "FOSSBilling Previews API (v1)",
agent: { disabled: true },
documentDownloadType: "none",
hideClientButton: true,
hideModels: true,
hiddenClients: {
c: true,
clojure: true,
csharp: true,
dart: true,
fsharp: true,
go: true,
java: true,
js: ["axios", "jquery", "ofetch"],
julia: true,
kotlin: true,
node: ["axios", "ofetch", "undici"],
objc: true,
ocaml: true,
php: ["guzzle", "laravel"],
powershell: true,
python: true,
r: true,
ruby: true,
rust: true,
shell: ["httpie"],
swift: true
},
telemetry: false
})
);
Expand Down
2 changes: 1 addition & 1 deletion test/services/extensions/v2/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ setupExtensionsV2Tests();
describe("Extensions API v2", () => {
describe("OpenAPI docs", () => {
it("serves a generated OpenAPI document", async () => {
const res = await get("/extensions/v2/openapi.json", {});
const res = await get("/extensions/v2/docs/openapi.json", {});
expect(res.status).toBe(200);
const spec = (await res.json()) as {
openapi: string;
Expand Down
Loading
Loading