OpenAPITools / OpenAPITools/openapi-generator
[BUG] C# Generator with component name "on" produces in correct datamember
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Bug Report Checklist
- [x ] 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?
Actual:
[DataMember(Name="true", EmitDefaultValue=false)]
Expected:
[DataMember(Name="on", EmitDefaultValue=false)]
- [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
I created a schema component for which one of the propties is called on. Somewhere in the generation step, the value on gets lost is translated to true
openapi-generator version
I'm using version 6.2.0
It's a regression. It used to work in version 5.x.x
OpenAPI declaration file content or url
openapi: 3.0.0
info:
version: 0.0.1
title: Test
paths:
/:
get:
summary: get test
responses:
'200':
description: OK
servers:
- url: http://localhost:81
components:
schemas:
Effect:
properties:
on:
description: If true, turns on the visual effect. If false, turn off the visual effect.
type: boolean
Generation Details
Steps to reproduce
- save the yml file as
example.yml - Run:
openapi-generator-cli generate -g csharp -i ./file.yml -o client
Related issues/PRs
Suggest a fix
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 by reproducing the issue with the supplied OpenAPI YAML and the command openapi-generator-cli generate -g csharp -i ./file.yml -o client using version 6.2.0. Trace the C# generator's handling of the component property named on; done means the generated DataMember uses Name="on" rather than Name="true", while preserving the boolean property behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, openapi
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100