[typescript-fetch] Fix Omit generic using baseName for readOnly fields in API requests
Fixes #19572
Description
Context: In the typescript-fetch generator, the generated Omit generic in API request interfaces was incorrectly using the baseName (e.g., created_at) instead of the generated TypeScript property name for readOnly fields (e.g., createdAt).
Because ToJSON safely strips out readOnly fields at runtime anyway, this bug did not break the actual JSON payloads sent to the backend. However, it caused TypeScript typing errors because the readOnly properties were incorrectly left exposed in the TypeScript request interfaces.
(FYI: A similar fix was recently merged in #24275 for modelGeneric.mustache. This PR applies the same fix to apis.mustache to complete the resolution for issue #19572).
PR checklist
- Read the contribution guidelines.
- Run the following to build the project and update samples:
(For Windows users, please run the script in WSL)./mvnw clean package || exit ./bin/generate-samples.sh ./bin/configs/*.yaml || exit ./bin/utils/export_docs_generators.sh || exit
Commit all changed files.
This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
These must match the expectations made by your contribution.
You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example./bin/generate-samples.sh bin/configs/java*.
IMPORTANT: Do NOT purge/delete any folders/files (e.g. tests) when regenerating the samples as manually written tests may be removed. - If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.
@TiFu (2017/07) @taxpon (2017/07) @sebastianhaas (2017/07) @kenisteward (2017/07) @Vrolijkx (2017/09) @macjohnny (2018/01) @topce (2018/10) @akehir (2019/07) @petejohansonxo (2019/11) @amakhrov (2020/02) @davidgamero (2022/03) @mkusaka (2022/04) @joscha (2024/10)
Summary by cubic
Fixes #19572 by using camelCase TypeScript property names in Omit for readOnly fields in typescript-fetch API request interfaces. This prevents typing errors; runtime payloads are unchanged.
- Bug Fixes
- Use
'name'instead of'baseName'when buildingOmitfor readOnly props inapis.mustache. - Added test and sample spec to ensure camelCase fields (e.g., createdAt, updatedAt) are used in generated request types.
- Use