@@ -257,7 +257,7 @@ func (uc *WorkflowContractUseCase) Create(ctx context.Context, opts *WorkflowCon
257257 var contract * Contract
258258 if len (opts .RawSchema ) > 0 {
259259 // Load the provided contract
260- c , err := RawToSchemaContract (opts .RawSchema )
260+ c , err := identifyUnMarshalAndValidateRawContract (opts .RawSchema )
261261 if err != nil {
262262 return nil , fmt .Errorf ("failed to load contract: %w" , err )
263263 }
@@ -391,7 +391,7 @@ func (uc *WorkflowContractUseCase) Update(ctx context.Context, orgID, name strin
391391
392392 var contract * Contract
393393 if len (opts .RawSchema ) > 0 {
394- c , err := RawToSchemaContract (opts .RawSchema )
394+ c , err := identifyUnMarshalAndValidateRawContract (opts .RawSchema )
395395 if err != nil {
396396 return nil , fmt .Errorf ("failed to load contract: %w" , err )
397397 }
@@ -434,7 +434,7 @@ func (uc *WorkflowContractUseCase) Update(ctx context.Context, orgID, name strin
434434
435435func (uc * WorkflowContractUseCase ) ValidateContractPolicies (rawSchema []byte , token string ) error {
436436 // Validate that externally provided policies exist
437- c , err := RawToSchemaContract (rawSchema )
437+ c , err := identifyUnMarshalAndValidateRawContract (rawSchema )
438438 if err != nil {
439439 return NewErrValidation (err )
440440 }
@@ -716,8 +716,8 @@ func UnmarshalAndValidateRawContract(raw []byte, format unmarshal.RawFormat) (*C
716716 return nil , NewErrValidation (fmt .Errorf ("contract validation failed:\n v2 Contract format error: %w\n v1 CraftingSchema format error: %w" , v2Err , v1Err ))
717717}
718718
719- // RawToSchemaContract Will try to figure out the format of the raw contract and validate it
720- func RawToSchemaContract (raw []byte ) (* Contract , error ) {
719+ // Will try to figure out the format of the raw contract and validate it
720+ func identifyUnMarshalAndValidateRawContract (raw []byte ) (* Contract , error ) {
721721 format , err := unmarshal .IdentifyFormat (raw )
722722 if err != nil {
723723 return nil , fmt .Errorf ("identify contract: %w" , err )
0 commit comments