Replies: 1 comment
-
You can define named schema or response. For following snippet: paths:
/users:
get:
tags:
- user
description: Returns all users
operationId: getUsers
responses:
"200":
description: successful operation
content:
application/json:
schema:
$ref: "#/components/schemas/Users"
"404":
description: Not found
components:
schemas:
Users:
type: array
items:
$ref: "#/components/schemas/User"
User:
type: object
# ... ogen generates: type Users []User |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
For the given open api definition
I would like make a slice with predefined length
response := make([]api.User, len(uu))
instead of using
var response api.GetUsersOKApplicationJSON
.Unfortunately the
[]api.User
doesn't implementAm I missing something or it's impossible ?
I can't find a way, and if it's not possible then it might affect performance for bigger slices.
edit:
I've found that you can do this, but is there a less cumbersome way ?
Beta Was this translation helpful? Give feedback.
All reactions