yaml

package
v0.6.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 14, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package yaml converts JSON documents (the form produced by the OpenAPI emitters) to YAML. It is a minimal, hand-rolled converter that supports only the values the emitters produce: objects, arrays, strings, numbers, booleans, and null.

For round-trip verification against a real YAML parser, see the separate test module at internal/spec/yaml/roundtrip_test (kept out of the main module so gopkg.in/yaml.v3 never appears in the dependency graph).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromJSON

func FromJSON(jsonBytes []byte) ([]byte, error)

FromJSON converts JSON bytes to YAML bytes. It supports only the subset of values that the OpenAPI emitters produce: objects, arrays, strings, numbers, booleans, and null.

The input JSON is decoded with json.Number preserved, so integers of any magnitude survive the conversion verbatim. Keys in objects are sorted alphabetically for stable output (matching the key order encoding/json produces for the JSON endpoint).

This is a deliberately minimal implementation: there is no support for anchors, custom tags, or other advanced YAML features. It is sufficient for emitting OpenAPI specs as YAML.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL