@@ -142,7 +142,7 @@ func LoadSanitizeConfig(r io.Reader) (*SanitizeOptions, error) {
142142
143143// LoadSanitizeConfigFromFile loads sanitize configuration from a YAML file.
144144func LoadSanitizeConfigFromFile (path string ) (* SanitizeOptions , error ) {
145- f , err := os .Open (path )
145+ f , err := os .Open (path ) //nolint:gosec
146146 if err != nil {
147147 return nil , fmt .Errorf ("failed to open config file: %w" , err )
148148 }
@@ -183,8 +183,7 @@ func removeExtensions(ctx context.Context, doc *OpenAPI, opts *SanitizeOptions)
183183 // Collect keys to remove
184184 keysToRemove := []string {}
185185 for key := range ext .All () {
186- shouldRemove := false
187-
186+ var shouldRemove bool
188187 if removeAll {
189188 // Remove all extensions
190189 shouldRemove = true
@@ -222,12 +221,8 @@ func removeUnknownProperties(ctx context.Context, doc *OpenAPI) error {
222221 // We need specific matchers for wrapped types (Referenced*, JSONSchema)
223222 for item := range Walk (ctx , doc ) {
224223 err := item .Match (Matcher {
225- Any : func (model any ) error {
226- return cleanUnknownPropertiesFromModel (model )
227- },
228- Schema : func (schema * oas3.JSONSchema [oas3.Referenceable ]) error {
229- return cleanUnknownPropertiesFromJSONSchema (schema )
230- },
224+ Any : cleanUnknownPropertiesFromModel ,
225+ Schema : cleanUnknownPropertiesFromJSONSchema ,
231226 // Handle all Referenced types by extracting their Object
232227 ReferencedResponse : func (ref * ReferencedResponse ) error {
233228 if ref != nil && ! ref .IsReference () && ref .Object != nil {
0 commit comments