openapi-parser icon indicating copy to clipboard operation
openapi-parser copied to clipboard

Do not set nullable by default on pointer fields in Structs

Open fhgbaguidi opened this issue 6 years ago • 0 comments

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.

fhgbaguidi avatar Apr 06 '18 15:04 fhgbaguidi