Skip to content

[BUG] Missing reserved words in Java and CSharp #16277

@jwenger100

Description

@jwenger100

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)?
  • [x ] Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • [x ] What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

I am running into issues in several languages with OAS that are using resource names that are causing conflicts in specific languages. For example, one of the teams is creating a resource called "System". When that generates using the "csharp-netcore" language target. It creates all kinds of problems because System is a reserved word in DotNet. But I don't see System on the reserved word list so I cannot map it to a different name via the command line reserved word mapping.

For Java, I just recently had a team using "OffsetDateTime", "LocalDate" and "LocalTime" as part of their component schemas. Again, this is causing issues when generating against the "java" project as it gets confused and thinks the instances of the class are part of the "java.time" namespace.

openapi-generator version

6.6.0

OpenAPI declaration file content or url

Java Issue:
https://gist.github.com/jwenger100/c6d6bbfaedd63fe9fce645b9d6869016

Csharp-netcore issue:
https://gist.github.com/jwenger100/a6d5238a939deeed43f53de360962adb

Generation Details

Java:

openapi-generator-cli generate -g java

CSharp-Netcore

openapi-generator-cli generate -g csharp-netcore --library=httpclient

Steps to reproduce
  1. Run the generator command against the OAS provided in the gist above.
  2. Try to compile the generated code, it will fail.
Related issues/PRs
Suggest a fix

#16276

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions