Skip to content

Support echo param tag #2093

@maxclaus

Description

@maxclaus

Is your feature request related to a problem? Please describe.

Echo supports param tag, but swag does not seem to support it. The swagger doc is generated based on the Go field name instead. The doc only gets generated properly if I use uri tag as well.

https://echo.labstack.com/docs/binding#data-sources

Would swag be interested if I open a PR adding that support?

Example of the code I have now, which depends on uri to work:

type PutRequestBody struct {
	CustomerID uuid.UUID `json:"customerId" validate:"required,uuid"`
}

type PutRequestParams struct {
	ProjectID string `uri:"projectId" param:"projectId" validate:"required"`
}

type PutRequest struct {
	PutRequestBody
	PutRequestParams
}

// Put 
//
//	@Summary		Assign entity
//	@Accept			json
//	@Produce		json
//	@Param			path	path		PutRequestParams	true	"Path Parameters"
//	@Param			body	body		PutRequestBody	true	"Request Body"
//	@Success		200		{object}	nil
//	@Failure		400		{object}	GeneralError	"Bad Request"
//	@Failure		401		{object}	GeneralError	"Unauthorized"
//	@Failure		403		{object}	GeneralError	"Forbidden"
//	@Failure		404		{object}	GeneralError	"Not Found"
//	@Failure		500		{object}	GeneralError	"Internal Server Error"
//	@Router			/api/v2/projects/{projectId} [put]
//	@Security		Bearer

Describe the solution you'd like

Add support for echo param tag, so there is no need to use uri tag anymore.

Describe alternatives you've considered
Using uri is a temporary workaround.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions