Skip to content

Commit

Permalink
feat: Allow setting interface.enabled to false
Browse files Browse the repository at this point in the history
  • Loading branch information
fbreckle committed Aug 4, 2023
1 parent dd0b7c4 commit 536187b
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 4 deletions.
2 changes: 1 addition & 1 deletion netbox/models/writable_interface.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion netbox/models/writable_vm_interface.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions preprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,18 @@
prop_spec["x-omitempty"] = False
logging.info(f"set x-omitempty = false on WritableIPAddress.{prop}")

# Add omitempty = false for interface enabled
for prop, prop_spec in data["definitions"]["WritableInterface"]["properties"].items():
if prop == "enabled":
prop_spec["x-omitempty"] = False
logging.info(f"set x-omitempty = false on WritableInterface.{prop}")

# Add omitempty = false for vminterface enabled
for prop, prop_spec in data["definitions"]["WritableVMInterface"]["properties"].items():
if prop == "enabled":
prop_spec["x-omitempty"] = False
logging.info(f"set x-omitempty = false on WritableVMInterface.{prop}")

# Delete problematic maximums (might have to be replaced with a proper value)
for definition, definition_spec in data["definitions"].items():
for prop, prop_spec in definition_spec["properties"].items():
Expand Down
6 changes: 4 additions & 2 deletions swagger.processed.json
Original file line number Diff line number Diff line change
Expand Up @@ -80198,7 +80198,8 @@
},
"enabled": {
"title": "Enabled",
"type": "boolean"
"type": "boolean",
"x-omitempty": false
},
"parent": {
"title": "Parent interface",
Expand Down Expand Up @@ -95699,7 +95700,8 @@
},
"enabled": {
"title": "Enabled",
"type": "boolean"
"type": "boolean",
"x-omitempty": false
},
"parent": {
"title": "Parent interface",
Expand Down

0 comments on commit 536187b

Please sign in to comment.