microcks

package
v0.0.0-...-f6e7c46 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RenderApiExamples

func RenderApiExamples(apiExamples *APIExamples, w io.Writer) error

Function to execute the template

Types

type APIExamples

type APIExamples struct {
	APIVersion string                        `json:"apiVersion" yaml:"apiVersion"`
	Kind       string                        `json:"kind" yaml:"kind"`
	Metadata   Metadata                      `json:"metadata" yaml:"metadata"`
	Operations map[OperationName]ExampleItem `json:"operations" yaml:"operations"`
}

func GenerateAPIExamples

func GenerateAPIExamples(ctx context.Context, spec []byte) (*APIExamples, error)

Function to load OpenAPI file, generate examples, and construct APIExamples struct

type ExampleItem

type ExampleItem struct {
	Request  Request  `json:"request" yaml:"request"`
	Response Response `json:"response" yaml:"response"`
}

type Metadata

type Metadata struct {
	Name    string `json:"name" yaml:"name"`
	Version string `json:"version" yaml:"version"`
}

type OperationName

type OperationName struct {
	Verb string
	Path string
}

func (OperationName) String

func (o OperationName) String() string

String method implements the Stringer interface

type Request

type Request struct {
	Parameters map[string]interface{} `json:"parameters,omitempty" yaml:"parameters,omitempty"`
	Headers    map[string]interface{} `json:"headers,omitempty" yaml:"headers,omitempty"`
	Body       interface{}            `json:"body,omitempty" yaml:"body,omitempty"`
}

type Response

type Response struct {
	Headers   map[string]interface{} `json:"headers,omitempty" yaml:"headers,omitempty"`
	MediaType string                 `json:"mediaType,omitempty" yaml:"mediaType,omitempty"`
	Code      string                 `json:"code,omitempty" yaml:"code,omitempty"`
	Body      interface{}            `json:"body,omitempty" yaml:"body,omitempty"`
}

Jump to

Keyboard shortcuts

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