Skip to content

Chore/unpin openapi spec validator and update target python versions#103

Open
v-v-v-v-v-v-v-v wants to merge 5 commits intomasterfrom
chore/unpin-openapi-spec-validator-and-update-target-python-versions
Open

Chore/unpin openapi spec validator and update target python versions#103
v-v-v-v-v-v-v-v wants to merge 5 commits intomasterfrom
chore/unpin-openapi-spec-validator-and-update-target-python-versions

Conversation

@v-v-v-v-v-v-v-v
Copy link
Copy Markdown
Contributor

  • What kind of change does this PR introduce?
    • Unpins openapi-spec-validator. This is because the version it is currently pinned at (0.2.9) uses some deprecated/obsolete imports that would require setuptools to be pinned to 81.0.0 or lower for the SDK to continue working. More importantly, openapi-spec-validator is severely out of date, the latest version is 0.8.4. By unpinning openapi-spec-validator, the hope is that there should be less need to pin other dependencies just to support the Stax SDK.

Also updates classifiers and other targets to indicate that the Stax SDK supports at minimum Python 3.9; I believe this has been somewhat indicated with build jobs targetting 3.9, but this is explicit now.

  • What is the current behavior?
    • Assuming a version of Python with the Stax SDK installed and setuptools at version >81.0.0, importing openapi_spec_validator will result in the following:
Traceback (most recent call last):
  File "<python-input-1>", line 1, in <module>
    import openapi_spec_validator
  File "/var/venv/lib/python3.13/site-packages/openapi_spec_validator/__init__.py", line 6, in <module>
    from openapi_spec_validator.schemas import get_openapi_schema
  File "/var/venv/lib/python3.13/site-packages/openapi_spec_validator/schemas.py", line 4, in <module>
    from pkg_resources import resource_filename
ModuleNotFoundError: No module named 'pkg_resources'

pkg_resources is deprecated and removed from newer versions of setuptools.

  • Does this PR introduce a breaking change? (What changes might users need to make in their application due to this PR?)
    • Unlikely, but worth pointing out that the SDK requires Python 3.9 or higher, which we also indicate in our classifiers. To minimise disruption across different versions of Python between 3.9 and 3.13, the GitHub Actions workflow for building and testing now includes a mapping for multiple Python versions.

@v-v-v-v-v-v-v-v v-v-v-v-v-v-v-v requested a review from a team March 30, 2026 04:54
@v-v-v-v-v-v-v-v v-v-v-v-v-v-v-v requested a review from a team as a code owner April 30, 2026 04:14
@v-v-v-v-v-v-v-v v-v-v-v-v-v-v-v force-pushed the chore/unpin-openapi-spec-validator-and-update-target-python-versions branch from 1c77fc2 to 8b45b3a Compare April 30, 2026 04:24
@sentry
Copy link
Copy Markdown

sentry Bot commented Apr 30, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (a98d1e5) to head (8b45b3a).

Additional details and impacted files
@@            Coverage Diff            @@
##            master      #103   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            9         9           
  Lines          515       514    -1     
=========================================
- Hits           515       514    -1     
Files with missing lines Coverage Δ
staxapp/__init__.py 100.00% <100.00%> (ø)
staxapp/config.py 100.00% <100.00%> (ø)
staxapp/contract.py 100.00% <ø> (ø)
staxapp/openapi.py 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # 5.1.0
with:
python-version: '3.9'
python-version: ${{ matrix.python-version }}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍👍

Comment thread staxapp/__init__.py
@@ -1 +1 @@
__version__ = "1.3.1"
__version__ = "1.3.2"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

atleast a 1.4.0 :P

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can clearly see when things started out as "bump a few dependencies" into something much more involved. 😛 Will bump the version proper.

Comment thread staxapp/openapi.py
method = path[method_type]

operation = method.get("operationId", "").split(".")
operation = method.get("x-stax-sdk-operation-id", "").split(".")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks pretty straightforward

Comment thread staxapp/config.py
@classmethod
def schema_url(cls):
return f"https://{cls.hostname}/{cls.API_VERSION}/public/api-document"
return f"https://{cls.hostname}/{cls.API_VERSION}/public/oas3-document"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be good to have some tests to validate the current calls are still valid. The sdk knows about these, for example:

>>> accounts.ffff()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/levence/.pyenv/versions/3.9.20/lib/python3.9/site-packages/staxapp/openapi.py", line 100, in stax_wrapper
    raise ValidationException(
staxapp.exceptions.ValidationException: No such operation: ffff for accounts. Please use one of ['UpdateAccountTypeMembers', 'ReadAccounts', 'CreateAccount', 'CloseAccount', 'DiscoverAccounts', 'OnboardAccount', 'ReadAccountTypes', 'CreateAccountType', 'UpdateAccountTypeAccess', 'DeleteAccountType', 'UpdateAccountType', 'UpdateAccount', 'ReadAccountPolicyAttachments']

accounts.UpdateAccount(x=1)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/levence/.pyenv/versions/3.9.20/lib/python3.9/site-packages/staxapp/openapi.py", line 122, in stax_wrapper
    raise ValidationException(
staxapp.exceptions.ValidationException: Missing one or more parameters: ['account_id']

There is probably a smart way to retrieve these on the old schema and assert in the new schema yeah?

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