Skip to content

Conversation

@grevian
Copy link
Owner

@grevian grevian commented Mar 18, 2023

Update the specification and regenerate it in the repository

The service now fails to build because our implementation no longer matches the specification

# github.com/grevian/petstore-demo/service
service\pet.go:11:32: cannot use (*petAPIService)(nil) (value of type *petAPIService) as openapi.PetApiServicer value in variable declaration: *petAPIService does not implement openapi.PetApiServicer (missing method GetPetStatusById)

Which can be resolved by adding an implementation of GetPetStatusById to the Pet service implementation

func (p petAPIService) GetPetStatusById(ctx context.Context, petId int64) (openapi.ImplResponse, error) {
	pet, err := p.storage.LoadPet(petId)
	if err != nil {
		return openapi.Response(http.StatusNotFound, nil), err
	}
	return openapi.Response(http.StatusOK, pet.Status), nil
}

See #7 for the breaking API change that leads to this required implementation change

@grevian grevian changed the title Integrate api change Extend the API Mar 18, 2023
Regenerate API from specification
@grevian grevian force-pushed the integrate-api-change branch from cad7bd7 to 09c910e Compare March 18, 2023 19:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants