fromjson

package
v0.0.0-...-33be302 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2024 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromJSON

func FromJSON(input map[string]interface{}) (typeDef string, err error)

FromJSON takes a JSON map and generates a CUE type which validates the given values. Because this works backwards from values, it will never generate constraints and will likely contain errors with eg. null values. However, the cue type that it generates is a good starting point for customizing and creating a properly defined type for the value.

This produces a struct with no top-level identifier:

{
   name: string
}

NOTE: Because maps are unordered in Go, the resulting type will have fields returned in no specific order. The type will, however, match the iteration order from Go.

Types

This section is empty.

Jump to

Keyboard shortcuts

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