Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] [typescript-fetch] Incorrect uppercase enum name when having colon #20390

Open
AntoineDuComptoirDesPharmacies opened this issue Dec 31, 2024 · 0 comments

Comments

@AntoineDuComptoirDesPharmacies
Copy link
Contributor

AntoineDuComptoirDesPharmacies commented Dec 31, 2024

Bug Report Checklist

  • [ X ] Have you provided a full/minimal spec to reproduce the issue?
  • [ X ] Have you validated the input using an OpenAPI validator (example)?
  • [ X ] Have you tested with the latest master to confirm the issue still exists?
  • [ X ] Have you searched for related issues/PRs?
  • [ X ] What's the actual output vs expected output?
Description

When generating a typescript client, the following enum value is not good translated.
When using enumPropertyNaming = Uppercase :
API : ASKING_FOR:desc
Generated name (default/pascalCase) : AskingFoRdesc
Generated name (uppercase) : ASKING_FO_RDESC

The real name should be : ASKING_FOR_DESC

openapi-generator version

Openapi generator used : 7.10.0
In past version (4.3.0) the result name was :
ASKINGFORDESC

OpenAPI declaration file content or url
openapi: "3.0.0"
servers:
  - url: 'https://lecomptoirdespharmacies.fr/v1'
info:
  description: "This is the REST API of LCDP products"
  version: "1.0.0"
  title: "LCDP REST API"
  termsOfService: "https://www.lecomptoirdespharmacies.fr/mentions-legales"
  contact:
    email: "[email protected]"
  license:
    name: "Apache 2.0"
    url: "http://www.apache.org/licenses/LICENSE-2.0.html"
tags:
  - name: "searchSaleOffer"
    description: "Search sale offer"
paths:

  /sale-offers/{saleOfferStatus}:
    get:
      tags:
        - "searchSaleOffer"
      summary: "Search sale offers by status"
      operationId: "getSaleOffersByStatus"
      parameters:
        - $ref: "#/components/parameters/SaleOfferStatusParameter"
      responses:
        200:
          description: "Success"
        403:
          description: "Access denied"
        400:
          description: "Bad Request"


components:

  parameters:
    SaleOfferStatusParameter:
      in: path
      name: saleOfferStatus
      required: true
      schema:
        $ref: '#/components/schemas/SaleOfferStatus'

  schemas:
    SaleOfferStatus:
      type: string
      enum: ["ASKING_FOR:desc"]
      description: "Is this sale offer enabled or not"
Generation Details

java -jar openapi-generator-cli-7.10.0.jar generate -g typescript-fetch -o output -i openapi.yaml --additional-properties enumPropertyNaming=UPPERCASE

Steps to reproduce
  1. Run the CLI
  2. Go in output/models/SaleOfferStatus.ts to see the bad result
Related issues/PRs
Suggest a fix

See #20391

AntoineDuComptoirDesPharmacies added a commit to LeComptoirDesPharmacies/openapi-generator that referenced this issue Dec 31, 2024
Manage colon converting to underscore on sanitize
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant