YAML returns the OpenAPI represented as YAML without needing to include a library to serialize YAML.
()
| 1573 | // YAML returns the OpenAPI represented as YAML without needing to include a |
| 1574 | // library to serialize YAML. |
| 1575 | func (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 | |
| 1584 | func downgradeSpec(input any) { |
| 1585 | switch value := input.(type) { |