Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
π octavia-cli: generate open api client #9277
π octavia-cli: generate open api client #9277
Changes from 13 commits
e217327
e45096e
f2ed2f9
d9eb674
c15835f
2afe6c2
edf3132
690c75a
0d5ad55
3758b53
5732526
c3f0d89
f746be2
b285449
6d1444b
e95abc9
643c1aa
d2e5382
a586719
b306dec
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what are you trying to achieve here? because these fields are not in the
required
list above they should already be nullable and should not require the extranullable
field.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I called the workspace endpoint with the generated API client it raises an error during serialization of the response because it expected this field to be not nullable. When I make this change in
config.yaml
the problem is bypassed. I'm going to check if I can find another solution by tweaking some generator options, otherwise, I'll have to make these kinds of changes inconfig.yaml
for other endpoints that will be used in the future, which is not ideal.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah. that seems like kinda big deal. swagger generation is always a little jenky around the edges, but nullable fields is a pretty core feature, so it seems like a really bad sign if the generator can't handle it because it means there will be other problems.
one thing to test is instead of using the
nullable
field if instead settingtype: [boolean, null]
works. I don't like this as much as the pattern we already use but if we needed to switch to this pattern it may not be the end of the world.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found this issue OpenAPITools/openapi-generator#4816 on OpenApiTools repo, this is for their C# generator but it looks like the exact same problem I have with the Python one. I'll continue to investigate and try
type: [boolean, null]
. Let me know if you think that I should rather implement the client myself.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we definitely don't want to implement it ourselves. my guess is the C# bug is language specific (since C# is actually a typed language)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried
[boolean, null]
but this is not a valid spec according to open-api-generator.I think I found a workaround. I can disable the type validation of the response. It also disables deserialization to a model and leads us to manipulate the raw response as a python dict. It's not the most elegant solution but I prefer this rather than editing the API spec. Related commit: a586719
I also reverted my changes on
airbyte-api
'sconfig.yaml
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does the caching work properly on this task? the expectation should be that if
airbyte-api/src/main/openapi/config.yaml
does not change that this task does not need to run again. if that's not set up properly it will require re-executing this task and every tasks that depends on them (which is most of them).see
UP-TO-DATE
in https://docs.gradle.org/current/userguide/more_about_tasks.htmlThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this suggestion! I realized I could use a grade plugin already used for java API client generation:
org.openapitools.generator.gradle.plugin.tasks.GenerateTask
. It supports incremental builds, but I can't figure why it's not working in my context.I did the following in b285449:
octavia-cli/build.gradle
to use the GenerateTask.Still, I don't get why I can't see the
UP-TO-DATE
flag after consequent builds.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I finally made the
FROM-CACHE
andUP-TO-DATE
mechanisms work. The solution was to use thebuildDir
as output dir. Using other paths made Gradle re-run the task on each run. The generated client is now stored inoctavia-cli/build/airbyte_api_client
. Related commit: e95abc9I confirm that changes in
airbyte-api/src/main/openapi/config.yaml
will trigger a regeneration of the client onSUB_BUILD=OCTAVIA_CLI ./gradlew build
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
awesome!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like you to present this very briefly in the dev meeting. This is something we often get wrong when using gradle, so it would be good to have a 5 minute presentation to share the knowledge with the team.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok! To be honest, I'm not understanding why using input paths for tasks that are not
buildDir
does not lead toUP-TO-DATE
but it could indeed be interesting to share this finding and to open this discussion in the dev meeting.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
π