Skip to content

feat: make all queries/mutations available in the SDK with typed methods (HEXA-1305)#275

Closed
yolanfery wants to merge 5 commits into
mainfrom
HEXA-1305-make-all-queries-available-in-the-sdk-and-update-wiki-with-example
Closed

feat: make all queries/mutations available in the SDK with typed methods (HEXA-1305)#275
yolanfery wants to merge 5 commits into
mainfrom
HEXA-1305-make-all-queries-available-in-the-sdk-and-update-wiki-with-example

Conversation

@yolanfery

@yolanfery yolanfery commented Jun 20, 2025

Copy link
Copy Markdown
Contributor

🚨 This is an experiment. Let's discuss this before giving it a proper review, thanks.

→ There is already a big limitation : since we need the define a depth limit (in this case 3), each sub-attribute requiring a parameter, is exposing this parameter to the method, resulting in cluttered and irrelevant required parameters. Example :

 query workspace($key: String!, $ignoreHiddenFiles: Boolean, $page: Int, $perPage: Int, $prefix: String, $query: String, $name: String!, $page1: Int, $perPage1: Int, $page2: Int, $perPage2: Int, $pinned: Boolean, $query1: String, $includeAccepted: Boolean, $page3: Int, $perPage3: Int, $page4: Int, $perPage4: Int, $slug: String!) {
              workspace(slug: $slug) {
                bucket {
                  name
                  object(key: $key) {

The key is required for the object, so its required in the resulting python interface :

  def workspace(
        self,
        key: str,
        name: str,
        slug: str,
        ignore_hidden_files: Union[Optional[bool], UnsetType] = UNSET,
        page: Union[Optional[int], UnsetType] = UNSET,
        per_page: Union[Optional[int], UnsetType] = UNSET,
        prefix: Union[Optional[str], UnsetType] = UNSET,
        query: Union[Optional[str], UnsetType] = UNSET,

Leverage https://github.com/timqian/gql-generator to create queries for all queries and mutations defined in the schema

Changes

  • Introduce gqgl in the precommit and CI
  • Include the generated gql and python files
  • Improve the README

Screenshots / screencast

Screenshot 2025-06-20 at 16 37 09

@yolanfery yolanfery changed the title Hexa 1305 make all queries available in the sdk and update wiki with example feat: make all queries/mutations available in the SDK with typed methods (HEXA-1305) Jun 20, 2025
@yolanfery yolanfery requested review from bramj and nazarfil June 20, 2025 15:24
@yolanfery yolanfery self-assigned this Jun 20, 2025
Comment thread .gitignore
.pyre/

# AI tools settings
/.claude/settings.local.json No newline at end of file

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.

let's introduce our new co-worker ☺️

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

welcome claude

Comment thread README.md
Comment on lines +179 to +183
from openhexa.cli.api import OpenHexaClient, CreateWebappInput, AddToFavoritesInput

client = OpenHexaClient()
new_webapp_id = client.create_webapp(input=CreateWebappInput(description="", icon="", name="",workspaceSlug="", url="")).create_webapp.webapp.id
client.add_to_favorites(input=AddToFavoritesInput(webappId=new_webapp_id))

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.

Example of usage

Comment on lines 1894 to +1897
type GenericOutput {
name: String
type: String!
uri: String!
genericName: String
genericType: String!
genericUri: String!

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.

This small breaking change would be required in the backend as well to make the schema compatible with gqgl

@yolanfery yolanfery marked this pull request as ready for review June 20, 2025 15:32
@nazarfil nazarfil closed this Jun 23, 2025
@nazarfil nazarfil reopened this Jun 23, 2025
@yolanfery

Copy link
Copy Markdown
Contributor Author

My recommendation regarding this PR would be to either :

  • Just simply continue manually extending queries.graphql which is picked up by codegen and not use gqgl
  • Keep this mechanism for the mutations only (queries interfaces are too overloaded imo)

@nazarfil

Copy link
Copy Markdown
  • Just simply continue manually extending queries.graphql which is picked up by CodeGen and not use gqgl

I agree, the auto-generated methods are not as practical to contribute such big change to the codebase

@yolanfery

Copy link
Copy Markdown
Contributor Author

We all agreed, during our daily yesterday, to put this aside and explore a more manual approach for the queries and mutations.
So that we have less cluttered API methods, less tooling and more control.

This PR is replaced by #281

@yolanfery yolanfery closed this Jun 26, 2025
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