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

Failed to get relative path #62

Closed
avary opened this issue Feb 28, 2024 · 1 comment
Closed

Failed to get relative path #62

avary opened this issue Feb 28, 2024 · 1 comment

Comments

@avary
Copy link

avary commented Feb 28, 2024

Issue Description

im trying to integrate astra to my existing gin based backend, this is part of my router setup

r.GET("/", func(c *gin.Context) {
		c.String(http.StatusOK, fmt.Sprint(time.Now().Unix()))
	})
	apiRouterNoAuth := r.Group("/api/admin")

	apiRouterNoAuth.POST("/login", admin.APILogin)
	apiRouterNoAuth.POST("/register", admin.APIRegister)
	apiRouterNoAuth.GET("/healthcheck", APIHealthCheck)


	aRouter := r.Group("/api/admin")
	aRouter.Use(middleware.AuthMiddlewareHeader())
	aRouter.GET("/logout", admin.APILogout)
        ...
        ...

gen := astra.New(inputs.WithGinInput(r), outputs.WithOpenAPIOutput("openapi.generated.yaml"))

	// For OpenAPI to work, we need to define a configuration, which contains the title, version and description amongst other important information
	config := astra.Config{
		Title:   "Example API",
		Version: "1.0.0",
		Host:    "localhost",
		Port:    8001,
	}
	gen.SetConfig(&config)

	err := gen.Parse()
	if err != nil {
		log.Println("error parsing astra...", err)
		// panic(err)
	}
}

Actual Behavior

2024/02/28 15:34:44 main.go:54: current os : darwin
2024/02/28 15:34:44 main.go:80: duration for session is 10 ....30
3:34PM INF Begin parsing
3:34PM INF Setting up parse
3:34PM INF Setting up
3:34PM INF Creating temp dir
3:34PM INF Creating temp dir complete
3:34PM INF Noting current dir
3:34PM INF Noting current dir complete
3:34PM INF Setting up complete
3:34PM INF Creating routes from inputs
3:34PM INF Creating routes from input mode=gin
3:34PM ERR Failed to get relative path error="Rel: can't make relative to /Users/avar/mybackend" handler=avar/internal/handler/Admin.(*AdminController).APIGetPaidOrders-fm method=GET path=/api/admin/dashboard/orders-count
3:34PM ERR Failed to parse route error="Rel: can't make relative to /Users/avar/mybackend" file= line=1 method=GET path=/api/admin/dashboard/orders-count
3:34PM ERR Error creating routes from input error="Rel: can't make relative to /Users/avar/mybackend" mode=gin
3:34PM ERR Error creating routes from inputs error="Rel: can't make relative to /Users/avar/mybackend"
3:34PM ERR Error setting up parse error="Rel: can't make relative to /Users/avar/mybackend"
2024/02/28 15:34:44 router.go:295: error parsing astra... Rel: can't make relative to /Users/avar/mybackend
2024/02/28 15:34:44 main.go:134: not using secure connection

Additional Information

  • Go Version: 1.21.7 darwin/amd64
  • Go Toolchain: 1.21
  • Astra Version: go get -u github.com/ls6-events/astra
@avary avary closed this as not planned Won't fix, can't repro, duplicate, stale Feb 28, 2024
@TommoLeedsy
Copy link
Contributor

@avary Thanks for using Astra and submitting an issue, I think it might be a duplicate of #55 which we are working on a fix for and we will let you know when it's sorted.

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

No branches or pull requests

2 participants