-
Notifications
You must be signed in to change notification settings - Fork 285
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Scaffold ts phoenix client using openapi-typescript #4928
feat: Scaffold ts phoenix client using openapi-typescript #4928
Conversation
@@ -14,23 +14,24 @@ | |||
"scripts": { | |||
"clean": "rimraf dist", | |||
"prebuild": "pnpm run clean && pnpm run generate", | |||
"generate": "openapi-ts", | |||
"generate": "openapi-typescript ../../../schemas/openapi.json -o ./src/lib/api/v1.d.ts", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"generate": "openapi-typescript ../../../schemas/openapi.json -o ./src/lib/api/v1.d.ts", | |
"generate": "openapi-typescript ../../../schemas/openapi.json -o ./src/schema.d.ts", |
@cephalization why not just put it at the root of src?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
alternatively could use relay syntax __generated__
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Leaving root open lets us build out wrapping structures or extra utils on top of the generated code without co-mingling it. I can rename to generated though
}; | ||
|
||
export const createClient = ( | ||
options: ClientOptions = { baseUrl: "http://localhost:6006" }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should support the same environment variables here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call, although I am a bit wary because it makes the code less isomorphic. I can do some feature detection on process.env probably so that this code still runs in all runtimes
}; | ||
"/v1/datasets/{id}": { | ||
parameters: { | ||
query?: never; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cephalization this is weird - is it something we can configure? it should be at least any here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something is definitely messed up. The last openapi codegen tool I used strongly typed the query parameters of each endpoint and I'd expect the same here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No description provided.