Documentation ¶
Overview ¶
Package loads provides document loading methods for swagger (OAI) specifications.
It is used by other go-openapi packages to load and run analysis on local or remote spec documents.
Index ¶
- func AddLoader(predicate DocMatcher, load DocLoader)
- func JSONDoc(path string) (json.RawMessage, error)
- type DocLoader
- type DocMatcher
- type Document
- func (d *Document) BasePath() string
- func (d *Document) Expanded(options ...*spec.ExpandOptions) (*Document, error)
- func (d *Document) Host() string
- func (d *Document) OrigSpec() *spec.Swagger
- func (d *Document) Pristine() *Document
- func (d *Document) Raw() json.RawMessage
- func (d *Document) ResetDefinitions() *Document
- func (d *Document) Schema() *spec.Schema
- func (d *Document) Spec() *spec.Swagger
- func (d *Document) SpecFilePath() string
- func (d *Document) Version() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func JSONDoc ¶
func JSONDoc(path string) (json.RawMessage, error)
JSONDoc loads a json document from either a file or a remote url
Types ¶
type DocLoader ¶
type DocLoader func(string) (json.RawMessage, error)
DocLoader represents a doc loader type
type DocMatcher ¶
DocMatcher represents a predicate to check if a loader matches
type Document ¶
type Document struct { // specAnalyzer Analyzer *analysis.Spec // contains filtered or unexported fields }
Document represents a swagger spec document
func Analyzed ¶
func Analyzed(data json.RawMessage, version string) (*Document, error)
Analyzed creates a new analyzed spec document
func Embedded ¶
func Embedded(orig, flat json.RawMessage) (*Document, error)
Embedded returns a Document based on embedded specs. No analysis is required
func JSONSpec ¶
JSONSpec loads a spec from a json document
func (*Document) BasePath ¶
BasePath the base path for this spec
func (*Document) Expanded ¶
func (d *Document) Expanded(options ...*spec.ExpandOptions) (*Document, error)
Expanded expands the ref fields in the spec document and returns a new spec document
func (*Document) OrigSpec ¶
OrigSpec yields the original spec
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
func (*Document) ResetDefinitions ¶
ResetDefinitions gives a shallow copy with the models reset
func (*Document) Schema ¶
Schema returns the swagger 2.0 schema
func (*Document) Spec ¶
Spec returns the swagger spec object model
func (*Document) SpecFilePath ¶
SpecFilePath returns the file path of the spec if one is defined