swagger-api / swagger-api/swagger-codegen-generators
[c-sharp] Why does Oneof not generate inheritance-code alike the Java generated code?
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 299
- Forks
- 439
- PR merge metrics
- No merged PRs in 30d
Description
When using oneOf in an OpenAPI Spec, e.g.
components:
schemas:
EventDto:
type: object
properties:
data:
oneOf:
- $ref: '#/components/schemas/Quote'
- $ref: '#/components/schemas/Offer'
description: CloudEvent for Quote
QuoteDto:
type: object
properties:
quoteId:
type: string
OfferDto:
type: object
properties:
offerId:
type: string
The Java Code generator generates an interface OneOfEventDtoData and QuoteDto and OfferDto inherit from OneOfEventDtoData. Makes sense.
Why does c-sharp not generate similar code? There is no inheritance between the partial class OneOfEventDtoData and the QuoteDto and OfferDto classes
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 the OpenAPI oneOf example in the issue and compare the Java generator's output with the C# generator's output for EventDto, QuoteDto, and OfferDto. Trace the C# generator entry point for model generation and determine what tests cover oneOf schemas; done means the generated C# types provide the requested relationship without breaking existing output.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, openapi
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100