-
-
Notifications
You must be signed in to change notification settings - Fork 7.4k
Closed
Labels
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
In the following definition, the mode property in TestResponse uses allOf for a single enum type.
TestResponse:
type: object
properties:
mode:
description: Test mode
type: object
allOf:
- $ref: '#/components/schemas/TestEnum'
TestEnum:
description: Specify the test mode
type: string
enum:
- A
- BThis technique, while peculiar, has been effective in preserving the description in the generated property until version 6.4.0, resulting in the following C# code:
/// <summary>
/// Test mode
/// </summary>
/// <value>Test mode</value>
[DataMember(Name="mode", EmitDefaultValue=false)]
public TestEnum? Mode { get; set; }However, starting with version 6.5.0 and later, the description is no longer included in the generated code, resulting in a loss of compatibility. The change in behavior can be observed in the following code snippet:
/// <summary>
/// Gets or Sets Mode
/// </summary>
[DataMember(Name="mode", EmitDefaultValue=false)]
public TestEnum? Mode { get; set; }This compatibility issue has been present since the commit a4dd90c.
openapi-generator version
6.5.0 and later, including the latest master
OpenAPI declaration file content or url
openapi: 3.0.0
info:
title: allOf enum test
version: 1.0.0
paths: {}
components:
schemas:
TestResponse:
type: object
properties:
mode:
description: Test mode
type: object
allOf:
- $ref: '#/components/schemas/TestEnum'
TestEnum:
description: Specify the test mode
type: string
enum:
- A
- BGeneration Details
java -jar openapi-generator-cli-7.2.0.jar generate -g csharp -i simple.yaml
Related issues/PRs
Reactions are currently unavailable