Source: PR #64 review comment 3176840475
File: core/schema_reader.py (line 61)
The load_scalar_properties helper currently includes any property whose type is not exactly "array"/"object", so definitions without an explicit scalar type (e.g. bare $ref entries pointing to complex types, anyOf/oneOf unions) are still treated as comparable scalar fields.
This produces a bogus PATCH attempt when such a property is detected as drifted; the PATCH fails gracefully with a 400, but the UX is confusing.
Proposed fix:
Limit inclusion to $ref entries and the explicit scalar types:
if "$ref" in defn:
result.append(name)
continue
prop_type = defn.get("type")
scalar_types = {"string", "integer", "number", "boolean", "null"}
if isinstance(prop_type, list):
if set(prop_type) <= scalar_types:
result.append(name)
continue
if prop_type in scalar_types:
result.append(name)
Note: The risk is dual — false inclusion produces a graceful 400 failure; false exclusion silently misses drift. Verify against the actual NetBox JSON schemas before applying.
Source: PR #64 review comment 3176840475
File:
core/schema_reader.py(line 61)The
load_scalar_propertieshelper currently includes any property whosetypeis not exactly"array"/"object", so definitions without an explicit scalar type (e.g. bare$refentries pointing to complex types,anyOf/oneOfunions) are still treated as comparable scalar fields.This produces a bogus PATCH attempt when such a property is detected as drifted; the PATCH fails gracefully with a 400, but the UX is confusing.
Proposed fix:
Limit inclusion to
$refentries and the explicit scalar types:Note: The risk is dual — false inclusion produces a graceful 400 failure; false exclusion silently misses drift. Verify against the actual NetBox JSON schemas before applying.