Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateJSONSchemaString ¶ added in v2.10.0
func MarshalIndent ¶
MarshalIndent takes json encoded content as a []byte and tries to indent it with two spaces If it is not able to marshal the content it returns the []byte as is and prints a warning and returns the error
func ReflectJSONSchema ¶ added in v2.10.0
func ReflectJSONSchema(value interface{}) *jsonschema.Schema
func ValidateJson ¶
Types ¶
type JsonValidationError ¶
type JsonValidationError struct { // FileName is the file name (full qualified) where the error happened // This field is always filled. Location Location `json:"jsonErrorLocation"` // LineNumber contains the line number (starting by one) where the error happened // If we don't have the information, this is -1. LineNumber int `json:"lineNumber"` // CharacterNumberInLine contains the character number (starting by one) where // the error happened. If we don't have the information, this is -1. CharacterNumberInLine int `json:"characterNumberInLine"` // LineContent contains the full line content of where the error happened // If we don't have the information, this is an empty string. LineContent string `json:"lineContent"` // PreviousLineContent contains the full line content of the line before LineContent // If we don't have the information, this is an empty string. PreviousLineContent string `json:"previousLineContent"` // Err is the original error which happened during the json unmarshalling. Err error `json:"error"` }
JsonValidationError is an error which contains more information about where the error appeared in the json file which was validated. It contains the fileName, line number, character number, and line content as additional information. Furthermore, it contains the original error (the cause) which happened during the json unmarshalling.
func (JsonValidationError) ContainsLineInformation ¶
func (e JsonValidationError) ContainsLineInformation() bool
ContainsLineInformation indicates whether additional line information is present in the error.
func (JsonValidationError) Error ¶
func (e JsonValidationError) Error() string
func (JsonValidationError) PrettyError ¶
func (e JsonValidationError) PrettyError() string
type Location ¶
type Location struct { Coordinate coordinate.Coordinate `json:"coordinate"` Group string `json:"group"` Environment string `json:"environment"` TemplateFilePath string `json:"templateFilePath"` }
Click to show internal directories.
Click to hide internal directories.