parser

package
v1.0.106 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package parser parses OpenAPI specifications, extracts all the information needed to create the CLI commands and parameters.

Index

Constants

View Source
const (
	ParameterTypeString       = "string"
	ParameterTypeBinary       = "binary"
	ParameterTypeInteger      = "integer"
	ParameterTypeNumber       = "number"
	ParameterTypeBoolean      = "boolean"
	ParameterTypeObject       = "object"
	ParameterTypeStringArray  = "stringArray"
	ParameterTypeIntegerArray = "integerArray"
	ParameterTypeNumberArray  = "numberArray"
	ParameterTypeBooleanArray = "booleanArray"
	ParameterTypeObjectArray  = "objectArray"
)
View Source
const (
	ParameterInPath   = "path"
	ParameterInQuery  = "query"
	ParameterInHeader = "header"
	ParameterInBody   = "body"
	ParameterInForm   = "form"
	ParameterInCustom = "custom"
)
View Source
const CustomNameExtension = "x-uipathcli-name"
View Source
const DefaultServerBaseUrl = "https://cloud.uipath.com"
View Source
const RawBodyParameterName = "$file"

Variables

This section is empty.

Functions

This section is empty.

Types

type Definition

type Definition struct {
	Name        string
	Description string
	Operations  []Operation
}

The Definition provides the high-level information about all operations of the service

func NewDefinition

func NewDefinition(name string, description string, operations []Operation) *Definition

type OpenApiParser

type OpenApiParser struct{}

The OpenApiParser parses OpenAPI (2.x and 3.x) specifications. It creates the Definition structure with all the information about the available operations and their parameters for the given service specification.

func NewOpenApiParser

func NewOpenApiParser() *OpenApiParser

func (OpenApiParser) Parse

func (p OpenApiParser) Parse(name string, data []byte) (*Definition, error)

type Operation

type Operation struct {
	Name        string
	Summary     string
	Description string
	Method      string
	BaseUri     url.URL
	Route       string
	ContentType string
	Parameters  []Parameter
	Plugin      plugin.CommandPlugin
	Hidden      bool
	Category    *OperationCategory
}

The Operation is the definition of a route which can be called by the CLI.

It holds all the information needed to make the call, like HTTP method, Route, Parameters, etc...

func NewOperation

func NewOperation(name string, summary string, description string, method string, baseUri url.URL, route string, contentType string, parameters []Parameter, plugin plugin.CommandPlugin, hidden bool, category *OperationCategory) *Operation

type OperationCategory

type OperationCategory struct {
	Name        string
	Description string
}

OperationCategory allows grouping multiple operations under a common resource.

func NewOperationCategory

func NewOperationCategory(name string, description string) *OperationCategory

type Parameter

type Parameter struct {
	Name          string
	Type          string
	Description   string
	In            string
	FieldName     string
	Required      bool
	DefaultValue  interface{}
	AllowedValues []interface{}
	Parameters    []Parameter
}

Parameter contains all the information about a parameter for an operation.

func NewParameter

func NewParameter(name string, t string, description string, in string, fieldName string, required bool, defaultValue interface{}, allowedValues []interface{}, parameters []Parameter) *Parameter

func (Parameter) IsArray

func (p Parameter) IsArray() bool

type Parser

type Parser interface {
	Parse(name string, data []byte) (*Definition, error)
}

The Parser interface provides an abstraction for parsing the service definition files. It returns a structured Definition document with all the operations and parameters of the service.

Jump to

Keyboard shortcuts

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