openapi

package
v0.10.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

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]Example `json:"content,omitempty"`
}

func (*Body) Schema

func (b *Body) Schema() *Schema

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 Example

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

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"`
	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) 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) SuccessResponseSchema

func (o *Operation) SuccessResponseSchema(c *Components) *Schema

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"`
	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 Schema

type Schema struct {
	Node
	IsIdentifier     bool               `json:"x-databricks-id,omitempty"`
	IsName           bool               `json:"x-databricks-name,omitempty"`
	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  string `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