OpenAPITools / OpenAPITools/openapi-generator

[REQ] [csharp] Remove DataContract from model

Open
#19,651 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Enhancement: Feature
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

I want to inherit from Model generated by openapi generator, then I found the new property always null because it doesn't have DataMember attribute and since this Model is declared with DataContract attribute, it would serialize by DataContract & DataMember. This requires the inherit class also has DataMember attribute with new property. That isn't convenient to always ask used project to know this rule and it is better to let Web Application to config what is the serialize and deserialize rule for Json.

It is better to have the option to remove DataContract & DataMember attribute.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the C# model generation path and how DataContract and DataMember are currently emitted. Identify where generator configuration is defined, then check existing C# generation tests before deciding how the option should behave. Done means users can configure whether these attributes are emitted and the behavior is covered by tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, openapi
Domain
tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.