Documentation ¶
Index ¶
Constants ¶
const ( OAS2 = "oas2" OAS3 = "oas3" OAS31 = "oas3_1" )
Variables ¶
var AllFormats = []string{OAS3, OAS31, OAS2}
var OAS2Format = []string{OAS2}
var OAS3AllFormat = []string{OAS3, OAS31}
var OAS3Format = []string{OAS3}
var OAS3_1Format = []string{OAS31}
var OpenAPI2SchemaData string
var OpenAPI3SchemaData string
Functions ¶
func AreValuesCorrectlyTyped ¶
AreValuesCorrectlyTyped will look through an array of unknown values and check they match against the supplied type as a string. The return value is empty if everything is OK, or it contains failures in the form of a value as a key and a message as to why it's not valid
func CheckEnumForDuplicates ¶
func CheckEnumForDuplicates(seq []*yaml.Node) []*yaml.Node
CheckEnumForDuplicates will check an array of nodes to check if there are any duplicates.
Types ¶
type SpecInfo ¶
type SpecInfo struct { SpecType string `json:"type"` Version string `json:"version"` SpecFormat string `json:"format"` SpecFileType string `json:"fileType"` RootNode *yaml.Node `json:"-"` // reference to the root node of the spec. SpecBytes *[]byte `json:"bytes"` // the original bytes SpecJSONBytes *[]byte `json:"-"` // original bytes converted to JSON SpecJSON *map[string]interface{} `json:"-"` // standard JSON map of original bytes Error error `json:"-"` // something go wrong? APISchema string `json:"-"` // API Schema for supplied spec type (2 or 3) Generated time.Time `json:"-"` JsonParsingChannel chan bool `json:"-"` }
SpecInfo represents information about a supplied specification.
func ExtractSpecInfo ¶
ExtractSpecInfo will look at a supplied OpenAPI specification, and return a *SpecInfo pointer, or an error if the spec cannot be parsed correctly.
func (SpecInfo) GetJSONParsingChannel ¶
GetJSONParsingChannel returns a channel that will close once async JSON parsing is completed. This is required as rules may start executing before we're even done reading in the spec to JSON.