You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PetCreate() references params.Pet.ID which does not exist at this endpoint i.e. it is always zero.
That means if you POST multiple pets they all will be stored at index 0 overwriting the last pet. Thus PetList() will only ever show a single pet at most. Suggested fix:
--- a/example/internal/pet/pet.go
+++ b/example/internal/pet/pet.go
@@ -34,7 +34,7 @@ func (p *Pet) PetCreate(ctx context.Context, params pet.PetCreateParams) middlew
p.count++
// store the created pet
- p.data[params.Pet.ID] = &model
+ p.data[model.ID] = &model
// copy the stored model before response
retModel := model
Also, because of PetID's omitempty tag the id 0 of the first pet will not be shown in the output of PetList().
The text was updated successfully, but these errors were encountered:
PetCreate()
referencesparams.Pet.ID
which does not exist at this endpoint i.e. it is always zero.That means if you POST multiple pets they all will be stored at index 0 overwriting the last pet. Thus
PetList()
will only ever show a single pet at most. Suggested fix:Also, because of
PetID
'somitempty
tag the id 0 of the first pet will not be shown in the output ofPetList()
.The text was updated successfully, but these errors were encountered: