@@ -313,10 +313,8 @@ func loadSwaggerData(
313
313
) (jsonast.SwaggerTypes , error ) {
314
314
schemas , err := loadAllSchemas (
315
315
ctx ,
316
- config .SchemaRoot ,
317
- config .LocalPathPrefix (),
318
316
idFactory ,
319
- config . Status . Overrides ,
317
+ config ,
320
318
log )
321
319
if err != nil {
322
320
return jsonast.SwaggerTypes {}, err
@@ -684,12 +682,14 @@ func shouldSkipDir(filePath string) bool {
684
682
// shouldSkipDir), and returns those files in a map of path→swagger spec.
685
683
func loadAllSchemas (
686
684
ctx context.Context ,
687
- rootPath string ,
688
- localPathPrefix string ,
689
685
idFactory astmodel.IdentifierFactory ,
690
- overrides [] config.SchemaOverride ,
686
+ config * config.Configuration ,
691
687
log logr.Logger ,
692
688
) (map [string ]jsonast.PackageAndSwagger , error ) {
689
+ rootPath := config .SchemaRoot
690
+ localPathPrefix := config .LocalPathPrefix ()
691
+ overrides := config .Status .Overrides
692
+
693
693
var mutex sync.Mutex
694
694
schemas := make (map [string ]jsonast.PackageAndSwagger )
695
695
@@ -726,6 +726,15 @@ func loadAllSchemas(
726
726
astmodel .GeneratorVersion ,
727
727
version )
728
728
729
+ // We need the file if the version is short (e.g. "v1") because those are often shared between
730
+ // resource providers.
731
+ // Alternatively, we need the file if we have configuration for the group
732
+ fileNeeded := len (version ) < 10 ||
733
+ config .ObjectModelConfiguration .IsGroupConfigured (pkg )
734
+ if ! fileNeeded {
735
+ return nil
736
+ }
737
+
729
738
// all files are loaded in parallel to speed this up
730
739
logInfoSparse (
731
740
log ,
0 commit comments