Skip to content
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

Server Types #160

Open
treydavis opened this issue Jun 22, 2023 · 3 comments
Open

Server Types #160

treydavis opened this issue Jun 22, 2023 · 3 comments
Labels
enhancement New feature or request help wanted Extra attention is needed missing feature

Comments

@treydavis
Copy link

treydavis commented Jun 22, 2023

The types produced by typegen make a nicely packaged type for configuring a client:

import { Client as PetStoreClient } from "./openapi.d.ts";
const client = await api.init<PetStoreClient>();

Could similar types be produced for use with OpenAPIBackend? Particularly, I'm interested in enforcing the existence of a Handler for each operationId and having each Handler typed with the appropriate HandlerContext.

@anttiviljami
Copy link
Member

I do love this idea @treydavis! Any work on this topic is appreciated

@anttiviljami anttiviljami added enhancement New feature or request help wanted Extra attention is needed missing feature labels Jul 9, 2023
@anttiviljami
Copy link
Member

FYI @treydavis I recently added a simple full stack Next.js example where we use the generated types in the backend.

You can see this live in a sandbox on the landing page of: https://openapistack.co/

or via github: https://github.com/anttiviljami/openapi-stack-nextjs-starter

@Amenocy
Copy link

Amenocy commented Jun 13, 2024

good :) i was thinking of adding some templates to generate server types similar to graphql codegen, maybe we can work on it.

another issue is, the generated types are not in the format of host project's prettier config :) I know this is tricky

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed missing feature
Projects
None yet
Development

No branches or pull requests

3 participants