github.com/go-swagger/go-swagger@v0.31.0/docs/reference/annotations/allOf.md (about) 1 --- 2 title: allOf 3 date: 2023-01-01T01:01:01-08:00 4 draft: true 5 --- 6 # swagger:allOf 7 8 Marks an embedded type as a member for allOf 9 10 <!--more--> 11 12 ##### Syntax 13 14 ```go 15 swagger:allOf 16 ``` 17 18 ##### Example 19 20 ```go 21 // A SimpleOne is a model with a few simple fields 22 type SimpleOne struct { 23 ID int64 `json:"id"` 24 Name string `json:"name"` 25 Age int32 `json:"age"` 26 } 27 28 // A Something struct is used by other structs 29 type Something struct { 30 DID int64 `json:"did"` 31 Cat string `json:"cat"` 32 } 33 34 // Notable is a model in a transitive package. 35 // it's used for embedding in another model 36 // 37 // swagger:model withNotes 38 type Notable struct { 39 Notes string `json:"notes"` 40 41 Extra string `json:"extra"` 42 } 43 44 // An AllOfModel is composed out of embedded structs but it should build 45 // an allOf property 46 type AllOfModel struct { 47 // swagger:allOf 48 SimpleOne 49 // swagger:allOf 50 mods.Notable 51 52 Something // not annotated with anything, so should be included 53 54 CreatedAt strfmt.DateTime `json:"createdAt"` 55 } 56 ``` 57 58 ##### Result 59 60 ```yaml 61 ```