OpenAPITools / OpenAPITools/openapi-generator

[BUG] [typescript-fetch] Readonly properties are being Omitted in the wrong case

Open
#18,587 1 comment 8 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Issue: Bug
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

Description

The generator emits objects with camelCase properties, but in cases where they should be omitted for being readonly, it omits them by snake_case, which is incorrect.

The issue was introduced in this change:
Omit readOnly properties from request models

The problem is visible in the sample output:
https://github.com/OpenAPITools/openapi-generator/blob/master/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Name.ts#L73

Name has a property snakeCase, but the generator outputs Omit<Name, "snake_case">.

openapi-generator version

7.5.0

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the generated sample at samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Name.ts and compare the snakeCase property declaration with its Omit type. Read the linked “Omit readOnly properties from request models” change to trace the generator path. Done means readonly omission uses the camelCase property name in generated TypeScript output, with regression coverage if the existing generator tests identify a suitable entry point.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, typescript
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.