-
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.
fix multi level nesting parametrization(#1435)
- Loading branch information
1 parent
f916213
commit f617051
Showing
8 changed files
with
255 additions
and
15 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,16 @@ | ||
package api | ||
|
||
import ( | ||
"net/http" | ||
) | ||
|
||
// GetPosts | ||
// @Summary Test Generics with multi level nesting | ||
// @Description Test one of the edge cases found in generics | ||
// @Accept json | ||
// @Produce json | ||
// @Success 200 {object} web.TestResponse | ||
// @Router /use-struct-and-generics-with-multi-level-nesting [get] | ||
func GetPosts(w http.ResponseWriter, r *http.Request) { | ||
|
||
} |
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,142 @@ | ||
{ | ||
"swagger": "2.0", | ||
"info": { | ||
"description": "This is a sample server Petstore server.", | ||
"title": "Swagger Example API", | ||
"contact": {}, | ||
"version": "1.0" | ||
}, | ||
"host": "localhost:4000", | ||
"basePath": "/api", | ||
"paths": { | ||
"/use-struct-and-generics-with-multi-level-nesting": { | ||
"get": { | ||
"description": "Test one of the edge cases found in generics", | ||
"consumes": [ | ||
"application/json" | ||
], | ||
"produces": [ | ||
"application/json" | ||
], | ||
"summary": "Test Generics with multi level nesting", | ||
"responses": { | ||
"200": { | ||
"description": "OK", | ||
"schema": { | ||
"$ref": "#/definitions/web.TestResponse" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"definitions": { | ||
"web.DataPoint-float64": { | ||
"type": "object", | ||
"properties": { | ||
"timestamp": { | ||
"type": "integer" | ||
}, | ||
"value": { | ||
"type": "number" | ||
} | ||
} | ||
}, | ||
"web.DataPoint-int64": { | ||
"type": "object", | ||
"properties": { | ||
"timestamp": { | ||
"type": "integer" | ||
}, | ||
"value": { | ||
"type": "integer" | ||
} | ||
} | ||
}, | ||
"web.Entity-float64": { | ||
"type": "object", | ||
"properties": { | ||
"line_with_fix_type": { | ||
"type": "array", | ||
"items": { | ||
"$ref": "#/definitions/web.DataPoint-float64" | ||
} | ||
}, | ||
"line_with_generic_type": { | ||
"type": "array", | ||
"items": { | ||
"$ref": "#/definitions/web.DataPoint-float64" | ||
} | ||
}, | ||
"multiple_lines": { | ||
"type": "array", | ||
"items": { | ||
"$ref": "#/definitions/web.NamedLineData-float64" | ||
} | ||
} | ||
} | ||
}, | ||
"web.Entity-int64": { | ||
"type": "object", | ||
"properties": { | ||
"line_with_fix_type": { | ||
"type": "array", | ||
"items": { | ||
"$ref": "#/definitions/web.DataPoint-float64" | ||
} | ||
}, | ||
"line_with_generic_type": { | ||
"type": "array", | ||
"items": { | ||
"$ref": "#/definitions/web.DataPoint-int64" | ||
} | ||
}, | ||
"multiple_lines": { | ||
"type": "array", | ||
"items": { | ||
"$ref": "#/definitions/web.NamedLineData-int64" | ||
} | ||
} | ||
} | ||
}, | ||
"web.NamedLineData-float64": { | ||
"type": "object", | ||
"properties": { | ||
"data": { | ||
"type": "array", | ||
"items": { | ||
"$ref": "#/definitions/web.DataPoint-float64" | ||
} | ||
}, | ||
"name": { | ||
"type": "string" | ||
} | ||
} | ||
}, | ||
"web.NamedLineData-int64": { | ||
"type": "object", | ||
"properties": { | ||
"data": { | ||
"type": "array", | ||
"items": { | ||
"$ref": "#/definitions/web.DataPoint-int64" | ||
} | ||
}, | ||
"name": { | ||
"type": "string" | ||
} | ||
} | ||
}, | ||
"web.TestResponse": { | ||
"type": "object", | ||
"properties": { | ||
"field_1": { | ||
"$ref": "#/definitions/web.Entity-int64" | ||
}, | ||
"field_2": { | ||
"$ref": "#/definitions/web.Entity-float64" | ||
} | ||
} | ||
} | ||
} | ||
} |
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,17 @@ | ||
package main | ||
|
||
import ( | ||
"net/http" | ||
|
||
"github.com/swaggo/swag/testdata/generics_nested_my_version/api" | ||
) | ||
|
||
// @title Swagger Example API | ||
// @version 1.0 | ||
// @description This is a sample server Petstore server. | ||
// @host localhost:4000 | ||
// @basePath /api | ||
func main() { | ||
http.HandleFunc("/posts/", api.GetPosts) | ||
http.ListenAndServe(":8080", nil) | ||
} |
Oops, something went wrong.