Skip to content

Conversation

@semlak
Copy link

@semlak semlak commented Feb 10, 2026

Closes #[22540]

  • Add useErasableSyntax option to TypeScriptAxiosClientCodegen (default: false)
  • Update baseApi.mustache to generate erasable syntax when enabled
  • Fix semicolons in configuration.mustache for consistency
  • Add comprehensive test coverage (4 new tests, all passing)
  • Regenerate all typescript-axios samples with semicolon fixes

This change enables support for TypeScript's 'erasableSyntaxOnly' compiler
option by generating code without parameter properties when useErasableSyntax
is enabled. The feature is opt-in and fully backward compatible.

PR checklist

  • Read the contribution guidelines.
  • Pull Request title clearly describes the work in the pull request and Pull Request description provides details about how to validate the work. Missing information here may result in delayed response from the community.
  • Run the following to build the project and update samples:
    ./mvnw clean package || exit
    ./bin/generate-samples.sh ./bin/configs/*.yaml || exit
    ./bin/utils/export_docs_generators.sh || exit
    
    (For Windows users, please run the script in WSL)
    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.
  • File the PR against the correct branch: master (upcoming 7.x.0 minor release - breaking changes with fallbacks), 8.0.x (breaking changes without fallbacks)
  • If your PR solves a reported issue, reference it using GitHub's linking syntax (e.g., having "fixes #123" present in the PR description)
  • If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.

Summary by cubic

Adds optional erasable syntax support to the typescript-axios generator so projects using TypeScript’s erasableSyntaxOnly can compile generated clients. Opt-in and backward compatible; aligns with issue 22540 (“support for erasable syntax only”).

  • New Features
    • Added useErasableSyntax option (default: false) to TypeScriptAxiosClientCodegen.
    • Updated baseApi.mustache to avoid parameter properties and use explicit fields when enabled.
    • Documented the option in docs/generators/typescript-axios.md.
    • Added sample config and petstore build demonstrating erasable syntax.
    • Added tests covering the new option and output.
    • Standardized semicolons in configuration.mustache; regenerated affected samples.

Written for commit d39bf0f. Summary will update on new commits.

…axOnly compiler support

  - Add useErasableSyntax option to TypeScriptAxiosClientCodegen (default: false)
  - Update baseApi.mustache to generate erasable syntax when enabled
  - Fix semicolons in configuration.mustache for consistency
  - Add comprehensive test coverage (4 new tests, all passing)
  - Regenerate all typescript-axios samples with semicolon fixes

  This change enables support for TypeScript's 'erasableSyntaxOnly' compiler
  option by generating code without parameter properties when useErasableSyntax
  is enabled. The feature is opt-in and fully backward compatible.

  Closes #[issue-number-if-applicable]
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

6 issues found across 42 files

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="samples/client/petstore/typescript-axios/builds/with-erasable-syntax/docs/UserApi.md">

<violation number="1" location="samples/client/petstore/typescript-axios/builds/with-erasable-syntax/docs/UserApi.md:400">
P3: updateUser documentation describes the username as needing to be deleted, which is misleading for an update operation and appears to be copied from deleteUser.</violation>
</file>

<file name="samples/client/petstore/typescript-axios/builds/with-erasable-syntax/git_push.sh">

<violation number="1" location="samples/client/petstore/typescript-axios/builds/with-erasable-syntax/git_push.sh:57">
P2: Piping `git push` to `grep` in /bin/sh masks the push exit status, so CI can report success even if the push fails.</violation>
</file>

<file name="samples/client/petstore/typescript-axios/builds/with-erasable-syntax/docs/User.md">

<violation number="1" location="samples/client/petstore/typescript-axios/builds/with-erasable-syntax/docs/User.md:24">
P3: The example snippet uses shorthand properties (`id`, `username`, etc.) without declaring these variables, so the documentation sample is invalid TypeScript when copied.</violation>
</file>

<file name="samples/client/petstore/typescript-axios/builds/with-erasable-syntax/api.ts">

<violation number="1" location="samples/client/petstore/typescript-axios/builds/with-erasable-syntax/api.ts:437">
P2: Manually setting `Content-Type: multipart/form-data` on a FormData request strips the boundary, which can cause servers to reject multipart uploads. Let Axios/browser set the header automatically for FormData.</violation>
</file>

<file name="samples/client/petstore/typescript-axios/builds/with-erasable-syntax/docs/PetApi.md">

<violation number="1" location="samples/client/petstore/typescript-axios/builds/with-erasable-syntax/docs/PetApi.md:138">
P2: The `findPetsByStatus` example redeclares `status` in the same scope (`let status` then `const { status, data } = ...`), which is a SyntaxError in TypeScript/JavaScript and makes the example invalid.</violation>

<violation number="2" location="samples/client/petstore/typescript-axios/builds/with-erasable-syntax/docs/PetApi.md:349">
P2: The `updatePetWithForm` example redeclares `status` in the same scope (`let status` then `const { status, data } = ...`), which is a SyntaxError and breaks the example.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.


# Pushes (Forces) the changes in the local repository up to the remote repository
echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git"
git push origin master 2>&1 | grep -v 'To https'
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: Piping git push to grep in /bin/sh masks the push exit status, so CI can report success even if the push fails.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/client/petstore/typescript-axios/builds/with-erasable-syntax/git_push.sh, line 57:

<comment>Piping `git push` to `grep` in /bin/sh masks the push exit status, so CI can report success even if the push fails.</comment>

<file context>
@@ -0,0 +1,57 @@
+
+# Pushes (Forces) the changes in the local repository up to the remote repository
+echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git"
+git push origin master 2>&1 | grep -v 'To https'
</file context>
Fix with Cubic

if (file !== undefined) {
localVarFormParams.append('file', file as any);
}
localVarHeaderParameter['Content-Type'] = 'multipart/form-data';
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: Manually setting Content-Type: multipart/form-data on a FormData request strips the boundary, which can cause servers to reject multipart uploads. Let Axios/browser set the header automatically for FormData.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/client/petstore/typescript-axios/builds/with-erasable-syntax/api.ts, line 437:

<comment>Manually setting `Content-Type: multipart/form-data` on a FormData request strips the boundary, which can cause servers to reject multipart uploads. Let Axios/browser set the header automatically for FormData.</comment>

<file context>
@@ -0,0 +1,1661 @@
+            if (file !== undefined) { 
+                localVarFormParams.append('file', file as any);
+            }
+            localVarHeaderParameter['Content-Type'] = 'multipart/form-data';
+            localVarHeaderParameter['Accept'] = 'application/json';
+
</file context>
Fix with Cubic

let name: string; //Updated name of the pet (optional) (default to undefined)
let status: string; //Updated status of the pet (optional) (default to undefined)

const { status, data } = await apiInstance.updatePetWithForm(
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: The updatePetWithForm example redeclares status in the same scope (let status then const { status, data } = ...), which is a SyntaxError and breaks the example.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/client/petstore/typescript-axios/builds/with-erasable-syntax/docs/PetApi.md, line 349:

<comment>The `updatePetWithForm` example redeclares `status` in the same scope (`let status` then `const { status, data } = ...`), which is a SyntaxError and breaks the example.</comment>

<file context>
@@ -0,0 +1,441 @@
+let name: string; //Updated name of the pet (optional) (default to undefined)
+let status: string; //Updated status of the pet (optional) (default to undefined)
+
+const { status, data } = await apiInstance.updatePetWithForm(
+    petId,
+    name,
</file context>
Fix with Cubic


let status: Array<'available' | 'pending' | 'sold'>; //Status values that need to be considered for filter (default to undefined)

const { status, data } = await apiInstance.findPetsByStatus(
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: The findPetsByStatus example redeclares status in the same scope (let status then const { status, data } = ...), which is a SyntaxError in TypeScript/JavaScript and makes the example invalid.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/client/petstore/typescript-axios/builds/with-erasable-syntax/docs/PetApi.md, line 138:

<comment>The `findPetsByStatus` example redeclares `status` in the same scope (`let status` then `const { status, data } = ...`), which is a SyntaxError in TypeScript/JavaScript and makes the example invalid.</comment>

<file context>
@@ -0,0 +1,441 @@
+
+let status: Array<'available' | 'pending' | 'sold'>; //Status values that need to be considered for filter (default to undefined)
+
+const { status, data } = await apiInstance.findPetsByStatus(
+    status
+);
</file context>
Fix with Cubic

|Name | Type | Description | Notes|
|------------- | ------------- | ------------- | -------------|
| **body** | **User**| Updated user object | |
| **username** | [**string**] | name that need to be deleted | defaults to undefined|
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3: updateUser documentation describes the username as needing to be deleted, which is misleading for an update operation and appears to be copied from deleteUser.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/client/petstore/typescript-axios/builds/with-erasable-syntax/docs/UserApi.md, line 400:

<comment>updateUser documentation describes the username as needing to be deleted, which is misleading for an update operation and appears to be copied from deleteUser.</comment>

<file context>
@@ -0,0 +1,424 @@
+|Name | Type | Description  | Notes|
+|------------- | ------------- | ------------- | -------------|
+| **body** | **User**| Updated user object | |
+| **username** | [**string**] | name that need to be deleted | defaults to undefined|
+
+
</file context>
Fix with Cubic

import { User } from './api';

const instance: User = {
id,
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3: The example snippet uses shorthand properties (id, username, etc.) without declaring these variables, so the documentation sample is invalid TypeScript when copied.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/client/petstore/typescript-axios/builds/with-erasable-syntax/docs/User.md, line 24:

<comment>The example snippet uses shorthand properties (`id`, `username`, etc.) without declaring these variables, so the documentation sample is invalid TypeScript when copied.</comment>

<file context>
@@ -0,0 +1,35 @@
+import { User } from './api';
+
+const instance: User = {
+    id,
+    username,
+    firstName,
</file context>
Fix with Cubic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant