Skip to content

Commit

Permalink
First version of openapi.yml (#413)
Browse files Browse the repository at this point in the history
* first version of openapi.yml

* add swagger-ui

* fix version

* add documentation to app build docker stage

* linted the yaml

* remove console.log
  • Loading branch information
jbr authored Aug 16, 2023
1 parent 8640a02 commit 805b789
Show file tree
Hide file tree
Showing 8 changed files with 2,830 additions and 45 deletions.
1 change: 1 addition & 0 deletions .spectral.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
extends: ["spectral:oas", "spectral:asyncapi"]
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ FROM node:alpine as assets
WORKDIR /src/app
COPY app/package.json /src/app/package.json
COPY app/package-lock.json /src/app/package-lock.json
COPY documentation /src/documentation
RUN npm ci
COPY app /src/app
RUN npm ci
Expand Down
1,929 changes: 1,884 additions & 45 deletions app/package-lock.json

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"react-router": "^6.14.2",
"react-router-bootstrap": "^0.26.2",
"react-router-dom": "^6.15.0",
"swagger-ui-react": "^5.3.2",
"use-interval": "^1.4.0",
"web-vitals": "^3.4.0"
},
Expand Down Expand Up @@ -60,6 +61,7 @@
"@types/react-router": "^5.1.20",
"@types/react-router-bootstrap": "^0.26.2",
"@types/react-router-dom": "^5.3.3",
"@types/swagger-ui-react": "^4.18.0",
"@typescript-eslint/eslint-plugin": "^6.4.0",
"@typescript-eslint/parser": "^6.4.0",
"@vitejs/plugin-react": "^4.0.4",
Expand Down
1 change: 1 addition & 0 deletions app/public/swagger.yml
2 changes: 2 additions & 0 deletions app/src/router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@ import { Spinner } from "react-bootstrap";
import queue from "./queue";
import sharedAggregators from "./shared-aggregators";
import hpkeConfigs from "./hpke-configs";
import swaggerUi from "./swagger-ui";

function buildRouter(apiClient: ApiClient) {
return createBrowserRouter([
swaggerUi(),
layout(apiClient, [
logout(apiClient),
root(apiClient),
Expand Down
16 changes: 16 additions & 0 deletions app/src/swagger-ui.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { RouteObject } from "react-router-dom";

export default function swaggerUi(): RouteObject {
return {
path: "swagger-ui",
async lazy() {
const { default: SwaggerUI } = await import("swagger-ui-react");
await import("swagger-ui-react/swagger-ui.css");
return {
Component() {
return <SwaggerUI url="/swagger.yml" supportedSubmitMethods={[]} />;
},
};
},
};
}
Loading

0 comments on commit 805b789

Please sign in to comment.