From 8a027cc9208fb55bad29de6274894155c948bc4c Mon Sep 17 00:00:00 2001 From: Saigak Evgeniy Date: Wed, 27 Apr 2022 16:21:46 +0300 Subject: [PATCH] impr: add param example to readme (#1189) --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 12138b91e..84239d117 100644 --- a/README.md +++ b/README.md @@ -469,6 +469,7 @@ Besides that, `swag` also accepts aliases for some MIME Types as follows: // @Param string query string false "string valid" minlength(5) maxlength(10) // @Param int query int false "int valid" minimum(1) maximum(10) // @Param default query string false "string default" default(A) +// @Param example query string false "string example" example(string) // @Param collection query []string false "string collection" collectionFormat(multi) // @Param extensions query []string false "string collection" extensions(x-example=test,x-nullable) ``` @@ -477,7 +478,7 @@ It also works for the struct fields: ```go type Foo struct { - Bar string `minLength:"4" maxLength:"16"` + Bar string `minLength:"4" maxLength:"16" example:"random string"` Baz int `minimum:"10" maximum:"20" default:"15"` Qux []string `enums:"foo,bar,baz"` } @@ -497,6 +498,7 @@ Field Name | Type | Description enums | [\*] | See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.5.1. format | `string` | The extending format for the previously mentioned [`type`](#parameterType). See [Data Type Formats](https://swagger.io/specification/v2/#dataTypeFormat) for further details. collectionFormat | `string` |Determines the format of the array if type array is used. Possible values are: Default value is `csv`. +example | * | Declares the example for the parameter value extensions | `string` | Add extension to parameters. ### Future