Documentation ¶
Index ¶
- func JSONDoc(path string) (json.RawMessage, error)
- type DocLoader
- type DocLoaderWithMatch
- type DocMatcher
- type Document
- func Analyzed(data json.RawMessage, version string, options ...LoaderOption) (*Document, error)
- func Embedded(orig, flat json.RawMessage, options ...LoaderOption) (*Document, error)
- func JSONSpec(path string, options ...LoaderOption) (*Document, error)
- func Spec(path string, options ...LoaderOption) (*Document, error)
- type LoaderOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DocLoader ¶
type DocLoader func(string) (json.RawMessage, error)
DocLoader represents a doc loader type
type DocLoaderWithMatch ¶
type DocLoaderWithMatch struct { Fn DocLoader Match DocMatcher }
DocLoaderWithMatch describes a loading function for a given extension match.
func NewDocLoaderWithMatch ¶
func NewDocLoaderWithMatch(fn DocLoader, matcher DocMatcher) DocLoaderWithMatch
NewDocLoaderWithMatch builds a DocLoaderWithMatch to be used in load options
type DocMatcher ¶
DocMatcher represents a predicate to check if a loader matches
type Document ¶
type Document struct {
// contains filtered or unexported fields
}
Document represents a swagger spec document
func Analyzed ¶
func Analyzed(data json.RawMessage, version string, options ...LoaderOption) (*Document, error)
Analyzed creates a new analyzed spec document for a root json.RawMessage.
func Embedded ¶
func Embedded(orig, flat json.RawMessage, options ...LoaderOption) (*Document, error)
Embedded returns a Document based on embedded specs. No analysis is required
func JSONSpec ¶
func JSONSpec(path string, options ...LoaderOption) (*Document, error)
JSONSpec load a spec from a json document
func Spec ¶
func Spec(path string, options ...LoaderOption) (*Document, error)
Spec load a new spec document from a local or remote path
func (*Document) Compose ¶
func (d *Document) Compose(options ...*oapi.ExpandOptions) (*Document, error)
Compose composes the ref fields in the spec document and returns a new spec document
func (*Document) Pristine ¶
Pristine creates a new pristine document instance based on the input data
func (*Document) Raw ¶
func (d *Document) Raw() json.RawMessage
Raw returns the raw swagger spec as json bytes
type LoaderOption ¶
type LoaderOption func(*options)
LoaderOption allows to fine-tune the spec loader behavior
func WithDocLoader ¶
func WithDocLoader(l DocLoader) LoaderOption
WithDocLoader sets a custom loader for loading specs
func WithDocLoaderMatches ¶
func WithDocLoaderMatches(l ...DocLoaderWithMatch) LoaderOption
WithDocLoaderMatches sets a chain of custom loaders for loading specs for different extension matches.
Loaders are executed in the order of provided DocLoaderWithMatch'es.