-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Struct fields supported for header and path param types (#1740)
* Support object data types for header params Add initial struct test for header names and validation. * Add form and query struct test for operations * Operation param add path struct model support and tests wip: fix merge
- Loading branch information
Showing
5 changed files
with
207 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package structs | ||
|
||
type FormModel struct { | ||
Foo string `form:"f" binding:"required" validate:"max=10"` | ||
// B is another field | ||
B bool | ||
} | ||
|
||
type AuthHeader struct { | ||
// Token is the auth token | ||
Token string `header:"X-Auth-Token" binding:"required"` | ||
// AnotherHeader is another header | ||
AnotherHeader int `validate:"gte=0,lte=10"` | ||
} | ||
|
||
type PathModel struct { | ||
// ID is the id | ||
Identifier int `uri:"id" binding:"required"` | ||
Name string `validate:"max=10"` | ||
} |