alexjomin / openapi-parser

Simple and still naive openapi documentation generator from comments of your Go code.
18 stars 8 forks source link

feat: allow to add description on struct fields using tag openapi-des… #36

Open denouche opened 4 years ago

denouche commented 4 years ago

…cription

denouche commented 4 years ago

cc @Sadzeih , what do you think about this?

Sadzeih commented 4 years ago

I love the idea of being able to add description and examples to fields. And we do have a need like that.

I don't know about implementation though. I think a comment would be a better way to do that, for readability but harder to implement.

Something like:

// @openapi:schema
type SomeStruct struct {
    // Name is the name of the SomeStruct
    // @openapi:example
    // test := SomeStruct{Name: "somestruct"}
    Name string `json:"name"`
}

I don't know if this is feasable, but I just don't really like the idea of multiple openapi StructField tags