Documentation
¶
Index ¶
- func GetOpenAPISpecMarshaller(openApi *huma.OpenAPI, version OpenAPIVersion, format OpenAPIFormat) (marshaller func() ([]byte, error), contentType string, err error)
- type OpenAPIFormat
- type OpenAPIVersion
- type SchemaRequest
- type StreamResponseHandler
- func GetDocsHandler(openAPI *huma.OpenAPI, openAPIYamlPath string) StreamResponseHandler[*struct{}]
- func GetOpenAPISpecHandler(openApi *huma.OpenAPI, version OpenAPIVersion, format OpenAPIFormat) (StreamResponseHandler[*struct{}], error)
- func GetSchemaHandler(openAPI *huma.OpenAPI, schemasPath string) StreamResponseHandler[*SchemaRequest]
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetOpenAPISpecMarshaller ¶ added in v1.0.0
func GetOpenAPISpecMarshaller( openApi *huma.OpenAPI, version OpenAPIVersion, format OpenAPIFormat, ) (marshaller func() ([]byte, error), contentType string, err error)
GetOpenAPISpecMarshaller returns a marshaller function that will return OpenAPI spec in the requested format and version.
Types ¶
type OpenAPIFormat ¶
type OpenAPIFormat string
const ( OpenAPIFormatJSON OpenAPIFormat = "json" OpenAPIFormatYAML OpenAPIFormat = "yaml" )
type OpenAPIVersion ¶
type OpenAPIVersion string
const ( OpenAPIVersion3dot0 OpenAPIVersion = "3.0" OpenAPIVersion3dot1 OpenAPIVersion = "3.1" )
type SchemaRequest ¶ added in v1.0.0
type SchemaRequest struct {
SchemaPath string `path:"schemaPath"`
}
type StreamResponseHandler ¶ added in v1.0.0
func GetDocsHandler ¶ added in v1.0.0
func GetDocsHandler(openAPI *huma.OpenAPI, openAPIYamlPath string) StreamResponseHandler[*struct{}]
GetDocsHandler returns a handler that will return HTML page that renders OpenAPI spec from the specified `openAPIYamlPath` URL. The handler format is suitable for passing it to huma or hureg registration functions.
func GetOpenAPISpecHandler ¶ added in v1.0.0
func GetOpenAPISpecHandler( openApi *huma.OpenAPI, version OpenAPIVersion, format OpenAPIFormat, ) (StreamResponseHandler[*struct{}], error)
GetOpenAPISpecHandler returns a handler that will return OpenAPI spec in the requested format and version. The handler format is suitable for passing it to huma or hureg registration functions
func GetSchemaHandler ¶ added in v1.0.0
func GetSchemaHandler(openAPI *huma.OpenAPI, schemasPath string) StreamResponseHandler[*SchemaRequest]
GetSchemaHandler returns a handler that will return a schema from the OpenAPI spec. The handler format is suitable for passing it to huma or hureg registration functions. `schemasPath` is a prefix to that will be added to all schema refs in the returned schema.