package
0.0.0-20230117114015-e1bdae72f636
Repository: https://github.com/sumup-go/lessons.git
Documentation: pkg.go.dev

# README

Lesson 11

  • OpenAPI specification
  • Code generation

OpenAPI specification

The OpenAPI Specification, previously known as the Swagger Specification, is a specification for machine-readable interface files for describing, producing, consuming, and visualizing RESTful web services

Code Generation

https://github.com/deepmap/oapi-codegen

go get github.com/deepmap/oapi-codegen/cmd/oapi-codegen

Tutorial

https://dev.to/ayzu/go-code-generation-from-openapi-spec-2eem

# Packages

No description provided by the author
No description provided by the author

# Functions

GetSwagger returns the Swagger specification corresponding to the generated code in this file.
Creates a new Client, with reasonable defaults.
NewClientWithResponses creates a new ClientWithResponses, which wraps Client with return type handling.
NewPostParticipantRequest calls the generic PostParticipant builder with application/json body.
NewPostParticipantRequestWithBody generates requests for PostParticipant with any type of body.
ParsePostParticipantResponse parses an HTTP response from a PostParticipantWithResponse call.
Constructs a synthetic filesystem for resolving external references when loading openapi specifications.
RegisterHandlers adds each server route to the EchoRouter.
Registers handlers, and prepends BaseURL to the paths, so that the paths can be served under a prefix.
WithBaseURL overrides the baseURL.
WithHTTPClient allows overriding the default Doer, which is automatically created using http.Client.
WithRequestEditorFn allows setting up a callback function, which will be called right before sending the request.

# Constants

Defines values for ParticipantTrack.
Defines values for ParticipantTrack.

# Structs

Client which conforms to the OpenAPI3 specification for this service.
ClientWithResponses builds on ClientInterface to offer response payloads.
Participant defines model for Participant.
No description provided by the author
ServerInterfaceWrapper converts echo contexts to parameters.

# Interfaces

The interface specification for the client above.
ClientWithResponsesInterface is the interface specification for the client with responses above.
This is a simple interface which specifies echo.Route addition functions which are present on both echo.Echo and echo.Group, since we want to allow using either of them for path registration.
Doer performs HTTP requests.
ServerInterface represents all server handlers.

# Type aliases

ClientOption allows setting custom parameters during construction.
ParticipantTrack defines model for Participant.Track.
PostParticipantJSONBody defines parameters for PostParticipant.
PostParticipantJSONRequestBody defines body for PostParticipant for application/json ContentType.
RequestEditorFn is the function signature for the RequestEditor callback function.