-
How to add the description for embedded structs? Suppose I have structs as below
When swagger is generated, I'm able to see the examples in the generated swagger for Dept struct fields in the Emp schemas, but the description of those fields are not being picked up. Can you help me on what am I missing here? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
This should probably give the expected result: type Dept struct {
Number int `json:"no" example:"123" description:"Unique identifier of Department"`
Name string `json:"name" example:"BCCI" description:"Name of the Department"`
} Here is documentation about means of spec control: https://github.com/swaggest/jsonschema-go#field-tags. |
Beta Was this translation helpful? Give feedback.
openapi-go
operates using reflection only, so the comments are not available as a source of information.This should probably give the expected result:
Here is documentation about means of spec control: https://github.com/swaggest/jsonschema-go#field-tags.