Skip to content

fix: provide empty list instead of Unset for OpenAPI arrays marked "required"#35

Merged
nats merged 2 commits intobinarylane:mainfrom
nats:fix/required-lists
Mar 23, 2023
Merged

fix: provide empty list instead of Unset for OpenAPI arrays marked "required"#35
nats merged 2 commits intobinarylane:mainfrom
nats:fix/required-lists

Conversation

@nats
Copy link
Copy Markdown
Contributor

@nats nats commented Mar 22, 2023

No description provided.

@nats nats requested a review from david-pershouse March 23, 2023 01:25
@david-pershouse
Copy link
Copy Markdown
Contributor

This allows bl server action change-advanced-firewall-rules 12 to work which clears the firewall rules (sends an empty list)
If I only partially specify a rule I get the expected error:

$ bl server action change-advanced-firewall-rules 12 --curl +rule --source-addresses 0.0.0.0
usage: bl server action change-advanced-firewall-rules [OPTIONS] SERVER_ID [+rule ... ]
bl server action change-advanced-firewall-rules: error: the following arguments are required: --destination-addresses, --protocol, --action

However if I do bl server action change-advanced-firewall-rules 12 +rule, I don't get the required fields and instead get an error

$ bl server action change-advanced-firewall-rules 12 +rule
ERROR:binarylane.console.__main__:'Unset' object has no attribute 'to_dict'
Traceback (most recent call last):
  File "C:\dev\vps\python-blcli\src\binarylane\console\__main__.py", line 18, in main
    App().run(sys.argv[1:])
  File "C:\dev\vps\python-blcli\src\binarylane\console\app.py", line 110, in run
    self.process(parsed)
  File "C:\dev\vps\python-blcli\src\binarylane\console\app.py", line 82, in process
    return child.runner_type(self._context).run(args)
  File "C:\dev\vps\python-blcli\src\binarylane\console\runners\command.py", line 152, in run
    self.request(self._client, parsed.mapped_object)
  File "C:\dev\vps\python-blcli\src\binarylane\console\commands\api\post_v_2_servers_server_id_actions_change_advanced_firewall_rules.py", line 153, in request
    page_response = sync_detailed(
  File "C:\dev\vps\python-blcli\lib\binarylane\api\server_actions\post_v_2_servers_server_id_actions_change_advanced_firewall_rules.py", line 104, in sync_detailed
    kwargs = _get_kwargs(
  File "C:\dev\vps\python-blcli\lib\binarylane\api\server_actions\post_v_2_servers_server_id_actions_change_advanced_firewall_rules.py", line 28, in _get_kwargs
    json_json_body = json_body.to_dict()
  File "C:\dev\vps\python-blcli\lib\binarylane\models\change_advanced_firewall_rules.py", line 32, in to_dict
    firewall_rules_item = firewall_rules_item_data.to_dict()
AttributeError: 'Unset' object has no attribute 'to_dict'

@nats nats merged commit 78e907a into binarylane:main Mar 23, 2023
@nats nats deleted the fix/required-lists branch March 23, 2023 05:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants