Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultTextFormat = huma.Format{ Marshal: func(w io.Writer, v any) error { if m, ok := v.(encoding.TextMarshaler); ok { b, err := m.MarshalText() if err != nil { return err } _, err = w.Write(b) return err } _, err := w.Write([]byte(fmt.Sprint(v))) return err }, Unmarshal: func(data []byte, v any) error { if m, ok := v.(encoding.TextUnmarshaler); ok { return m.UnmarshalText(data) } return huma.Error501NotImplemented("text format not supported") }, }
DefaultTextFormat is the default text formatter that can be set in the API's `Config.Formats` map. This is usually not needed as importing this package automatically adds the text format to the default formats.
config := huma.Config{} config.Formats = map[string]huma.Format{ "plain/text": huma.DefaultTextFormat, "text": huma.DefaultTextFormat, }
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.