From 779ce96dc72cbcb2a8e68ee3021056e9e2254126 Mon Sep 17 00:00:00 2001 From: Jason Novinger Date: Tue, 15 Sep 2026 09:07:37 -0500 Subject: [PATCH] Drop the redundant enum checks from the string length bounds ChoiceField does not subclass CharField, so the enclosing issubclass() guard already excludes an enum-bearing property. The extra condition never fired and implied a second guard was needed, inconsistent with the numeric branch below. --- netbox/utilities/jsonschema.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/netbox/utilities/jsonschema.py b/netbox/utilities/jsonschema.py index c508e0a42..b6ede7632 100644 --- a/netbox/utilities/jsonschema.py +++ b/netbox/utilities/jsonschema.py @@ -115,9 +115,9 @@ class JSONSchemaProperty: # it's safe to check against CharField here because the other # CharField-derived fields are ruled out by the "is a string check" above if issubclass(field_class, forms.CharField): - if self.minLength is not None and not self.enum: + if self.minLength is not None: field_kwargs['min_length'] = self.minLength - if self.maxLength is not None and not self.enum: + if self.maxLength is not None: field_kwargs['max_length'] = self.maxLength if self.pattern is not None: field_kwargs['validators'] = [