Skip to content
Discussion options

You must be logged in to vote

So I took some time to investigate my use case and it turned out to be quite decent for my taste

package main

import (
	"entgo.io/ent/entc"
	"entgo.io/ent/entc/gen"
	"github.com/go-chi/chi/v5"
	"github.com/lrstanley/entrest"
	"log"
	"os"
)

func main() {
        // register your routes with Huma
	api := routes.Register(chi.NewRouter())
        // by default Huma creates an OpenApi 3.1 Spec, so we need to downgrade it to make it compatible with entrest, otherwise it will panic
	downgradedApiSpec, err := api.OpenAPI().Downgrade()
	if err != nil {
		log.Fatalf("failed to downgrade OpenAPI spec: %v", err)
	}

	// Write OpenAPI spec to file
	openapiFile, err := os.Create("test-openapi.json")
	if

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by c3n21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants