-
Notifications
You must be signed in to change notification settings - Fork 294
feat(csharp-sdk): remove omitted basic auth fields from SDK API, use empty string internally #14409
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
base: main
Are you sure you want to change the base?
Changes from all commits
266c344
99467fe
3b8db30
86ac58b
a405301
b41fd85
88250dd
abe481b
61e6899
86bdc62
a4edff7
0aaecec
784d50b
342a4ae
93c2242
c7ddfb5
3921d83
3b58b4e
6867963
90f03d8
a906dce
1f03553
996210c
fcf385e
6fb25c8
6dafafd
5cb74f2
bc8f325
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -732,11 +732,22 @@ export class DynamicSnippetsConverter { | |
| } | ||
| const scheme = auth.schemes[0]; | ||
| switch (scheme.type) { | ||
| case "basic": | ||
| return DynamicSnippets.Auth.basic({ | ||
| case "basic": { | ||
| const basicAuth: DynamicSnippets.BasicAuth & { | ||
| usernameOmit?: boolean; | ||
| passwordOmit?: boolean; | ||
| } = { | ||
| username: this.inflateName(scheme.username), | ||
| password: this.inflateName(scheme.password) | ||
| }); | ||
| }; | ||
| if (scheme.usernameOmit) { | ||
| basicAuth.usernameOmit = scheme.usernameOmit; | ||
| } | ||
| if (scheme.passwordOmit) { | ||
| basicAuth.passwordOmit = scheme.passwordOmit; | ||
| } | ||
| return DynamicSnippets.Auth.basic(basicAuth); | ||
|
Comment on lines
+736
to
+749
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔴 The In the production dynamic-snippets flow, the dynamic IR is serialized to JSON and deserialized by the generator using Prompt for agentsWas this helpful? React with 👍 or 👎 to provide feedback. |
||
| } | ||
| case "bearer": | ||
| return DynamicSnippets.Auth.bearer({ | ||
| token: this.inflateName(scheme.token) | ||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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 both username and password are omitted, the code skips adding any authorization header via
continue. However, this occurs regardless of whetherisAuthOptionalis true or false. If auth is mandatory (isAuthOptional === false) but both fields are omitted, the generated client will instantiate successfully (with no auth parameters) but all authenticated requests will fail at runtime with 401 errors.Alternatively, this validation should occur at IR validation time before code generation.
Spotted by Graphite

Is this helpful? React 👍 or 👎 to let us know.