github.com/go-swagger/go-swagger@v0.31.0/docs/reference/models/_index.md (about)

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