🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
[TOC] ## 概述 语法 ``` swagger:model [?model name] ``` 选项 | Annotation | Description | | --- | --- | | **Maximum** | specifies the maximum a number or integer value can have | | **Minimum** | specifies the minimum a number or integer value can have | | **Multiple of** | specifies a value a number or integer value must be a multiple of | | **Minimum length** | the minimum length for a string value | | **Maximum length** | the maximum length for a string value | | **Pattern** | a regular expression a string value needs to match | | **Minimum items** | the minimum number of items a slice needs to have | | **Maximum items** | the maximum number of items a slice can have | | **Unique** | when set to true the slice can only contain unique items | | **Required** | when set to true this value needs to be set on the schema | | **Read Only** | when set to true this value will be marked as read-only and is not required in request bodies | | **Example** | an example value, parsed as the field's type (objects and slices are parsed as JSON) | | **Extensions** | list of extensions. The field name MUST begin with x-, for example, x-internal-id. The value can be null, a primitive, an array or an object. | code ``` // User represents the user for this application // // A user is the security principal for this application. // It's also used as one of main axes for reporting. // // A user can have friends with whom they can share what they like. // // swagger:model type User struct { // the id for this user // // required: true // min: 1 ID int64 `json:"id"` // the name for this user // required: true // min length: 3 Name string `json:"name"` // the email address for this user // // required: true // example: user@provider.net Email strfmt.Email `json:"login"` // the friends for this user // // Extensions: // --- // x-property-value: value // x-property-array: // - value1 // - value2 // x-property-array-obj: // - name: obj // value: field // --- Friends []User `json:"friends"` } ``` 还不清楚使用场景