proto

package
v1.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 21, 2025 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Overview

Package domain provides primitives to interact with the openapi HTTP API.

Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.5.0 DO NOT EDIT.

Index

Constants

View Source
const (
	ProtoExt       = ".proto"
	ProtobufSetExt = ".pb"
	ProtoSetExt    = ".protoset"
)

Variables

This section is empty.

Functions

func Build

func Build(ctx context.Context, imports []string, paths []string) ([]*descriptorpb.FileDescriptorSet, error)

func Handler

func Handler(si ServerInterface) http.Handler

Handler creates http.Handler with routing matching OpenAPI spec.

func HandlerFromMux

func HandlerFromMux(si ServerInterface, r *mux.Router) http.Handler

HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux.

func HandlerFromMuxWithBaseURL

func HandlerFromMuxWithBaseURL(si ServerInterface, r *mux.Router, baseURL string) http.Handler

func HandlerWithOptions

func HandlerWithOptions(si ServerInterface, options GorillaServerOptions) http.Handler

HandlerWithOptions creates http.Handler with additional options

Types

type AddStubJSONBody

type AddStubJSONBody struct {
	// contains filtered or unexported fields
}

AddStubJSONBody defines parameters for AddStub.

type AddStubJSONRequestBody

type AddStubJSONRequestBody AddStubJSONBody

AddStubJSONRequestBody defines body for AddStub for application/json ContentType.

type Arguments

type Arguments struct {
	// contains filtered or unexported fields
}

Arguments represents the configuration for protobuf file processing.

func New

func New(protoPath []string, imports []string) *Arguments

New creates a new Arguments instance with the specified protobuf paths and imports.

func (*Arguments) Imports

func (p *Arguments) Imports() []string

Imports returns the list of import paths for protobuf files.

func (*Arguments) ProtoPath

func (p *Arguments) ProtoPath() []string

ProtoPath returns the list of protobuf file paths.

type BatchStubsDeleteJSONRequestBody

type BatchStubsDeleteJSONRequestBody = ListID

BatchStubsDeleteJSONRequestBody defines body for BatchStubsDelete for application/json ContentType.

type Configure

type Configure struct {
	// contains filtered or unexported fields
}

func (*Configure) Descriptors

func (c *Configure) Descriptors() []string

func (*Configure) Imports

func (c *Configure) Imports() []string

func (*Configure) Protos

func (c *Configure) Protos() []string

type GorillaServerOptions

type GorillaServerOptions struct {
	BaseURL          string
	BaseRouter       *mux.Router
	Middlewares      []MiddlewareFunc
	ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error)
}

type ID

type ID = openapi_types.UUID

ID defines model for ID.

type InvalidParamFormatError

type InvalidParamFormatError struct {
	ParamName string
	Err       error
}

func (*InvalidParamFormatError) Error

func (e *InvalidParamFormatError) Error() string

func (*InvalidParamFormatError) Unwrap

func (e *InvalidParamFormatError) Unwrap() error

type ListID

type ListID = []ID

ListID defines model for ListID.

type MessageOK

type MessageOK struct {
	Message string    `json:"message"`
	Time    time.Time `json:"time"`
}

MessageOK defines model for MessageOK.

type Method

type Method struct {
	Id   string `json:"id"`
	Name string `json:"name"`
}

Method defines model for Method.

type MiddlewareFunc

type MiddlewareFunc func(http.Handler) http.Handler

type RequiredHeaderError

type RequiredHeaderError struct {
	ParamName string
	Err       error
}

func (*RequiredHeaderError) Error

func (e *RequiredHeaderError) Error() string

func (*RequiredHeaderError) Unwrap

func (e *RequiredHeaderError) Unwrap() error

type RequiredParamError

type RequiredParamError struct {
	ParamName string
}

func (*RequiredParamError) Error

func (e *RequiredParamError) Error() string

type SearchRequest

type SearchRequest struct {
	Data    any               `json:"data"`
	Headers map[string]string `json:"headers,omitempty"`
	Id      *ID               `json:"id,omitempty"`
	Method  string            `json:"method"`
	Service string            `json:"service"`
}

