loads: github.com/go-openapi/loads Index | Files | Directories

package loads

import "github.com/go-openapi/loads"

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

Package Files

doc.go spec.go

func AddLoader Uses

func AddLoader(predicate DocMatcher, load DocLoader)

AddLoader for a document

func JSONDoc Uses

func JSONDoc(path string) (json.RawMessage, error)

JSONDoc loads a json document from either a file or a remote url

type DocLoader Uses

type DocLoader func(string) (json.RawMessage, error)

DocLoader represents a doc loader type

type DocMatcher Uses

type DocMatcher func(string) bool

DocMatcher represents a predicate to check if a loader matches

type Document Uses

type Document struct {
    // specAnalyzer
    Analyzer *analysis.Spec
    // contains filtered or unexported fields
}

Document represents a swagger spec document

func Analyzed Uses

func Analyzed(data json.RawMessage, version string) (*Document, error)

Analyzed creates a new analyzed spec document

func Embedded Uses

func Embedded(orig, flat json.RawMessage) (*Document, error)

Embedded returns a Document based on embedded specs. No analysis is required

func JSONSpec Uses

func JSONSpec(path string) (*Document, error)

JSONSpec loads a spec from a json document

func Spec Uses

func Spec(path string) (*Document, error)

Spec loads a new spec document

func (*Document) BasePath Uses

func (d *Document) BasePath() string

BasePath the base path for this spec

func (*Document) Expanded Uses

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) Host Uses

func (d *Document) Host() string

Host returns the host for the API

func (*Document) OrigSpec Uses

func (d *Document) OrigSpec() *spec.Swagger

OrigSpec yields the original spec

func (*Document) Pristine Uses

func (d *Document) Pristine() *Document

Pristine creates a new pristine document instance based on the input data

func (*Document) Raw Uses

func (d *Document) Raw() json.RawMessage

Raw returns the raw swagger spec as json bytes

func (*Document) ResetDefinitions Uses

func (d *Document) ResetDefinitions() *Document

ResetDefinitions gives a shallow copy with the models reset

func (*Document) Schema Uses

func (d *Document) Schema() *spec.Schema

Schema returns the swagger 2.0 schema

func (*Document) Spec Uses

func (d *Document) Spec() *spec.Swagger

Spec returns the swagger spec object model

func (*Document) SpecFilePath Uses

func (d *Document) SpecFilePath() string

SpecFilePath returns the file path of the spec if one is defined

func (*Document) Version Uses

func (d *Document) Version() string

Version returns the version of this spec

Directories

PathSynopsis
fmts

Package loads imports 8 packages (graph) and is imported by 179 packages. Updated 2019-09-09. Refresh now. Tools for package owners.