swagger icon indicating copy to clipboard operation
swagger copied to clipboard

Support for parser pointer array

Open inotnako opened this issue 10 years ago • 3 comments

Hi! Now it's not parsing

type ServiceTypes []*ServiceType

func (st *ServiceTypes ) Add () {
// any code and any function for work with st
}
type ServiceType struct {
  Type string
}
type Service struct {
    Id         bson.ObjectId `json:"id,omitempty" bson:"id"`
    TargetLang string        `json:"targetLang,required" description:"Language.Tag" bson:"targetLang"`
    SourceLang string        `json:"sourceLang,required" description:"Language.Tag" bson:"sourceLang"`
    Types      *ServiceTypes `json:"types,required"" bson:"types"`
    Genres     Genres        `json:"genres" bson:"genres"`
    Taxonomies Taxonomies    `json:"taxonomies" bson:"taxonomies"`
}

If I change to

type Service struct {
    Id         bson.ObjectId `json:"id,omitempty" bson:"id"`
    TargetLang string        `json:"targetLang,required" description:"Language.Tag" bson:"targetLang"`
    SourceLang string        `json:"sourceLang,required" description:"Language.Tag" bson:"sourceLang"`
    Types      []*ServiceType `json:"types,required"" bson:"types"`
    Genres     Genres        `json:"genres" bson:"genres"`
    Taxonomies Taxonomies    `json:"taxonomies" bson:"taxonomies"`
}

It's worked.

You can support this pattern in parser?

inotnako avatar Dec 10 '14 10:12 inotnako

@antonikonovalov can you submit pull request, please ?

yvasiyarov avatar Dec 10 '14 12:12 yvasiyarov

You have idea how it's make in parser?

inotnako avatar Dec 10 '14 13:12 inotnako

In my case, bson.ObjectId could be not parsing. @antonikonovalov How did you pass?

Can not find definition of ObjectId model. Name looks like absolute, but model not found in gopkg/in/mgo/v2/bson package

0xp3p3 avatar Jul 18 '17 00:07 0xp3p3