SearchRequest defines model for SearchRequest.

type SearchResponse

type SearchResponse struct {
	Code    *codes.Code       `json:"code,omitempty"`
	Data    any               `json:"data"`
	Error   string            `json:"error"`
	Headers map[string]string `json:"headers,omitempty"`
}

SearchResponse defines model for SearchResponse.

type SearchStubsJSONRequestBody

type SearchStubsJSONRequestBody = SearchRequest

SearchStubsJSONRequestBody defines body for SearchStubs for application/json ContentType.

type ServerInterface

type ServerInterface interface {
	// Liveness check
	// (GET /health/liveness)
	Liveness(w http.ResponseWriter, r *http.Request)
	// Readiness check
	// (GET /health/readiness)
	Readiness(w http.ResponseWriter, r *http.Request)
	// Services
	// (GET /services)
	ServicesList(w http.ResponseWriter, r *http.Request)
	// Service methods
	// (GET /services/{serviceID}/methods)
	ServiceMethodsList(w http.ResponseWriter, r *http.Request, serviceID string)
	// Remove all stubs
	// (DELETE /stubs)
	PurgeStubs(w http.ResponseWriter, r *http.Request)
	// Getting a list of stubs
	// (GET /stubs)
	ListStubs(w http.ResponseWriter, r *http.Request)
	// Add a new stub to the store
	// (POST /stubs)
	AddStub(w http.ResponseWriter, r *http.Request)
	// Deletes a batch of stubs by IDs
	// (POST /stubs/batchDelete)
	BatchStubsDelete(w http.ResponseWriter, r *http.Request)
	// Stub storage search
	// (POST /stubs/search)
	SearchStubs(w http.ResponseWriter, r *http.Request)
	// Getting a list of unused stubs
	// (GET /stubs/unused)
	ListUnusedStubs(w http.ResponseWriter, r *http.Request)
	// Getting a list of used stubs
	// (GET /stubs/used)
	ListUsedStubs(w http.ResponseWriter, r *http.Request)
	// Deletes stub by ID
	// (DELETE /stubs/{uuid})
	DeleteStubByID(w http.ResponseWriter, r *http.Request, uuid ID)
	// Get Stub by ID
	// (GET /stubs/{uuid})
	FindByID(w http.ResponseWriter, r *http.Request, uuid ID)
}

ServerInterface represents all server handlers.

type ServerInterfaceWrapper

type ServerInterfaceWrapper struct {
	Handler            ServerInterface
	HandlerMiddlewares []MiddlewareFunc
	ErrorHandlerFunc   func(w http.ResponseWriter, r *http.Request, err error)
}

ServerInterfaceWrapper converts contexts to parameters.

func (*ServerInterfaceWrapper) AddStub

AddStub operation middleware

func (*ServerInterfaceWrapper) BatchStubsDelete

func (siw *ServerInterfaceWrapper) BatchStubsDelete(w http.ResponseWriter, r *http.Request)

BatchStubsDelete operation middleware

func (*ServerInterfaceWrapper) DeleteStubByID

func (siw *ServerInterfaceWrapper) DeleteStubByID(w http.ResponseWriter, r *http.Request)

DeleteStubByID operation middleware

func (*ServerInterfaceWrapper) FindByID

func (siw *ServerInterfaceWrapper) FindByID(w http.ResponseWriter, r *http.Request)

FindByID operation middleware

func (*ServerInterfaceWrapper) ListStubs

func (siw *ServerInterfaceWrapper) ListStubs(w http.ResponseWriter, r *http.Request)

ListStubs operation middleware

func (*ServerInterfaceWrapper) ListUnusedStubs

func (siw *ServerInterfaceWrapper) ListUnusedStubs(w http.ResponseWriter, r *http.Request)

ListUnusedStubs operation middleware

func (*ServerInterfaceWrapper) ListUsedStubs

