MCPcopy Create free account
hub / github.com/a-h/rest / API

Struct API

api.go:121–154  ·  view source on GitHub ↗

API is a model of a REST API's routes, along with their request and response types.

Source from the content-addressed store, hash-verified

119// API is a model of a REST API's routes, along with their
120// request and response types.
121type API struct {
122 // Name of the API.
123 Name string
124 // Routes of the API.
125 // From patterns, to methods, to route.
126 Routes map[Pattern]MethodToRoute
127 // StripPkgPaths to strip from the type names in the OpenAPI output to avoid
128 // leaking internal implementation details such as internal repo names.
129 //
130 // This increases the risk of type clashes in the OpenAPI output, i.e. two types
131 // in different namespaces that are set to be stripped, and have the same type Name
132 // could clash.
133 //
134 // Example values could be "github.com/a-h/rest".
135 StripPkgPaths []string
136
137 // Models are the models that are in use in the API.
138 // It's possible to customise the models prior to generation of the OpenAPI specification
139 // by editing this value.
140 models map[string]*openapi3.Schema
141
142 // KnownTypes are added to the OpenAPI specification output.
143 // The default implementation:
144 // Maps time.Time to a string.
145 KnownTypes map[reflect.Type]openapi3.Schema
146
147 // comments from the package. This can be cleared once the spec has been created.
148 comments map[string]map[string]string
149
150 // ApplyCustomSchemaToType callback to customise the OpenAPI specification for a given type.
151 // Apply customisation to a specific type by checking the t parameter.
152 // Apply customisations to all types by ignoring the t parameter.
153 ApplyCustomSchemaToType func(t reflect.Type, s *openapi3.Schema)
154}
155
156// Merge route data into the existing configuration.
157// This is typically used by adapters, such as the chiadapter

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected