Skip to content

Commit

Permalink
modify test unit
Browse files Browse the repository at this point in the history
Signed-off-by: sdghchj <[email protected]>
  • Loading branch information
sdghchj committed Mar 20, 2023
1 parent 203f600 commit f473a7c
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
3 changes: 3 additions & 0 deletions testdata/generics_basic/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ type StringStruct struct {
Data string
}

type Foo = web.GenericResponseMulti[types.Post, types.Post]

// @Summary Add a new pet to the store
// @Description get string by ID
// @Accept json
Expand Down Expand Up @@ -46,6 +48,7 @@ func GetPost(w http.ResponseWriter, r *http.Request) {
// @Success 200 {object} web.GenericResponse[types.Post]
// @Success 201 {object} web.GenericResponse[types.Hello]
// @Success 202 {object} web.GenericResponse[types.Field[string]]
// @Success 203 {object} Foo
// @Success 222 {object} web.GenericResponseMulti[types.Post, types.Post]
// @Router /posts-multi/ [post]
func GetPostMulti(w http.ResponseWriter, r *http.Request) {
Expand Down
20 changes: 20 additions & 0 deletions testdata/generics_basic/expected.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@
"$ref": "#/definitions/web.GenericResponse-types_Field-string"
}
},
"203": {
"description": "Non-Authoritative Information",
"schema": {
"$ref": "#/definitions/api.Foo"
}
},
"222": {
"description": "",
"schema": {
Expand Down Expand Up @@ -182,6 +188,20 @@
}
},
"definitions": {
"api.Foo": {
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/types.Post"
},
"meta": {
"$ref": "#/definitions/types.Post"
},
"status": {
"type": "string"
}
}
},
"api.Response-api_StringStruct-types_Field-int": {
"type": "object",
"properties": {
Expand Down

0 comments on commit f473a7c

Please sign in to comment.