Revision control
Copy as Markdown
/*
* Simple nested data structures
*
* File tests straightforward nested-level array-of-array-of-array structures and deep nested reference structures.
*
* API version: 1.0.0
*/
package openapi
import (
"github.com/gin-gonic/gin"
)
type DefaultAPI struct {
}
func nestedArray(depth int, value any) any {
v := value
for i := 0; i < depth; i++ {
v = []any{v}
}
return v
}
// Post /v2/deep-nested-ref-chain
// Deep request and response example
func (api *DefaultAPI) RefsChain(c *gin.Context) {
// Your handler implementation
c.JSON(200, gin.H{"status": "OK"})
}
// Post /v2/deep-array
// Accept a 20-level deeply nested array
func (api *DefaultAPI) SubmitDeepArray(c *gin.Context) {
resp := nestedArray(3, "Moin!!!")
c.JSON(200, resp)
}
// Post /v2/deep-map
// Accept nested QMap structure
func (api *DefaultAPI) SubmitDeepMap(c *gin.Context) {
response := map[string]map[string]string{ "level1": { "level2": "value" } }
c.JSON(200, response)
}