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().
PetCreate()referencesparams.Pet.IDwhich 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'somitemptytag the id 0 of the first pet will not be shown in the output ofPetList().