Skip to content

Commit

Permalink
fixups: Apply int array to matrix fixup even for 1 item
Browse files Browse the repository at this point in the history
There was a corner case where an array with 1 item was defined:

$ref: /schemas/types.yaml#/definitions/uint32-array
maxItems: 1

While that's not really valid because 1 item is just an uint32, not an
array, the schema didn't work correctly either. With the fixup skipped,
maxItems applied to the outer array (which is always 1 item for arrays)
when the intent was for the inner array.

Since support of 2 forms of array encoding has been dropped, we can also
just drop the maxItems check.

Signed-off-by: Rob Herring <[email protected]>
  • Loading branch information
robherring committed Nov 20, 2023
1 parent 87135f9 commit e0b70cd
Showing 1 changed file with 0 additions and 3 deletions.
3 changes: 0 additions & 3 deletions dtschema/fixups.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,6 @@ def _fixup_int_array_min_max_to_matrix(subschema, path=[]):
if _is_matrix_schema(subschema):
return

if subschema.get('maxItems') == 1:
return

tmpsch = {}
if 'minItems' in subschema:
tmpsch['minItems'] = subschema.pop('minItems')
Expand Down

0 comments on commit e0b70cd

Please sign in to comment.