From b829663ba09c1933e359b0539fc882f876326079 Mon Sep 17 00:00:00 2001 From: srinandan Date: Wed, 1 Dec 2021 08:04:40 -0800 Subject: [PATCH] support disabling format validation --- cmd/apis/crtapi.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/cmd/apis/crtapi.go b/cmd/apis/crtapi.go index 2c74dd51..7f3656cc 100644 --- a/cmd/apis/crtapi.go +++ b/cmd/apis/crtapi.go @@ -55,9 +55,9 @@ var CreateCmd = &cobra.Command{ var content []byte var oasDocName string if oasFile != "" { - oasDocName, content, err = bundle.LoadDocumentFromFile(oasFile, validateSpec) + oasDocName, content, err = bundle.LoadDocumentFromFile(oasFile, validateSpec, formatValidation) } else { - oasDocName, content, err = bundle.LoadDocumentFromURI(oasURI, validateSpec) + oasDocName, content, err = bundle.LoadDocumentFromURI(oasURI, validateSpec, formatValidation) } if err != nil { return err @@ -86,7 +86,7 @@ var CreateCmd = &cobra.Command{ } var proxy, oasFile, oasURI, gqlFile, gqlURI string -var importProxy, validateSpec, skipPolicy, addCORS bool +var importProxy, validateSpec, skipPolicy, addCORS, formatValidation bool func init() { @@ -106,6 +106,8 @@ func init() { false, "Skip adding the OAS Validate policy") CreateCmd.Flags().BoolVarP(&addCORS, "add-cors", "", false, "Add a CORS policy") + CreateCmd.Flags().BoolVarP(&formatValidation, "formatValidation", "", + true, "disables validation of schema type formats") _ = CreateCmd.MarkFlagRequired("name") }