librest

package
v0.0.0-...-ec57856 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenSchema

func GenSchema(data []*SchemaData) string

GenSchema will generate the GraphqlQL schema from a list of SchemaData

func GenSwaggerSpec

func GenSwaggerSpec(specData *SwaggerSpecData) string

Types

type Definition

type Definition struct {
	Application   libapplication.AggregateInterface
	GenDomain     string
	Create        *RequestConfig
	Update        *RequestConfig
	Delete        *RequestConfig
	CustomFuncs   []*libdomain.CustomCommand
	DisableSelect bool
	DisableCreate bool
	DisableUpdate bool
	DisableDelete bool
	Event         bool
}

Definition is used to declare the information of a model, so it can generate its code.

type Definitions

type Definitions struct {
	Prefix     string
	Name       string
	Repository string
	Tenant     bool
	Auth       bool
	// contains filtered or unexported fields
}

Definitions contains all the graphql definitions in the service.

func (*Definitions) GetByID

func (ds *Definitions) GetByID(id string) *Definition

GetByID return the specified definition by its ID.

func (*Definitions) GetTitle

func (ds *Definitions) GetTitle() string

GetTitle is used to return the name of the definition with InitCap

func (*Definitions) Register

func (ds *Definitions) Register(d *Definition)

Register is used to register a new definition into the service.

func (*Definitions) Slice

func (ds *Definitions) Slice() []*Definition

Slice return the definitions as a slice.

type RequestConfig

type RequestConfig struct{}

type SchemaData

type SchemaData struct {
	Name        string
	Title       string
	Definitions *Definitions
	Data        []struct {
		Def         *Definition
		Tenant      bool
		Event       bool
		Model       *libdomain.AggregateDefinition
		CustomFuncs []*libdomain.CustomCommand
	}
}

SchemaData is the main struct to use to declare the GraphQL Schema

type SwaggerDefinition

type SwaggerDefinition struct {
	Type       string                      `yaml:"type"`
	Required   []string                    `yaml:"required"`
	Properties map[string]*SwaggerProperty `yaml:"properties"`
}

type SwaggerInfo

type SwaggerInfo struct {
	Description string `yaml:"description"`
	Title       string `yaml:"title"`
	Version     string `yaml:"version"`
}

type SwaggerParams

type SwaggerParams struct {
	Name        string         `yaml:"name"`
	In          string         `yaml:"in"`
	Type        string         `yaml:"type"`
	Required    bool           `yaml:"required"`
	Description string         `yaml:"description"`
	Schema      *SwaggerSchema `yaml:"schema"`
}

type SwaggerProperty

type SwaggerProperty struct {
	Type     string `yaml:"type"`
	Format   string `yaml:"format"`
	Readonly bool   `yaml:"readOnly"`
}

type SwaggerRequest

type SwaggerRequest struct {
	OperationID string                      `yaml:"operationId"`
	Parameters  []*SwaggerParams            `yaml:"parameters"`
	Responses   map[string]*SwaggerResponse `yaml:"responses"`
}

type SwaggerResponse

type SwaggerResponse struct {
	Description string         `yaml:"description"`
	Schema      *SwaggerSchema `yaml:"schema"`
}

type SwaggerSchema

type SwaggerSchema struct {
	Type  string         `yaml:"type"`
	Items *SwaggerSchema `yaml:"items"`
	Ref   string         `yaml:"$ref"`
}

type SwaggerSpec

type SwaggerSpec struct {
	Swagger     string                            `yaml:"swagger"`
	BasePath    string                            `yaml:"basePath"`
	Info        *SwaggerInfo                      `yaml:"info"`
	Paths       map[string]map[string]interface{} `yaml:"paths"`
	Definitions map[string]*SwaggerDefinition     `yaml:"definitions"`
}

type SwaggerSpecData

type SwaggerSpecData struct {
	Name  string
	Datas []*SchemaData
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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