Replies: 1 comment
-
I believe (Aside: Personally, I find this somewhat problematic, since it makes error handling on the client side more difficult. If the schema keeps evolving, documenting an error response in the OpenAPI spec changes how a client needs to handle errors... Checking for |
Beta Was this translation helpful? Give feedback.
-
First, my hands thank the Maintainers for handling this boilerplate! Second, I ran
ogen
on the Pinterest spec and it generated 116 client methods as expected. However, 93 of them return a*Res interface
, while 23 of them return a pointer*...OK struct
. Moreover, one of the methods returning an (unexpected) pointer*...OK struct
works correctly, while another method returning an (expected)...Res interface
fails with:Here's my code:
The very first call to
client.AdAccountsList(ctx, api.AdAccountsListParams{})
works correctly, along with the followingfor
ranging overres.GetItems()
. However, the call toclient.CampaignsList(ctx, params)
returns the expectedCampaignsListRes interface
, but then the secondfor
fails because there's noGetItems()
method onCampaignsListRes
.The documentation on Interface responses only has the
...Res interface
, so why doesclient.AdAccountsList(ctx, api.AdAccountsListParams{})
return*AdAccountsListOK
?Here's the generated methods:
Here's my
ogen.yml
:Finally, below is the relevant yaml from the Pinterest spec, but I had to fix 5 schema errors (2 excess indentations on
minItems
; 2 incorrect instances ofstring
type that should beobject
type; and 1 incorrect usage ofmaxLength
which should bemaxItems
).Any help is appreciated! 🙏
Beta Was this translation helpful? Give feedback.
All reactions