We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Foo class generated from the following declaration has a comparison between null and the property 'Bar' of which type is EnumA.
Foo
EnumA
openapi: 3.0.0 info: title: enum ref test version: 1.0.0 paths: {} components: schemas: foo: type: object properties: bar: $ref: '#/components/schemas/enumA' enumA: type: string enum: - "a" - "b"
public bool Equals(Foo input) { if (input == null) { return false; } return ( this.Bar == input.Bar || (this.Bar != null && this.Bar.Equals(input.Bar)) ); }
The code generator must omit the comparison because EnumA is a value type. The generator seems to fail to resolve the ref #/components/schemas/enumA.
#/components/schemas/enumA
If I change the key of the enum declarlation to EnumA as follows, the result doesn't have the comparison.
openapi: 3.0.0 info: title: enum ref test version: 1.0.0 paths: {} components: schemas: foo: type: object properties: bar: $ref: '#/components/schemas/EnumA' EnumA: type: string enum: - "a" - "b"
public bool Equals(Foo input) { if (input == null) { return false; } return ( this.Bar == input.Bar || this.Bar.Equals(input.Bar) ); }
openapi-generator-cli-6.1.0-20220820.044513-79.jar
Just run the following command. `simple.yml' contains the above declarations.
java -jar openapi-generator-cli-6.1.0-20220820.044513-79.jar generate -g csharp-netcore -i simple.yml
I will submit a PR to fix this.
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
Bug Report Checklist
Description
Foo
class generated from the following declaration has a comparison between null and the property 'Bar' of which type isEnumA
.The code generator must omit the comparison because
EnumA
is a value type. The generator seems to fail to resolve the ref#/components/schemas/enumA
.If I change the key of the enum declarlation to
EnumA
as follows, the result doesn't have the comparison.openapi-generator version
openapi-generator-cli-6.1.0-20220820.044513-79.jar
Steps to reproduce
Just run the following command. `simple.yml' contains the above declarations.
Suggest a fix
I will submit a PR to fix this.
The text was updated successfully, but these errors were encountered: