Skip to content

ci: trigger CI after openapi spec updates + fix generator nullable type#94

Merged
natalie-o-perret merged 1 commit into
masterfrom
fix/generator-nullable-type
Jun 25, 2026
Merged

ci: trigger CI after openapi spec updates + fix generator nullable type#94
natalie-o-perret merged 1 commit into
masterfrom
fix/generator-nullable-type

Conversation

@natalie-o-perret

@natalie-o-perret natalie-o-perret commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Two changes:

  1. CI: .github/workflows/main.yml triggers CI on completion of Update bundled openapi definition (the hourly job that pushes spec updates to master), plus an explicit master entry in push.branches. A bad spec update now fails CI instead of going silent.
  2. Generator: exoscale/api/generator.py adds _resolve_type() to handle OpenAPI 3.1 nullable schemas like "type": ["integer", "null"]. The old code assumed schema["type"] was a string and died at import with unhashable type: 'list', bricking the whole SDK. This is the breakage the CI hook above is meant to catch next time.

Verified on Python 3.10 to 3.14: 16 passed on every version. Output:

tests/test_client.py::test_client_creation PASSED                        [  6%]
tests/test_client.py::test_client_error_handling PASSED                  [ 12%]
tests/test_client.py::test_wait_interval PASSED                          [ 18%]
tests/test_client.py::test_operation_poll_failure PASSED                 [ 25%]
tests/test_client.py::test_operation_invalid_state PASSED                [ 31%]
tests/test_client.py::test_wait_time_success PASSED                      [ 37%]
tests/test_client.py::test_wait_time_poll_errors PASSED                  [ 43%]
tests/test_client.py::test_wait_time_failure PASSED                      [ 50%]
tests/test_partner_client.py::test_client_creation PASSED                [ 56%]
tests/test_partner_client.py::test_client_with_custom_url PASSED         [ 62%]
tests/test_partner_client.py::test_client_error_handling PASSED          [ 68%]
tests/test_partner_client.py::test_authentication PASSED                 [ 75%]
tests/test_partner_client.py::test_create_organization_with_structured_address PASSED [ 81%]
tests/test_partner_client.py::test_create_organization_with_optional_fields PASSED [ 87%]
tests/test_partner_client.py::test_create_organization_minimal_billing_address PASSED [ 93%]
tests/test_partner_client.py::test_list_organizations PASSED             [100%]

============================== 16 passed in 0.06s ==============================

Note

AI-assisted for patch draft and this very PR description.

Two schemas in the bundled openapi spec (org-consumption-quota-request,
org-consumption-quota-response) use the OpenAPI 3.1 nullable form
'"type": ["integer", "null"]'. The generator treated schema['type']
as a string, blew up at module import time with 'unhashable type: list',
and broke the whole SDK.

Add _resolve_type() that unwraps list types to the first non-'null'
member, apply it to every _type_translations lookup site. nullable:
true (OpenAPI 3.0) was already handled implicitly and is unchanged.

Also trigger CI on completion of 'Update bundled openapi definition'
so a bad spec update pushed to master fails CI instead of going silent.
@natalie-o-perret natalie-o-perret marked this pull request as ready for review June 25, 2026 09:38
@natalie-o-perret natalie-o-perret changed the title fix(api): handle OpenAPI 3.1 nullable type arrays in generator fix(api): handle OpenAPI 3.1 nullable type arrays + CI on spec updates Jun 25, 2026
@natalie-o-perret natalie-o-perret changed the title fix(api): handle OpenAPI 3.1 nullable type arrays + CI on spec updates ci: trigger CI after openapi spec updates + fix generator nullable type Jun 25, 2026
@natalie-o-perret

Copy link
Copy Markdown
Contributor Author

[SC-179745]

@natalie-o-perret natalie-o-perret requested a review from a team June 25, 2026 09:50
@natalie-o-perret natalie-o-perret merged commit 8eb9a6c into master Jun 25, 2026
6 checks passed
@natalie-o-perret natalie-o-perret deleted the fix/generator-nullable-type branch June 25, 2026 10:07
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