validate

package
v0.3.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 19, 2024 License: Apache-2.0 Imports: 3 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ValidateCmd = &cobra.Command{
	Use:   "validate",
	Short: "validate an oscal document",
	Long:  "Validate an OSCAL document against the OSCAL schema version specified in the document.",
	RunE: func(cmd *cobra.Command, args []string) error {

		validationResponse, validationErr := validation.ValidationCommand(inputfile)

		if validationResultFile != "" {
			err := validation.WriteValidationResult(validationResponse.Result, validationResultFile)
			if err != nil {
				log.Printf("Failed to write validation result to %s: %s\n", validationResultFile, err)
			}
		}

		if validationErr != nil {
			return validationErr
		}

		if len(validationResponse.Warnings) > 0 {
			for _, warning := range validationResponse.Warnings {
				log.Print(warning)
			}
		}

		log.Printf("Successfully validated %s is valid OSCAL version %s %s\n", inputfile, validationResponse.Validator.GetSchemaVersion(), validationResponse.Validator.GetModelType())
		return nil
	},
}

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL