gocuelang.org/go/encoding/openapi Index | Files

package openapi

import "cuelang.org/go/encoding/openapi"

Package openapi provides functionality for mapping CUE to and from OpenAPI v3.0.0.

It currently handles OpenAPI Schema components only.

See https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#schemaObject.

Index

Functions

func Gen

func Gen(inst *cue.Instance, c *Config) ([]byte, error)

Gen generates the set OpenAPI schema for all top-level types of the given instance.

Types

type Config

type Config struct {
	// ReferenceFunc allows users to specify an alternative representation
	// for references.
	ReferenceFunc func(inst *cue.Instance, path []string) string

	// SelfContained causes all non-expanded external references to be included
	// in this document.
	SelfContained bool

	// ExpandReferences replaces references with actual objects when generating
	// OpenAPI Schema. It is an error for an CUE value to refer to itself
	// when this object is used.
	ExpandReferences bool
}

A Config defines options for mapping CUE to and from OpenAPI.

Source Files

build.go doc.go errors.go openapi.go orderedmap.go types.go

Version
v0.0.4-rc1
Published
Jul 1, 2019
Platform
linux/amd64
Imports
13 packages
Last checked
1 hour ago

Tools for package owners.