@@ -17,7 +17,9 @@ func main() {
1717	tagsPath  :=  "split_specs/tags" 
1818	sharedComponentPath  :=  "split_specs/shared_components.yaml"  // Input: shared schema file 
1919	mergedSpecPath  :=  "output/merged_spec.yaml"                  // Temporary file to hold the merged spec 
20- 	spectralRulesetPath  :=  "../ipa-spectral.yaml"                // Spectral ruleset file 
20+ 	deletedMergedSpecPath  :=  "output/merged_spec_deleted.yaml"   // Temporary file to hold the merged spec 
21+ 
22+ 	spectralRulesetPath  :=  "../ipa-spectral.yaml"  // Spectral ruleset file 
2123
2224	// Create output directory if it doesn't exist 
2325	if  err  :=  os .MkdirAll ("output" , 0755 ); err  !=  nil  {
@@ -40,21 +42,22 @@ func main() {
4042		}
4143	}
4244
45+ 	//Collect all the spec files which have deleted paths 
46+ 	var  deletedTagsFiles  []string 
4347	for  tag  :=  range  deletedTags  {
4448		tagDir  :=  filepath .Join (tagsPath , tag )
4549		tagFilePath  :=  filepath .Join (tagDir , "spec-deleted.yaml" )
50+ 		deletedTagsFiles  =  append (deletedTagsFiles , tagFilePath )
51+ 	}
4652
47- 		//check if there is a deleted component file, and if there is merge with it 
48- 		//otherwise, merge with the shared components file 
49- 		if  err  :=  utils .RebuildFullSpec (tagFilePath , sharedComponentPath , mergedSpecPath ); err  !=  nil  {
50- 			log .Fatalf ("Failed to merge specs: %v" , err )
51- 		}
52- 		fmt .Printf ("Merged spec written to: %s\n " , mergedSpecPath )
53+ 	if  err  :=  utils .RebuildFullDeletedPathsSpec (deletedTagsFiles , sharedComponentPath , deletedMergedSpecPath ); err  !=  nil  {
54+ 		log .Fatalf ("Failed to merge specs: %v" , err )
55+ 	}
56+ 	fmt .Printf ("Merged spec written to: %s\n " , deletedMergedSpecPath )
5357
54- 		//Lint the merged spec with Spectral 
55- 		if  err  :=  utils .LintSpecWithSpectral (mergedSpecPath , spectralRulesetPath ); err  !=  nil  {
56- 			log .Fatalf ("Failed to lint spec with Spectral: %v" , err )
57- 		}
58+ 	//Lint the merged spec with Spectral 
59+ 	if  err  :=  utils .LintSpecWithSpectral (deletedMergedSpecPath , spectralRulesetPath ); err  !=  nil  {
60+ 		log .Fatalf ("Failed to lint spec with Spectral: %v" , err )
5861	}
5962
6063}
0 commit comments