Help us shape the future of Go! Take the 2026 Go Developer Survey

jsonschema

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2026 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package jsonschema reads the JSON Schemas Flowi keeps from OpenAPI documents (already decoded, references inlined): types, allOf merging, and whether a path of steps exists in a schema.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MergeAllOf

func MergeAllOf(s map[string]any) map[string]any

MergeAllOf folds allOf branches into one schema (properties and required combined); other keys of the outer schema win.

func Type

func Type(s map[string]any) string

Type is a schema's type; OpenAPI 3.1 type lists give their first non-null entry, and a schema with properties is an object.

Types

type Result

type Result int

Result is what a schema says about a path.

const (
	Present Result = iota // the schema has it
	Absent                // the schema rules it out
	Unknown               // the schema allows anything there
)

Results.

func Lookup

func Lookup(schema any, steps []string) Result

Lookup says whether the path of steps (object keys, array indexes) exists in schema. A property not listed is Absent even when additionalProperties is not false: the contract is what the schema documents. An untyped {} schema, an object listing no properties, and additionalProperties as a schema or true are Unknown. anyOf/oneOf branches are judged together with the properties beside them.

Jump to

Keyboard shortcuts

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