@@ -119,8 +119,6 @@ func validateObject(dataObj interface{}, s *spec.Schema, rootName string) error
119119 return fmt .Errorf ("validate config: schema is not provided" )
120120 }
121121
122- injectRegistryProperty (s )
123-
124122 validator := validate .NewSchemaValidator (s , nil , rootName , strfmt .Default ) // , validate.DisableObjectArrayTypeCheck(true)
125123
126124 switch v := dataObj .(type ) {
@@ -162,18 +160,19 @@ func validateObject(dataObj interface{}, s *spec.Schema, rootName string) error
162160 return allErrs .ErrorOrNil ()
163161}
164162
165- // injectRegistryProperty mutates the module schema to add a strict-typed "registry" field
166- func injectRegistryProperty (s * spec.Schema ) {
167- if len (s .Properties ) == 0 {
163+ // InjectRegistrySpec mutates the module schema to add a strict-typed "registry" field
164+ func (st * SchemaStorage ) InjectRegistrySpec () {
165+ scheme := st .Schemas [ValuesSchema ]
166+ if scheme == nil || len (scheme .Properties ) == 0 {
168167 return
169168 }
170169
171170 // skip if already present
172- if _ , exists := s .Properties ["registry" ]; exists {
171+ if _ , exists := scheme .Properties ["registry" ]; exists {
173172 return
174173 }
175174
176- s .Properties ["registry" ] = spec.Schema {
175+ scheme .Properties ["registry" ] = spec.Schema {
177176 SchemaProps : spec.SchemaProps {
178177 Type : spec.StringOrArray {"object" },
179178 AdditionalProperties : & spec.SchemaOrBool {Allows : false },
@@ -301,8 +300,6 @@ func PrepareSchemas(configBytes, valuesBytes []byte) (map[SchemaType]*spec.Schem
301300 & schema.CopyTransformer {},
302301 // Transform x-required-for-helm
303302 & schema.RequiredForHelmTransformer {},
304- // Allow unknown fields (e.g., "registry") to pass validation
305- & schema.AdditionalPropertiesTransformer {},
306303 )
307304 }
308305
0 commit comments