# README
OpenAPI Code Generation Example
This directory contains an example server using our code generator which implements the OpenAPI petstore-expanded example.
This is the structure:
api/
: Contains the OpenAPI 3.0 specificationapi/petstore/
: The generated code for our pet store handlersinternal/
: Pet store handler implementation and unit testscmd/
: Runnable server implementing the OpenAPI 3 spec.
To generate the handler glue, run:
go run cmd/oapi-codegen/oapi-codegen.go --package petstore examples/oapi-codegen/api/petstore-expanded.yaml > examples/oapi-codegen/api/petstore.gen.go
# Functions
NewAddPetRequest calls the generic AddPet builder with application/json body.
NewAddPetRequestWithBody generates requests for AddPet with any type of body.
NewClient creates a new Client.
NewClientWithResponses returns a ClientWithResponses with a default Client:.
NewClientWithResponsesAndRequestEditorFunc takes in a RequestEditorFn callback function and returns a ClientWithResponses with a default Client:.
NewDeletePetRequest generates requests for DeletePet.
NewFindPetByIdRequest generates requests for FindPetById.
NewFindPetsRequest generates requests for FindPets.
ParseaddPetResponse parses an HTTP response from a AddPetWithResponse call.
ParsedeletePetResponse parses an HTTP response from a DeletePetWithResponse call.
ParsefindPetByIdResponse parses an HTTP response from a FindPetByIdWithResponse call.
ParsefindPetsResponse parses an HTTP response from a FindPetsWithResponse call.
WithBaseURL overrides the baseURL.
WithHTTPClient allows overriding the default httpClient, which is automatically created.
WithIdleTimeout overrides the timeout of idle connections.
WithInterceptors allows adding 0..N interceptors, which get called in serial order prior of calling the RequestEditor before finally making the request.
WithMaxIdleConnections overrides the amount of idle connections of the underlying http-client.
WithRequestEditorFn allows setting up a callback function, which will be called right before sending the request.
WithRequestEditorFn allows setting up a callback function, which will be called right before sending the request.
WithRequestTimeout overrides the timeout of individual requests.
WithUserAgent allows setting the userAgent.
# Structs
No description provided by the author
ClientWithResponses builds on ClientInterface to offer response payloads.
Error defines model for Error.
FindPetsParams defines parameters for FindPets.
NewPet defines model for NewPet.
Pet defines model for Pet.
# Interfaces
The interface specification for the client above.
No description provided by the author
# Type aliases
AddPetRequestBody defines body for AddPet for application/json ContentType.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author