alexjomin / openapi-parser

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

Do not set nullable by default on pointer fields in Structs #16

Open fhgbaguidi opened 6 years ago

fhgbaguidi commented 6 years ago

The idea behind this issue is to have some open api tags that we can put on fields on structs to tell to openapi-parser that the field is nullable. The field will be set as nullable only if this tag is present and the field is a pointer to something.

Example:

// Pet struct
// @openapi:schema
type Pet struct {
    ID              bson.ObjectId
    PointerOfString *string       `openapi:"nullable"`
    PointerOfStruct *Foo 
}

In this example, only PointerOfString field should be nullable in the generated openapi file.