openapi

package
v0.19.0 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2023 License: Apache-2.0 Imports: 5 Imported by: 1

Documentation

Index

Constants

View Source
const MediaTypeNonJsonBodyFieldName = "contents"

Variables

This section is empty.

Functions

This section is empty.

Types

type Binding

type Binding struct {
	Request  string `json:"request,omitempty"`
	Response string `json:"response,omitempty"`
}

Binding is a relationship between request and/or response

type Body

type Body struct {
	Node
	Required bool                 `json:"required,omitempty"`
	Content  map[string]MediaType `json:"content,omitempty"`
}

func (*Body) MimeTypeAndMediaType added in v0.18.0

func (b *Body) MimeTypeAndMediaType() (MimeType, *MediaType)

type Components

type Components struct {
	Node
	Parameters refs[*Parameter] `json:"parameters,omitempty"`
	Responses  refs[*Body]      `json:"responses,omitempty"`
	Schemas    refs[*Schema]    `json:"schemas,omitempty"`
}

type MediaType added in v0.18.0

type MediaType struct {
	Node
	Schema *Schema `json:"schema,omitempty"`
}

func (*MediaType) GetSchema added in v0.18.0

func (m *MediaType) GetSchema() *Schema

type MimeType added in v0.18.0

type MimeType string
const (
	MimeTypeJson        MimeType = "application/json"
	MimeTypeOctetStream MimeType = "application/octet-stream"
)

func (MimeType) IsByteStream added in v0.18.0

func (m MimeType) IsByteStream() bool

IsByteStream returns true if the body should be modeled as a byte stream. Today, we only support application/json and application/octet-stream, and non application/json entities are all modeled as byte streams.

type Node

type Node struct {
	Description string `json:"description,omitempty"`
	Preview     string `json:"x-databricks-preview,omitempty"`
	Ref         string `json:"$ref,omitempty"`
}

func (*Node) Component

func (n *Node) Component() string

Components is the basename of the reference path. Usually a class name

func (*Node) IsRef

func (n *Node) IsRef() bool

IsRef flags object being a reference to a component

type Operation

type Operation struct {
	Node
	Wait       *Wait       `json:"x-databricks-wait,omitempty"`
	Pagination *Pagination `json:"x-databricks-pagination,omitempty"`
	Shortcut   bool        `json:"x-databricks-shortcut,omitempty"`
	Crud       string      `json:"x-databricks-crud,omitempty"`
	JsonOnly   bool        `json:"x-databricks-cli-json-only,omitempty"`

	// The x-databricks-path-style field indicates whether the operation has a
	// RESTful path style or a RPC style. When specified, this overrides the
	// service-level setting. Valid values are "rest" and "rpc". "rest" means
	// that the operation has a RESTful path style, i.e. the path represents
	// a resource and the HTTP method represents an action on the resource.
	// "rpc" means that the operation has a RPC style, i.e. the path represents
	// an action and the request body represents the resource.
	PathStyle PathStyle `json:"x-databricks-path-style,omitempty"`

	// The x-databricks-request-type-name field defines the name to use for
	// the request type in the generated client. This may be specified only
	// if the operation does NOT have a request body, thus only uses a request
	// type to encapsulate path and query parameters.
	RequestTypeName string `json:"x-databricks-request-type-name,omitempty"`

	// For list APIs, the path to the field in the response entity that contains
	// the resource ID.
	IdField fieldPath `json:"x-databricks-id,omitempty"`

	// For list APIs, the path to the field in the response entity that contains
	// the user-friendly name of the resource.
	NameField fieldPath `json:"x-databricks-name,omitempty"`

	Summary     string           `json:"summary,omitempty"`
	OperationId string           `json:"operationId"`
	Tags        []string         `json:"tags"`
	Parameters  []Parameter      `json:"parameters,omitempty"`
	Responses   map[string]*Body `json:"responses"`
	RequestBody *Body            `json:"requestBody,omitempty"`
}

Operation is the equivalent of method

func (*Operation) HasIdentifierField added in v0.13.0

func (o *Operation) HasIdentifierField() bool

func (*Operation) HasNameField added in v0.13.0

func (o *Operation) HasNameField() bool

func (*Operation) HasTag

func (o *Operation) HasTag(tag string) bool

func (*Operation) Name

func (o *Operation) Name() string

Name is picking the last element of <ServiceName>.<method> string, that is coming in as part of Databricks OpenAPI spec.

func (*Operation) SuccessResponseBody added in v0.18.0

func (o *Operation) SuccessResponseBody(c *Components) *Body

type Pagination

