spec

package
v1.13.15 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2022 License: MIT Imports: 12 Imported by: 1

Documentation

Overview

MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetExampleResponse added in v1.1.0

func GetExampleResponse(mediaType *openapi3.MediaType) interface{}

GetExampleResponse returns a single example response from the given operation if one exists.

func GetOptions

func GetOptions(spec *openapi3.T) (*options.Options, error)

GetOptions would retrieve and parse x-kusk OpenAPI extension that contains Kusk options. If there's no extension found, an empty object will be returned. For each found method in the document top and path level x-kusk options will be merged in to form OperationFinalSubOptions map that has the complete configuration for each method.

func PostProcessedDef added in v1.1.0

func PostProcessedDef(apiSpec openapi3.T, opt options.Options) *openapi3.T

Types

type Loader

type Loader interface {
	LoadFromURI(location *url.URL) (*openapi3.T, error)
	LoadFromFile(location string) (*openapi3.T, error)
}

type Parser

type Parser struct {
	// contains filtered or unexported fields
}

func NewParser

func NewParser(loader Loader) Parser

func (Parser) Parse

func (p Parser) Parse(path string) (*openapi3.T, error)

Parse is the entrypoint for the spec package Accepts a path that should be parseable into a resource locater i.e. a URL or relative file path

func (Parser) ParseFromReader

func (p Parser) ParseFromReader(contents io.Reader) (*openapi3.T, error)

ParseFromReader allows for providing your own Reader implementation to parse the API spec from

Jump to

Keyboard shortcuts

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