-
-
Notifications
You must be signed in to change notification settings - Fork 358
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(generator): add tRPC generator #415
Conversation
Someone is attempting to deploy a commit to a Personal Account owned by @anymaniax on Vercel. @anymaniax first needs to authorize it. |
export const getRefInfo = async ( | ||
export const getRefInfo = ( | ||
$ref: ReferenceObject['$ref'], | ||
context: ContextSpecs, | ||
): Promise<{ |
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.
There doesn't appear to be a reason why this should be a promise.
schema: ComponentObject, | ||
context: ContextSpecs, | ||
imports: GeneratorImport[] = [], | ||
): Promise<{ | ||
): { | ||
schema: Schema; |
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.
There doesn't appear to be a reason why this should be a promise.
Hello @DaleWebb, thanks for the pull request. This new generator only use trpc as gateway to use another api? |
Hey @anymaniax - thanks for responding. Effectively, this implementation of tRPC will generate a typesafe API to endpoints in an OpenAPI spec |
can be introduce with v7 #434 and with your own template then maybe |
I will do some tests this week to see if we can merge it could be a good template. I add another idea about trpc since moment where instead of the mutator or the http call function we could add a sort of handler to have some business logic directly there. We currently could do it with the mutator but would be annoying to do. |
e2edc19
to
60b251d
Compare
Hello @DaleWebb, you can now check the new architecture and create your own client with the extracted core. The current version is You can now do something like this. import query from '@orval/query';
import { defineConfig } from 'orval';
export default defineConfig({
petstore: {
output: {
client: query() // query({type: 'svelte-query'}) for another query client,
}
}
}); so you could do exactly the same with your own client |
c066483
to
14b9f50
Compare
No response from OP and PR is 2 years old |
Status
READY
Description
This PR introduces a generator for tRPC. tRPC is a library for creating type-safe APIs.
The generator will create a router for each Open API input, with routes for each
GET
,POST
etc.This includes changes to existing functions. They are to un-
promise
their response - thePromise
didn't appear to be required:src/core/getters/object.ts
src/core/getters/ref.ts
src/core/resolvers/ref.ts
Todos