-
Notifications
You must be signed in to change notification settings - Fork 0
feat(core): security scheme extraction and auth-aware code generation #31
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: refactor/issue-model
Are you sure you want to change the base?
Changes from all commits
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 | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -14,7 +14,7 @@ object CodeGenerator { | |||||||||
| spec: ApiSpec, | ||||||||||
| modelPackage: String, | ||||||||||
| apiPackage: String, | ||||||||||
| outputDir: File | ||||||||||
| outputDir: File, | ||||||||||
| ): Result { | ||||||||||
| val modelFiles = ModelGenerator(modelPackage).generate(spec) | ||||||||||
| modelFiles.forEach { it.writeTo(outputDir) } | ||||||||||
|
|
@@ -27,8 +27,10 @@ object CodeGenerator { | |||||||||
| return Result(modelFiles.size, clientFiles.size) | ||||||||||
| } | ||||||||||
|
|
||||||||||
| fun generateSharedTypes(outputDir: File): Int { | ||||||||||
| val files = ApiResponseGenerator.generate() + ApiClientBaseGenerator.generate() | ||||||||||
| fun generateSharedTypes(outputDir: File, specs: List<ApiSpec> = emptyList()): Int { | ||||||||||
| val securitySchemes = specs.flatMap { it.securitySchemes } | ||||||||||
|
|
||||||||||
| val files = ApiResponseGenerator.generate() + ApiClientBaseGenerator.generate(securitySchemes) | ||||||||||
|
Comment on lines
+31
to
+33
|
||||||||||
| val securitySchemes = specs.flatMap { it.securitySchemes } | |
| val files = ApiResponseGenerator.generate() + ApiClientBaseGenerator.generate(securitySchemes) | |
| val files = ApiResponseGenerator.generate() + ApiClientBaseGenerator.generate() |
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 multiple
Bearer/Basicschemes are present, this implementation willappend(HttpHeaders.Authorization, ...)multiple times, producing multipleAuthorizationheaders on a single request. Many servers reject or mis-handle that header; consider enforcing at most one Authorization-based scheme, or generating a single chosen header based on security requirements rather than applying all schemes unconditionally.