MCPcopy
hub / github.com/danielgtaylor/huma / YAML

Method YAML

openapi.go:1575–1582  ·  view source on GitHub ↗

YAML returns the OpenAPI represented as YAML without needing to include a library to serialize YAML.

()

Source from the content-addressed store, hash-verified

1573// YAML returns the OpenAPI represented as YAML without needing to include a
1574// library to serialize YAML.
1575func (o *OpenAPI) YAML() ([]byte, error) {
1576 specJSON, err := json.Marshal(o)
1577 buf := bytes.NewBuffer([]byte{})
1578 if err == nil {
1579 err = yaml.Convert(buf, bytes.NewReader(specJSON))
1580 }
1581 return buf.Bytes(), err
1582}
1583
1584func downgradeSpec(input any) {
1585 switch value := input.(type) {

Callers 4

TestOpenAPIMarshalFunction · 0.95
NewAPIFunction · 0.80
TestFeaturesFunction · 0.80
mainFunction · 0.80

Calls 3

ConvertFunction · 0.92
BytesMethod · 0.80
MarshalMethod · 0.65

Tested by 2

TestOpenAPIMarshalFunction · 0.76
TestFeaturesFunction · 0.64