-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Closed
Description
Currently experiencing an issue where the {operation}JSONRequestBody types are not being used within the generated client methods.
e.g.
// spec.yaml
paths:
/:
post:
operationId: create
requestBody:
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Data'
The generated API has the following types
// api.gen.go
type Data struct {
...
}
type createJSONBody []Data
type CreateJSONRequestBody createJSONBody
But, the client methods mistakenly use the createJSONBody type when they should use the CreateJSONRequestBody type.
The following is generated, and causes the client to error with cannot refer to unexported name api.createJSONBody
// api.gen.go
Create(ctx context.Context, body createJSONBody) (*http.Response, error)
...
func (c *Client) Create(ctx context.Context, body createJSONBody) (*createResponse, error) {
...
}
In my testing, manually changing this to CreateJSONRequestBody resolves the issue
// api.gen.go
type ClientInterface interface {
Create(ctx context.Context, body CreateJSONRequestBody) (*http.Response, error)
}
...
func (c *Client) Create(ctx context.Context, body CreateJSONRequestBody) (*createResponse, error) {
...
}
This affects both the Client and ClientWithResponses methods.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels