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

fix: goctl api tsgen #4726

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

wwwfeng
Copy link

@wwwfeng wwwfeng commented Mar 21, 2025

#4717
Fix: Resolve the issue where the goctl api ts command fails to generate correct TypeScript code when field names contain hyphens.
Before:
image
After:
image

@kevwan kevwan requested a review from Copilot March 24, 2025 16:29
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request fixes an issue where the goctl api ts command fails to generate correct TypeScript code when field names contain hyphens.

  • Detects hyphens in field names
  • Wraps field names with hyphens in single quotes to ensure valid TypeScript output
Comments suppressed due to low confidence (1)

tools/goctl/api/tsgen/util.go:37

  • Ensure that wrapping field names in single quotes satisfies TypeScript requirements. If TypeScript expects keys to always use double quotes or requires additional escaping, consider updating the quoting accordingly.
if strings.Contains(name, "-") {

Copy link

codecov bot commented Mar 24, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.58%. Comparing base (8690859) to head (9ee2dc0).
Report is 289 commits behind head on master.

Additional details and impacted files

see 14 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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