mirror of
https://github.com/LukeHagar/libopenapi.git
synced 2025-12-06 04:20:11 +00:00
This should be very easy to duplicate to 2.0 and 3.1, now extraction code needs testing. Signed-off-by: Dave Shanley <dave@quobix.com>
29 lines
1.3 KiB
Go
29 lines
1.3 KiB
Go
package datamodel
|
|
|
|
import (
|
|
"gopkg.in/yaml.v3"
|
|
"time"
|
|
)
|
|
|
|
// SpecInfo represents information about a supplied specification.
|
|
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:"-"`
|
|
}
|
|
|
|
// 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.
|
|
func (si SpecInfo) GetJSONParsingChannel() chan bool {
|
|
return si.JsonParsingChannel
|
|
}
|