Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func OpenAPIJSON ¶
OpenAPIJSON marshals the Huma-generated OpenAPI document.
func WriteOpenAPI ¶
WriteOpenAPI writes the Huma-generated OpenAPI document to path.
Types ¶
type CreateWidgetBody ¶
type CreateWidgetBody struct {
Name string `json:"name" minLength:"1" maxLength:"80" example:"Second widget" doc:"Human-readable widget name"`
Color string `json:"color,omitempty" maxLength:"30" example:"green" doc:"Optional display color"`
}
CreateWidgetBody is the typed JSON request body for POST /widgets.
type Server ¶
Server is the M0-2 spike surface that proves Huma can share a Gin router with raw Gin-only routes.
func NewServerWithStore ¶
func NewServerWithStore(store *WidgetStore) *Server
NewServerWithStore creates a spike server backed by the provided store.
type SuccessEnvelope ¶
type SuccessEnvelope[T any] struct { Data T `json:"data"` }
SuccessEnvelope is the D10 success response shape used by the spike routes.
type Widget ¶
type Widget struct {
ID string `json:"id" example:"widget-1" doc:"Stable widget identifier"`
Name string `json:"name" example:"First widget" doc:"Human-readable widget name"`
Color string `json:"color,omitempty" example:"blue" doc:"Optional display color"`
}
Widget is the sample typed resource used by the contract spike.
type WidgetStore ¶
type WidgetStore struct {
// contains filtered or unexported fields
}
WidgetStore is a concurrency-safe in-memory store for the spike handlers.
func NewWidgetStore ¶
func NewWidgetStore(seed []Widget) *WidgetStore
NewWidgetStore creates an in-memory widget store seeded with the provided widgets.
func (*WidgetStore) Create ¶
func (s *WidgetStore) Create(body CreateWidgetBody) Widget
Create stores a widget from the provided request body and returns it.
func (*WidgetStore) List ¶
func (s *WidgetStore) List() []Widget
List returns a copy of the stored widgets.