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

[BUG] C# GenerericHost - Exception #18607

Open
4 tasks done
marcselman opened this issue May 8, 2024 · 1 comment · May be fixed by #18706
Open
4 tasks done

[BUG] C# GenerericHost - Exception #18607

marcselman opened this issue May 8, 2024 · 1 comment · May be fixed by #18706

Comments

@marcselman
Copy link

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
Description

When trying to generate C# output using the GenericHost library I get an exception.
java.lang.IllegalArgumentException: Comparison method violates its general contract!
If I remove some property from the component schema or if I remove some required properties, the error goes away.
It looks like the specific combination of properties in the file somehow cause the error.

This is the whole error:

Exception in thread "main" java.lang.RuntimeException: Could not process model 'MixLog'.Please make sure that your schema is correct!
        at org.openapitools.codegen.DefaultGenerator.generateModels(DefaultGenerator.java:542)
        at org.openapitools.codegen.DefaultGenerator.generate(DefaultGenerator.java:1228)
        at org.openapitools.codegen.cmd.Generate.execute(Generate.java:535)
        at org.openapitools.codegen.cmd.OpenApiGeneratorCommand.run(OpenApiGeneratorCommand.java:32)
        at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:66)
Caused by: java.lang.IllegalArgumentException: Comparison method violates its general contract!
        at java.base/java.util.TimSort.mergeLo(TimSort.java:781)
        at java.base/java.util.TimSort.mergeAt(TimSort.java:518)
        at java.base/java.util.TimSort.mergeCollapse(TimSort.java:448)
        at java.base/java.util.TimSort.sort(TimSort.java:245)
        at java.base/java.util.Arrays.sort(Arrays.java:1308)
        at java.base/java.util.ArrayList.sort(ArrayList.java:1804)
        at java.base/java.util.Collections.sort(Collections.java:178)
        at org.openapitools.codegen.languages.CSharpClientCodegen.fromModel(CSharpClientCodegen.java:469)
        at org.openapitools.codegen.DefaultGenerator.processModels(DefaultGenerator.java:1683)
        at org.openapitools.codegen.DefaultGenerator.generateModels(DefaultGenerator.java:537)
        ... 4 more
openapi-generator version

7.5.0

OpenAPI declaration file content or url

https://gist.github.com/marcselman/78b1516e5a15c92da70a31c851c11c6c

Generation Details
openapi-generator-cli generate -g csharp -o "./client" --package-name "Demonstration" -i "openapi.2023.11.0.json" --additional-properties "library=generichost,nullableReferenceTypes=true,netCoreProjectFile=true,disallowAdditionalPropertiesIfNotPresent=false,targetFramework=net8.0,generateAliasAsModel=false,useDateTimeOffset=true,validatable=true,equatable=false,modelPropertyNaming=PascalCase,useCollection=false,returnICollection=false"
@wing328
Copy link
Member

wing328 commented May 8, 2024

thanks for reporting the issue

cc @devhl-labs

@devhl-labs devhl-labs linked a pull request May 19, 2024 that will close this issue
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants