-
Notifications
You must be signed in to change notification settings - Fork 2
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
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…e in ogent server
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
requested review from
netvisao,
jakeyheath and
alexlokshin-czi
and removed request for
a team
November 27, 2023 22:51
alexlokshin-czi
approved these changes
Nov 28, 2023
// create the Fiber app | ||
app := api.MakeFiberApp(ctx, cfg) | ||
nativeHandler := adaptor.FiberApp(app.FiberApp) | ||
rootMux.Handle("/v1/", http.StripPrefix("/v1", nativeHandler)) |
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.
That's rather unconventional :)
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
CCIE-1991
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 usesogent
to generate CRUD routes for the entities. Additionally we make use ofopenapi-typescript
to generate typescript types (to be packaged and used in eng-portal) as well asoapi-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).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 inapi/pkg/ent/schema/
andapi/pkg/ent/entc.go
. The generated files do not need a thorough review.