LS6-Events / astra

An automatic Go type extractor for web services with very little additional configuration.
MIT License
31 stars 3 forks source link

Allowing customs description, group API tags, example data,... #81

Open Anhdao153 opened 2 months ago

Anhdao153 commented 2 months ago

Feature Request

I'm trying to setup a new project. I worked with nestJS, they allow me write description of APIs, group API tags, example data body,... Currently there are some hard if i wanna write description for a API (how to use it)

Maybe at a controller function. we are able to init a new struct

apiDescription := apiDetail{
   description: "",
   ....
}

with routes, are there some problem if we automatic add them to APIs Tags which have already a group ?

Screenshot 2024-08-20 at 09 27 42
TommoLeedsy commented 1 month ago

Hi @Anhdao153,

Thanks for using astra! To add a description to an API route you just need to add a comment above the handler:

// This is a test handler
testHandler(c *gin.Context) {
    c.JSON(http.StatusOK, gin.H{"message": "hello world"))
}

Examples values and tagged API groups are on our backlog but we would defiantly review a PR if you wanted to contribute?

Hope that all helps!