Skip to content

chore: Install Ariadne-codegen to generate a typed open hexa client (HEXA-1254)#264

Merged
yolanfery merged 54 commits into
mainfrom
HEXA-1254-ariadne-codegen-for-sdk
May 22, 2025
Merged

chore: Install Ariadne-codegen to generate a typed open hexa client (HEXA-1254)#264
yolanfery merged 54 commits into
mainfrom
HEXA-1254-ariadne-codegen-for-sdk

Conversation

@yolanfery

@yolanfery yolanfery commented May 16, 2025

Copy link
Copy Markdown
Contributor

Recently, we have introduced in the SDK package the GraphQL file taken from the OpenHexa app to help with identifying breaking changes between the SDK and the Backend server.

This opens up an opportunity to leverage Ariadne-codgen to generate a typed API. This PR is about installing this and using it for the pipelines list command to serve as an example. Existing commands are left unchanged to reduce the risk of regressions but it would be expected to use this typed client going forward for future features.

Changes

  • Install ariadne-codegen and ensure our pre-commit checks for changes related to graphql
  • Extend the autogenerated client to create a OpenHexaClient, defining the url and headers as well as some logging
  • Use the auto generated methods to refactor pipelines list
  • Adapt unit tests

How/what to test

/Users/yolanfery/Desktop/openhexa-sdk-python/venv/bin/openhexa pipelines list

@@ -0,0 +1,372 @@
# Generated by ariadne-codegen

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.

Files in graphql_client are auto generated by ariadne-codegen

@yolanfery yolanfery requested review from bramj and nazarfil May 20, 2025 07:49

@nazarfil nazarfil left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Screenshot 2025-05-22 at 17 25 17
Tested locally , works as expected

Comment thread openhexa/cli/cli.py
workspace_pipelines = get_pipelines()
workspace_pipelines = (
OpenHexaClient().get_workspace_pipelines(workspace_slug=settings.current_workspace).pipelines.items
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Very nice, cool example of usage

@yolanfery yolanfery merged commit 670fe92 into main May 22, 2025
4 checks passed
@yolanfery yolanfery deleted the HEXA-1254-ariadne-codegen-for-sdk branch May 22, 2025 16:44
@nazarfil nazarfil restored the HEXA-1254-ariadne-codegen-for-sdk branch May 26, 2025 13:23
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