fix openapi library generator

master
Lea 2023-07-18 16:29:57 +02:00
parent c12c83ee90
commit a505d6e09c
9 changed files with 53 additions and 8 deletions

3
.gitmodules vendored
View File

@ -5,3 +5,6 @@
[submodule "external/translations"]
path = external/translations
url = https://git.amogus.cloud/automod/translations
[submodule "external/oapi"]
path = external/oapi
url = https://github.com/sussycatgirl/oapi

View File

@ -16,6 +16,10 @@
{
"name": "api",
"commands": ["cd api", "pnpm run start:dev"]
},
{
"name": "web",
"commands": ["cd web", "pnpm run dev"]
}
]
},

1
external/oapi vendored Submodule

@ -0,0 +1 @@
Subproject commit be9181459923f389ca4d8c48aa5ff55a70795e10

@ -1 +1 @@
Subproject commit 756654a64bbbed42a5eeb39d4a43e40455fa96ba
Subproject commit 39c74ecd024239413a03a6b483f556518d593945

View File

@ -2,7 +2,7 @@
"name": "oapilib",
"version": "1.0.0",
"description": "",
"main": "index.js",
"main": "dist/index.js",
"scripts": {
"build": "oapilib && tsc",
"build:watch": "nodemon -w ./OpenAPI.json --exec pnpm run build"
@ -11,7 +11,7 @@
"author": "",
"license": "ISC",
"dependencies": {
"@insertish/oapi": "^0.1.18",
"@insertish/oapi": "workspace:*",
"axios": "^1.4.0",
"lodash.defaultsdeep": "^4.6.1"
},

View File

@ -60,6 +60,7 @@ export function getPathName(anyPath: string) {
authentication: {
rauth?: string | undefined;
revolt?: { token: string } | string | undefined;
headers?: AxiosRequestConfig['headers'] | undefined;
};
}
@ -104,6 +105,8 @@ export class API {
}
}
}
} else if (this.authentication.headers) {
return { headers: this.authentication.headers };
}
return { };

View File

@ -185,6 +185,23 @@ importers:
specifier: ^5.0.3
version: 5.1.3
external/oapi:
dependencies:
typescript:
specifier: ^4.6.2
version: 4.9.5
optionalDependencies:
axios:
specifier: ^0.26.1
version: 0.26.1
openapi-typescript:
specifier: ^5.2.0
version: 5.4.1
devDependencies:
'@types/lodash.defaultsdeep':
specifier: ^4.6.6
version: 4.6.7
external/revolt.js:
dependencies:
'@mxssfd/typedoc-theme':
@ -304,8 +321,8 @@ importers:
oapilib:
dependencies:
'@insertish/oapi':
specifier: ^0.1.18
version: 0.1.18
specifier: workspace:*
version: link:../external/oapi
axios:
specifier: ^1.4.0
version: 1.4.0
@ -346,9 +363,15 @@ importers:
eslint-config-next:
specifier: 13.4.10
version: 13.4.10(eslint@8.45.0)(typescript@5.1.6)
lib:
specifier: workspace:*
version: link:../lib
next:
specifier: 13.4.10
version: 13.4.10(react-dom@18.2.0)(react@18.2.0)
oapilib:
specifier: workspace:*
version: link:../oapilib
postcss:
specifier: 8.4.26
version: 8.4.26

View File

@ -20,6 +20,8 @@
"react": "18.2.0",
"react-dom": "18.2.0",
"tailwindcss": "3.3.3",
"typescript": "5.1.6"
"typescript": "5.1.6",
"lib": "workspace:*",
"oapilib": "workspace:*"
}
}

View File

@ -1,3 +1,12 @@
export default function Home() {
return <h1>meow</h1>;
import {} from "lib";
import { API } from "oapilib";
const api = new API({
baseURL: "http://localhost:3000",
authentication: { headers: { Authorization: "Bearer banana" } },
});
export default async function Home() {
const deez = await api.get("/auth");
return <h1>{JSON.stringify(deez, null, 4)}</h1>;
}