You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Specifically, I'm using the Annotations method to add comments to my schema structs. However, the generated comments are placed above the struct definition, whereas I need them to be placed at the end of the struct.
Here's an example of how I'm currently defining annotations:
package"<project>/ent/schema"// annotations of the Missionfunc (Mission) Annotations() []schema.Annotation {
return []schema.Annotation{
entsql.Annotation{Table: "EntMission"},
schema.Comment(
`@description Mission model defines the structure of a mission@name Mission`,
),
}
}
The above code generates comments above the struct definition which is fine in most cases.
package"<project>/ent"// @description Mission model defines the structure of a mission// @name MissiontypeMissionstruct {
config`json:"-"`...
}
But when testing with swag init to generate the swag doc which has reference to the generated Mission struct, the @name Mission placing in front of the struct as it is shown above does not seem to have any effect, instead, manually editing the generated Mission struct by placing the the @name Mission after the struct seems to be working as mentioned here "rename model to display"
package"<project>/ent"// @description Mission model defines the structure of a missiontypeMissionstruct {
config`json:"-"`...
} // @name Mission
I am new to golang, and I am not sure what might be the best practice here - is it possible to have an option for schema comment generated after the struct or did I just miss something very obvious here?
The text was updated successfully, but these errors were encountered:
I'm currently using the ent framework for my project with https://github.com/swaggo/swag
Specifically, I'm using the Annotations method to add comments to my schema structs. However, the generated comments are placed above the struct definition, whereas I need them to be placed at the end of the struct.
Here's an example of how I'm currently defining annotations:
The above code generates comments above the struct definition which is fine in most cases.
But when testing with
swag init
to generate the swag doc which has reference to the generated Mission struct, the@name Mission
placing in front of the struct as it is shown above does not seem to have any effect, instead, manually editing the generated Mission struct by placing the the@name Mission
after the struct seems to be working as mentioned here "rename model to display"I am new to golang, and I am not sure what might be the best practice here - is it possible to have an option for schema comment generated after the struct or did I just miss something very obvious here?
The text was updated successfully, but these errors were encountered: