Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code generation for Interfaces not working correctly #132

Closed
maaft opened this issue Mar 18, 2021 · 3 comments
Closed

Code generation for Interfaces not working correctly #132

maaft opened this issue Mar 18, 2021 · 3 comments

Comments

@maaft
Copy link

maaft commented Mar 18, 2021

Hi,

first of all - thank you very much for this great piece of work.
I have some problems with code generation. Attached you find my schema.json and my operations.gql so you can reproduce this.

First, types that implement interfaces are not correctly used in the generated operations.py:
image

Steps to reproduce:

  1. sgqlc-codegen schema schema.json schema.py
  2. sgqlc-codegen operation --schema schema.json client:schema operations.py operations.gql
  3. Open operations.py and note that BarBaz cannot be found. Either an import is missing or the codegen should put out client.BarBaz instead.

Second, is it possible to get auto-completion in vscode for the generated operations? Currently the derived type seems to be Any. I'm currently using pylance but can of course use something else.

image

client.zip

@barbieri
Copy link
Member

I'll take a look at the bug, that BarBaz should be used inside client.schema, so definitely missing it. But it will take me some time, currently busy with some work projects.

As for your second point, unfortunately that's bit harder due the usage of meta classes. What I plan to do someday is to generate that for queries, see #129

@maaft
Copy link
Author

maaft commented Mar 19, 2021

I can surely write a PR. Can you point me into the right direction maybe where the code might fail?

OK, I found it. Will submit a PR soon.

maaft pushed a commit to maaft/sgqlc that referenced this issue Mar 19, 2021
@maaft
Copy link
Author

maaft commented Mar 19, 2021

Can you please approve #134 ?

@barbieri barbieri mentioned this issue Apr 14, 2021
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

No branches or pull requests

2 participants