Skip to content

Commit

Permalink
Fix "primary_ip" nullable type.
Browse files Browse the repository at this point in the history
  • Loading branch information
v0ctor committed Jan 18, 2024
1 parent 97dbb8f commit 8773ca9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
3 changes: 3 additions & 0 deletions api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -98504,6 +98504,7 @@ components:
allOf:
- $ref: '#/components/schemas/NestedIPAddress'
readOnly: true
nullable: true
primary_ip4:
allOf:
- $ref: '#/components/schemas/NestedIPAddress'
Expand Down Expand Up @@ -99406,6 +99407,7 @@ components:
allOf:
- $ref: '#/components/schemas/NestedIPAddress'
readOnly: true
nullable: true
primary_ip4:
allOf:
- $ref: '#/components/schemas/NestedIPAddress'
Expand Down Expand Up @@ -131389,6 +131391,7 @@ components:
allOf:
- $ref: '#/components/schemas/NestedIPAddress'
readOnly: true
nullable: true
primary_ip4:
allOf:
- $ref: '#/components/schemas/NestedIPAddress'
Expand Down
12 changes: 9 additions & 3 deletions scripts/fix-spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,15 @@
if 'properties' in prop and 'value' in prop['properties'] and 'enum' in prop['properties']['value'] and None in prop['properties']['value']['enum']:
prop['properties']['value']['enum'].remove(None)

# Fix "parent_device" nullable type
if 'parent_device' in schema['properties']:
schema['properties']['parent_device']['nullable'] = True
# Fix nullable types
nullable_types = [
'parent_device',
'primary_ip',
]

for ntype in nullable_types:
if ntype in schema['properties']:
schema['properties'][ntype]['nullable'] = True

# Save the spec file
with open(SPEC_PATH, 'w') as file:
Expand Down

0 comments on commit 8773ca9

Please sign in to comment.