github.com/AngusLu/go-swagger@v0.28.0/docs/use/spec/type.md (about) 1 # swagger:type 2 3 **swagger:type** can be used to mark a struct with its type. This will override the type inferred by go-swagger. 4 5 [These data types](https://swagger.io/docs/specification/data-models/data-types/) are supported by Swagger. 6 7 ##### Syntax: 8 9 ``` 10 swagger:type [type] 11 ``` 12 13 ##### Example: 14 15 ```go 16 // swagger:type string 17 type NullString struct { 18 sql.NullString 19 } 20 21 // swagger:model myString 22 type MyString struct { 23 NS NullString 24 } 25 ``` 26 27 ##### Result: 28 29 ```yaml 30 --- 31 definitions: 32 myString: 33 type: object 34 properties: 35 NS: 36 type: string 37 x-go-name: MyString 38 ```