github.com/AngusLu/go-swagger@v0.28.0/docs/use/model.md (about) 1 # Generate a data model from swagger spec 2 3 The toolkit allows for generating go native structures to serialize and validate a swagger compliant model definition. 4 5 The generated objects follow the specified validation rules, including extended format directives for strings and numbers. 6 7 Generated models support most Swagger 2.0 features, including polymorphism. 8 9 Generated models support most JSON-schema draft4 features, including `AllOf`, `AdditionalProperties` and `AdditionalItems`. 10 11 ### Usage 12 13 `generate model -f {spec}` 14 15 See the full list of available options [here](../generate/model.md). 16 17 ### Model building rules 18 19 * [Schema generation rules](./models/schemas.md#schema-generation-rules) 20 * [About schemas](./models/schemas.md#about-schema) 21 * [Interfaces](./models/schemas.md#interfaces) 22 * [Mapping patterns](./models/schemas.md#mapping-patterns) 23 * [Minimal use of go's reflection](./models/schemas.md#minimal-use-of-go-s-reflection) 24 * [Doc strings](./models/schemas.md#doc-strings) 25 * [Reusability](./models/schemas.md#reusability) 26 * [Swagger vs JSONSchema](./models/schemas.md#swagger-vs-jsonschema) 27 * [Go-swagger vs Swagger](./models/schemas.md#go-swagger-vs-swagger) 28 * [Known limitations with go-swagger models](./models/schemas.md#known-limitations-with-go-swagger-models) 29 * [Custom extensions](./models/schemas.md#custom-extensions) 30 * [Primitive types](./models/schemas.md#primitive-types) 31 * [Formatted types](./models/schemas.md#formatted-types) 32 * [Nullability](./models/schemas.md#nullability) 33 * [Validation](./models/schemas.md#validation) 34 * [Type aliasing](./models/schemas.md#type-aliasing) 35 * [Extensible types](./models/schemas.md#extensible-types) 36 * [Additional properties](./models/schemas.md#additional-properties) 37 * [Tuples and additional items](./models/schemas.md#tuples-and-additional-items) 38 * [Polymorphic types](./models/schemas.md#polymorphic-types) 39 * [Serialization interfaces](./models/schemas.md#serialization-interfaces) 40 * [External types](./models/schemas.md#external-types) 41 * [Customizing struct tags](./models/schemas.md#customizing-struct-tags)