Fix incorrect Uni<Set<Enum>> generation due to path interference#1464
Fix incorrect Uni<Set<Enum>> generation due to path interference#1464pavelkryl wants to merge 1 commit intoquarkiverse:mainfrom
Conversation
ricardozanini
left a comment
There was a problem hiding this comment.
Seems ok to fix your specific use case. I'm asking a few questions since it can impact other users as well, especially if you are restricting the checks for 200 http code and application/json content type.
| OperationsMap result = super.postProcessOperationsWithModels(objs, allModels); | ||
|
|
||
| Map<String, Object> operations = (Map<String, Object>) result.get("operations"); | ||
| List<org.openapitools.codegen.CodegenOperation> os = (List<org.openapitools.codegen.CodegenOperation>) operations |
There was a problem hiding this comment.
Can you import this class instead?
| private Operation findOperation(String path, String httpMethod) { | ||
| if (this.openAPI == null) | ||
| return null; | ||
| io.swagger.v3.oas.models.PathItem pathItem = this.openAPI.getPaths().get(path); |
There was a problem hiding this comment.
| io.swagger.v3.oas.models.PathItem pathItem = this.openAPI.getPaths().get(path); | |
| PathItem pathItem = this.openAPI.getPaths().get(path); |
Can you do the imports here too?
| && openApiOperation.getResponses().get("200").getContent() != null && openApiOperation | ||
| .getResponses().get("200").getContent().get("application/json") != null) { | ||
| Schema<?> responseSchema = openApiOperation.getResponses().get("200").getContent() | ||
| .get("application/json").getSchema(); |
There was a problem hiding this comment.
Why does it only apply to 200? Perhaps add it for 2xx. I also found it curious why enforcing the schema to only JSON.
| // DEBUG: returnContainer = {op.returnContainer} | ||
| {#if op.imports} | ||
| // DEBUG: imports = {op.imports} | ||
| {/if} |
There was a problem hiding this comment.
Can you remove these comments please?
| super.postProcessModelProperty(model, property); | ||
| if ("set".equals(property.containerType)) { | ||
| model.imports.add("Arrays"); | ||
| public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List<ModelMap> allModels) { |
There was a problem hiding this comment.
Does this method override the feature of postProcessModelProperty? Asking out of curiosity - it's been a long time since I did this.
|
Hello @pavelkryl I would love to have this one merge, are you minding to solve the @ricardozanini comments? |
|
Sorry @mcruzdev I am completely buried :/ I have no time in the next 2 weeks |
|
No worry, you did a great work! Could you give me access to your repo to address these comments? |
|
sure! would be nice if you could finish this, thank you |
Summary
Uni<Set<String>>was incorrectly generated instead ofUni<Set<MyEnum>>when multiple paths share enum schemasTest plan
client/integration-tests/reuse-enums/to verify correct enum type generation🤖 Generated with Claude Code