type Pagination struct {
	Offset    string   `json:"offset,omitempty"`
	Limit     string   `json:"limit,omitempty"`
	Results   string   `json:"results,omitempty"`
	Increment int      `json:"increment,omitempty"`
	Inline    bool     `json:"inline,omitempty"`
	Token     *Binding `json:"token,omitempty"`
}

Pagination is the Databricks OpenAPI Extension for retrieving lists of entities through multiple API calls

type Parameter

type Parameter struct {
	Node
	Required     bool    `json:"required,omitempty"`
	In           string  `json:"in,omitempty"`
	Name         string  `json:"name,omitempty"`
	MultiSegment bool    `json:"x-databricks-multi-segment,omitempty"`
	Schema       *Schema `json:"schema,omitempty"`
}

type Path

type Path struct {
	Node
	Parameters []Parameter `json:"parameters,omitempty"`
	Get        *Operation  `json:"get,omitempty"`
	Post       *Operation  `json:"post,omitempty"`
	Put        *Operation  `json:"put,omitempty"`
	Patch      *Operation  `json:"patch,omitempty"`
	Delete     *Operation  `json:"delete,omitempty"`
}

func (*Path) Verbs

func (path *Path) Verbs() map[string]*Operation

Verbs returns a map of HTTP methods for a Path

type PathStyle added in v0.14.1

type PathStyle string
const (
	// PathStyleRpc indicates that the endpoint is an RPC-style endpoint.
	// The endpoint path is an action, and the entity to act on is specified
	// in the request body.
	PathStyleRpc PathStyle = "rpc"

	// PathStyleRest indicates that the endpoint is a REST-style endpoint.
	// The endpoint path is a resource, and the operation to perform on the
	// resource is specified in the HTTP method.
	PathStyleRest PathStyle = "rest"
)

func (*PathStyle) UnmarshalJSON added in v0.14.1

func (r *PathStyle) UnmarshalJSON(data []byte) error

type Schema

type Schema struct {
	Node
	IsComputed       bool               `json:"x-databricks-computed,omitempty"`
	IsAny            bool               `json:"x-databricks-any,omitempty"`
	Type             string             `json:"type,omitempty"`
	Enum             []string           `json:"enum,omitempty"`
	AliasEnum        []string           `json:"x-databricks-alias-enum,omitempty"`
	EnumDescriptions map[string]string  `json:"x-databricks-enum-descriptions,omitempty"`
	Default          any                `json:"default,omitempty"`
	Example          any                `json:"example,omitempty"`
	Format           string             `json:"format,omitempty"`
	Required         []string           `json:"required,omitempty"`
	Properties       map[string]*Schema `json:"properties,omitempty"`
	ArrayValue       *Schema            `json:"items,omitempty"`
	MapValue         *Schema            `json:"additionalProperties,omitempty"`
}

func (*Schema) IsArray

func (s *Schema) IsArray() bool

func (*Schema) IsDefinable

func (s *Schema) IsDefinable() bool

IsDefinable states that type could be translated into a valid top-level type in Go, Python, Java, Scala, and JavaScript

func (*Schema) IsEmpty

func (s *Schema) IsEmpty() bool

func (*Schema) IsEnum

func (s *Schema) IsEnum() bool

func (*Schema) IsMap

func (s *Schema) IsMap() bool

func (*Schema) IsObject

func (s *Schema) IsObject() bool

type Specification

type Specification struct {
	Node
	Paths      map[string]Path `json:"paths"`
	Components *Components     `json:"components"`
	Tags       []Tag           `json:"tags"`
}

func NewFromReader

func NewFromReader(r io.Reader) (*Specification, error)

type Tag

type Tag struct {
	Node
	Package    string    `json:"x-databricks-package"`
	PathStyle  PathStyle `json:"x-databricks-path-style"`
	Service    string    `json:"x-databricks-service"`
	IsAccounts bool      `json:"x-databricks-is-accounts"`
	Name       string    `json:"name"`
}

type Wait

type Wait struct {
	Poll         string             `json:"poll"`
	Bind         string             `json:"bind"`
	BindResponse string             `json:"bindResponse,omitempty"`
	Binding      map[string]Binding `json:"binding,omitempty"`
	Field        []string           `json:"field"`
	Message      []string           `json:"message"`
	Success      []string           `json:"success"`
	Failure      []string           `json:"failure"`
	Timeout      int                `json:"timeout,omitempty"`
}

Wait is the Databricks OpenAPI Extension for long-running result polling

Directories

Path Synopsis
Package holds higher-level abstractions on top of OpenAPI that are used to generate code via text/template for Databricks SDK in different languages.
Package holds higher-level abstractions on top of OpenAPI that are used to generate code via text/template for Databricks SDK in different languages.
Usage: openapi-codegen
Usage: openapi-codegen

Jump to

Keyboard shortcuts

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