OpenAPITools / OpenAPITools/openapi-generator
[BUG] [Csharp-SDK] EmitDefault for readonly property set to true when emitDefault is set to false in config file.
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
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
The readonly property has the emitDeafult attribute true though in the config file it is set to EmitDefault = false.
openapi-generator version
OpenAPI declaration file content or url
"ConfigChangeDetails": {
"description": "An array of relationships to serverConfigChangeDetail resources.",
"type": "array",
"items": {
"$ref": "#/components/schemas/server.ConfigChangeDetail.Relationship"
},
"nullable": true,
"readOnly": true,
}
(for JSON code), so it becomes more readable. If it is longer than about ten lines,
please create a Gist (https://gist.github.com) or upload it somewhere else and
link it here.
Generation Details
Steps to reproduce
the generated code for above property looks like this
/// <summary>
/// An array of relationships to serverConfigChangeDetail resources.
/// </summary>
/// <value>An array of relationships to serverConfigChangeDetail resources.</value>
[DataMember(Name = "ConfigChangeDetails", EmitDefaultValue = true)]
public List<ServerConfigChangeDetailRelationship> ConfigChangeDetails { get; private set; }
Related issues/PRs
Suggest a fix
the EmitDefault property should be false
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with C# SDK generation for the provided read-only ConfigChangeDetails schema and the config setting that controls EmitDefault. Compare the generated DataMember attribute with emitDefault set to false; done when the readonly property emits EmitDefaultValue = false.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- api, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100