func (siw *ServerInterfaceWrapper) ListUsedStubs(w http.ResponseWriter, r *http.Request)

ListUsedStubs operation middleware

func (*ServerInterfaceWrapper) Liveness

func (siw *ServerInterfaceWrapper) Liveness(w http.ResponseWriter, r *http.Request)

Liveness operation middleware

func (*ServerInterfaceWrapper) PurgeStubs

func (siw *ServerInterfaceWrapper) PurgeStubs(w http.ResponseWriter, r *http.Request)

PurgeStubs operation middleware

func (*ServerInterfaceWrapper) Readiness

func (siw *ServerInterfaceWrapper) Readiness(w http.ResponseWriter, r *http.Request)

Readiness operation middleware

func (*ServerInterfaceWrapper) SearchStubs

func (siw *ServerInterfaceWrapper) SearchStubs(w http.ResponseWriter, r *http.Request)

SearchStubs operation middleware

func (*ServerInterfaceWrapper) ServiceMethodsList

func (siw *ServerInterfaceWrapper) ServiceMethodsList(w http.ResponseWriter, r *http.Request)

ServiceMethodsList operation middleware

func (*ServerInterfaceWrapper) ServicesList

func (siw *ServerInterfaceWrapper) ServicesList(w http.ResponseWriter, r *http.Request)

ServicesList operation middleware

type Service

type Service struct {
	Id      string   `json:"id"`
	Methods []Method `json:"methods"`
	Name    string   `json:"name"`
	Package string   `json:"package"`
}

Service defines model for Service.

type ServingStatus

type ServingStatus uint32

type Stub

type Stub struct {
	Headers StubHeaders `json:"headers,omitempty"`
	Id      *ID         `json:"id,omitempty"`
	Input   StubInput   `json:"input"`

	// Inputs Inputs to match against. If multiple inputs are provided, the stub will be matched if any of the inputs match.
	Inputs *[]StubInput `json:"inputs,omitempty"`
	Method string       `json:"method"`
	Output StubOutput   `json:"output"`

	// Priority Priority of the stub. Higher priority stubs are matched first.
	Priority *int   `json:"priority,omitempty"`
	Service  string `json:"service"`
}

Stub defines model for Stub.

type StubHeaders

type StubHeaders struct {
	Contains map[string]string `json:"contains,omitempty"`
	Equals   map[string]string `json:"equals,omitempty"`
	Matches  map[string]string `json:"matches,omitempty"`
}

StubHeaders defines model for StubHeaders.

type StubInput

type StubInput struct {
	Contains         map[string]any `json:"contains,omitempty"`
	Equals           map[string]any `json:"equals,omitempty"`
	IgnoreArrayOrder *bool          `json:"ignoreArrayOrder,omitempty"`
	Matches          map[string]any `json:"matches,omitempty"`
}

StubInput defines model for StubInput.

type StubList

type StubList = []Stub

StubList defines model for StubList.

type StubOutput

type StubOutput struct {
	Code    *codes.Code       `json:"code,omitempty"`
	Data    map[string]any    `json:"data"`
	Error   string            `json:"error"`
	Headers map[string]string `json:"headers,omitempty"`
	Stream  []map[string]any  `json:"stream,omitempty"`
}

StubOutput defines model for StubOutput.

type TooManyValuesForParamError

type TooManyValuesForParamError struct {
	ParamName string
	Count     int
}

func (*TooManyValuesForParamError) Error

type UnescapedCookieParamError

type UnescapedCookieParamError struct {
	ParamName string
	Err       error
}

func (*UnescapedCookieParamError) Error

func (e *UnescapedCookieParamError) Error() string

func (*UnescapedCookieParamError) Unwrap

func (e *UnescapedCookieParamError) Unwrap() error

type UnmarshalingParamError

type UnmarshalingParamError struct {
	ParamName string
	Err       error
}

func (*UnmarshalingParamError) Error

func (e *UnmarshalingParamError) Error() string

func (*UnmarshalingParamError) Unwrap

func (e *UnmarshalingParamError) Unwrap() error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址