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
Added basic and API key and secret credentials for Kafka and SR cluster configs in direct connections #152
Added basic and API key and secret credentials for Kafka and SR cluster configs in direct connections #152
Changes from all commits
8a590d5
d133637
bddcba6
11bcfdd
e850e2f
6eab489
ec8efab
be8363f
17e152e
f6ccb94
8956b34
64caacd
ff7c85c
bcd19b3
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.
TLDR: Including
allOf
here generates the API client code withcredentials
as a genericobject
rather than the more strongly typed union object. Let's keep it this way while the incessant bugs in the typescript-fetch template are fixed, at the cost of a bit of developer unfriendliness in trying to determine whether the opaqueobject
is aBasicCredentials
orApiKeyAndSecret
.Upon running
npx gulp apigen format
in the confluentinc/vscode repo after copying over the OpenAPI spec from this branch, I see the following diff forsrc/clients/sidecar/models/KafkaClusterConfig.ts
(out of a few other changed files too). You'll see that the type forcredentials
in the generated TypeScript interface isobject | null
.Git diff for `src/clients/sidecar/models/KafkaClusterConfig.ts`
To actually declare the type of
credentials
as a union ofBasicCredentials
andApiKeyAndSecret
, we'll need to remove theallOf
from the spec above (using some bespoke parameter in the@Schema
annotation somewhere).So, I did exactly that, removed the
allOf
field from bothKafkaClusterConfig
andSchemaRegistryClusterConfig
, then generated the clients again usingnpx gulp apigen format
. Well, this opened a can of worms. Read on..confluentinc/vscode uses the typescript-fetch template to generate the API client code, and we've currently pinned its version to 7.7.0. The generated type for
credentials
was how I'd expected it to be (see below), but unfortunately, there was a bug in one of the functions in the generated code: "Function lacks ending return statement and return type does not include 'undefined'".So, I upgraded the openapi-generator-version to the latest stable version 7.9.0 in the hopes that this bug will disappear and regenerated the API clients (370 file diff) with the sans-
allOf
OpenAPI spec. Unfortunately, there was yet another bug in the generated code. It was fixed just last week and will likely be a while before it makes it into a stable release.All this to say, let's keep this spec as is and wait to see if the next release of openapi-generator poses issues.