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

feat: create v2 readonly routes with ogent server / entoas #2571

Merged
merged 29 commits into from
Nov 28, 2023

Conversation

hspitzley-czi
Copy link
Contributor

@hspitzley-czi hspitzley-czi commented Oct 13, 2023

CCIE-1991
Summary [POC] Use entoas/ogent for Happy API routes
Type Task Task
Status Done

https://czi-tech.atlassian.net/browse/CCIE-1991

Follow-up to: #2530

Now that we are using Ent instead of Gorm, this uses entoas to generate an OpenAPI Spec and then uses ogent to generate CRUD routes for the entities. Additionally we make use of openapi-typescript to generate typescript types (to be packaged and used in eng-portal) as well as oapi-codegen to generate shared Go structs (to be used by Happy CLI and Happy TF Provider). See diagram for more info (but ignore the protobuf part, we don't need that for now).

Screenshot 2023-10-04 at 9 34 57 AM

Whereas the original routes were always under the /v1 prefix, the ogent routes are mounted with a /v2 prefix to allow for a smooth transition for the clients.

Note: there is a lot of generated code here, including everything within api/pkg/ent/ except files in api/pkg/ent/schema/ and api/pkg/ent/entc.go. The generated files do not need a thorough review.

@hspitzley-czi hspitzley-czi changed the title feat: create v2 route with ogent server / entoas feat: create v2 readonly routes with ogent server / entoas Nov 27, 2023
@hspitzley-czi hspitzley-czi marked this pull request as ready for review November 27, 2023 22:51
@hspitzley-czi hspitzley-czi requested a review from a team as a code owner November 27, 2023 22:51
@hspitzley-czi hspitzley-czi requested review from netvisao, jakeyheath and alexlokshin-czi and removed request for a team November 27, 2023 22:51
// create the Fiber app
app := api.MakeFiberApp(ctx, cfg)
nativeHandler := adaptor.FiberApp(app.FiberApp)
rootMux.Handle("/v1/", http.StripPrefix("/v1", nativeHandler))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's rather unconventional :)

@hspitzley-czi hspitzley-czi merged commit ec2c2c6 into main Nov 28, 2023
31 checks passed
@hspitzley-czi hspitzley-czi deleted the hspitzley/entoas branch November 28, 2023 20:01
@czi-github-helper czi-github-helper bot mentioned this pull request Nov 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants