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

Upgrade OpenAPI Generator to 6.1.0-SNAPSHOT #16026

Merged
merged 9 commits into from
Aug 27, 2022

Conversation

pmossman
Copy link
Contributor

@pmossman pmossman commented Aug 26, 2022

What

Upgrade our version of openapi-generator to the latest, so that we can take advantage of the fix we sponsored here: OpenAPITools/openapi-generator#13025

The core change in this version of openapi-generator is that schemas with optional array fields are now instantiated in Java as null instead of new ArrayList<>(). We need this new behavior to implement PATCH update requests, so that clients can leave array fields as null to indicate that they should be left unchanged.

This unblocks our issue to make the Connection Update endpoint use PATCH semantics: https://github.com/airbytehq/airbyte-cloud/issues/2064

How

  • Upgrades openapi-generator version to v6.1.0-SNAPSHOT
  • Updates some build syntax to work with this new version
  • Updates a few places in our code was was relying on the old flawed behavior of instantiating null array fields as an empty list.

Note to reviewers:

  • I chose to leave config.yaml untouched, but there are some cases where I could see an argument for marking an array field as required, which would force it to be generated as an empty ArrayList like before. For example, our ConnectionRead currently specifies operationIds as an optional array field. Does this make sense? Or would it be clearer to actually specify operationIds as required, since it isn't really clear what null means when reading a Connection. Perhaps it would always be clearer to have an explicit empty array unless otherwise specified.

@github-actions github-actions bot added area/api Related to the api area/documentation Improvements or additions to documentation area/platform issues related to the platform area/server labels Aug 26, 2022
Copy link
Contributor

@cgardens cgardens left a comment

Choose a reason for hiding this comment

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

nice! great working, getting this done with the openapi generator people. I also appreciate the comments explaining why we've taken the approach we have.

@pmossman pmossman temporarily deployed to more-secrets August 26, 2022 20:41 Inactive
@pmossman pmossman temporarily deployed to more-secrets August 26, 2022 20:55 Inactive
@pmossman pmossman temporarily deployed to more-secrets August 26, 2022 23:07 Inactive
@pmossman pmossman temporarily deployed to more-secrets August 26, 2022 23:45 Inactive
@@ -22,7 +24,7 @@ task generateApiServerLegacy(type: GenerateTask) {
invokerPackage = "io.airbyte.api.invoker.generated"
modelPackage = "io.airbyte.api.model.generated"

importMappings = [
schemaMappings = [
Copy link
Contributor

Choose a reason for hiding this comment

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

is this a change in the plugin syntax?

Copy link
Contributor

@davinchia davinchia left a comment

Choose a reason for hiding this comment

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

Thanks @pmossman ! Great stuff getting this in!

Just to make sure I understand, the non-api related generation code here is adjusting things to conform to our new behaviour of a null field = not set, and an empty field = set to empty. Is that right?

@pmossman
Copy link
Contributor Author

Yes @davinchia that's right!

@pmossman pmossman merged commit 6a06c5b into master Aug 27, 2022
@pmossman pmossman deleted the parker/openapi-generator-version-upgrade branch August 27, 2022 01:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/api Related to the api area/documentation Improvements or additions to documentation area/platform issues related to the platform area/server
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants