-
Notifications
You must be signed in to change notification settings - Fork 0
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
Cannot get data object from .body attribute #2
Comments
This is because the instance inherits from frozendict. Treat it as a normal dictionary and you will be able to access key value pairs. From these docs: |
Thanks @spacether using the following works project_id = data_obj['projectId']
data_id = data_obj['data']['id'] Just a little confused why the IDE thinks that it's okay to retrieve these as attributes of the object? Using attributes works for libica which uses a similar openapi generation technique, so would be great to see the type-hinting features replicated here too |
Per the readme payloads subclass all validated schema classed so dot property access is available at runtime. If this project updates their generator to openapi Json schema generator v3 or higher property methods will be written and are seen in the idea. |
I'm not seeing this behaviour when I run it. Traceback (most recent call last):
File "/tmp/tmp.Evrx4k5DC6/sdk-test.py", line 54, in <module>
print(data_obj.projectId)
^^^^^^^^^^^^^^^^
raise AttributeError(f"{self} has no attribute '{name}'") |
Hmm would have to check. It could be because the properties are optional so properties weren't written for them in an older version. |
@spacether these properties definitely are not optional. The swagger this sdk is derived from is here: https://ica.illumina.com/ica/api/swagger/index.html With the ProjectData output here - https://ica.illumina.com/ica/api/swagger/index.html#/Project%20Data/getProjectData |
@kcutler0 do you have an ETA on when you expect this be solved? |
I'll take a look this week and provide an update or at least a working example. |
If this project is upgraded to use the latest version of the python client, which is in this repo |
@kcutler0 how'd you go with this? |
Working on that now for v2.21 branch. I checked the differences in parameters between the openapi generators (openapi-generator-cli vs openapi-generator-cli.jar) and didn't see major differences that would change the actual issue, but I did update to later version of the generator v7.1 as well as add some of the parameters from your makefile https://github.com/umccr-illumina/libica/blob/main/syncapi2.sh
|
@victorskl might have a bit more insight on the libica parameters |
@kcutler0 how did you go with this? |
@alexiswl I promise I'm not ignoring the issue, I'm just having trouble getting the later version of openapi-generator-cli that include pydantic validation to allow the import of the generated module. I don't have a workaround yet but am still working on it |
@kcutler0 any updates on this project? |
@kcutler0 following this up |
Hello,
Trying some basic ProjectData get requests via the ICA SDK python.
I have a simple python script here:
Details
Which yields the following logs
Details
Screen shot of IDE thinking it should be able to collect the .data attribute
And the child 'id' attribute
How am I supposed to use this SDK? Can you provide an example that collects the API response?
Alexis
The text was updated successfully, but these errors were encountered: