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] [csharp] Required properties not sorted in ctor #20589

Open
5 of 6 tasks
balassit opened this issue Feb 4, 2025 · 1 comment
Open
5 of 6 tasks

[BUG] [csharp] Required properties not sorted in ctor #20589

balassit opened this issue Feb 4, 2025 · 1 comment

Comments

@balassit
Copy link
Contributor

balassit commented Feb 4, 2025

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?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

Using the csharp emitter the required properties should not get a default value and they must then come first in the ordering.

Currently, it does not order the constructor doc or parameters based on being required flag. Additionally, the required properties are given a default value in the constructor. This is present in existing generated code which have required properties and optional properties.

openapi-generator version
OpenAPI declaration file content or url

samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools/Model/Pet.cs

Generation Details

./bin/generate-samples.sh ./bin/configs/csharp-restsharp-net8-echo-api.yaml

Steps to reproduce

view the Pet.cs file ctor and param documentation

Related issues/PRs
Suggest a fix

Sort order should be done before the template generation for the readWriteVars. not sure where this logic is though.

@gromilQaaaa
Copy link

+1

I am currently trying to cover it manually by using 2 blocks of readWriteVars {{#readWriteVars}}, with {{#required}}, then with {{^required}}. But I have big problems with adding commas, since {{#hasMore}} is checking all the list of varsity, not only required/notRequired

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants