Skip to content

[http-specs] Add test cases for additional special words #7431

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

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented May 22, 2025

This PR adds test cases for a comprehensive set of additional special words to the http-specs package. These special words are important to test since they could potentially cause issues in code generation across different language targets.

The changes include:

  • Adding test cases for keywords like any, boolean, case, catch, const, etc.
  • Updated list of special words in the header comment of main.tsp
  • Added operations, parameters and model implementations for these special words
  • Added corresponding mock API implementations in mockapi.ts

These additions will help ensure that generators handling TypeSpec code properly escape reserved words in their target languages, especially for the TypeScript generators as referenced in Azure/autorest.typescript#3192.

The complete list of added special words:

any, boolean, case, catch, const, date, debugger, declare, default, delete, do, enum, error, 
export, extends, false, function, get, implements, instanceof, interface, let, module, new, 
null, number, of, package, private, protected, public, requestoptions, require, set, switch, 
static, super, this, string, symbol, throw, true, type, typeof, var, void, arguments, 
client, endpoint, apiVersion

Fixes #7420.

Warning

Firewall rules blocked me from connecting to one or more addresses

I tried to connect to the following addresses, but was blocked by firewall rules:

  • cdn.fwupd.org
    • Triggering command: /usr/bin/fwupdmgr refresh (dns block)
  • crl3.digicert.com
    • Triggering command: dotnet build --configuration Release -p:Version=1.0.0 -clp:NoSummary (dns block)
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js (dns block)
  • crl4.digicert.com
    • Triggering command: dotnet build --configuration Release -p:Version=1.0.0 -clp:NoSummary (dns block)
  • ocsp.digicert.com
    • Triggering command: dotnet build --configuration Release -p:Version=1.0.0 -clp:NoSummary (dns block)
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js (dns block)
  • s.symcb.com
    • Triggering command: dotnet build --configuration Release -p:Version=1.0.0 -clp:NoSummary (dns block)
  • s.symcd.com
    • Triggering command: dotnet build --configuration Release -p:Version=1.0.0 -clp:NoSummary (dns block)
  • ts-crl.ws.symantec.com
    • Triggering command: dotnet build --configuration Release -p:Version=1.0.0 -clp:NoSummary (dns block)
  • ts-ocsp.ws.symantec.com
    • Triggering command: dotnet build --configuration Release -p:Version=1.0.0 -clp:NoSummary (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@microsoft-github-policy-service microsoft-github-policy-service bot added compiler:core Issues for @typespec/compiler compiler:emitter-framework Issues for the emitter framework ide Issues for VS, VSCode, Monaco, etc. lib:http lib:openapi lib:rest lib:versioning lib:http-specs For issues/prs related to the @typespec/http-specs package meta:blog Blog updates meta:website TypeSpec.io updates tspd Issues for the tspd tool emitter:client:all General issue for client emitters emitter:client:js Issue for the JS client emitter: @typespec/http-client-js emitter:client:csharp Issue for the C# client emitter: @typespec/http-client-csharp emitter:client:java Issue for the Java client emitter: @typespec/http-client-java emitter:client:python Issue for the Python client emitter: @typespec/http-client-python emitter:graphql Issues for @typespec/graphql emitter emitter:json-schema emitter:protobuf The protobuf emitter emitter:openapi3 Issues for @typespec/openapi3 emitter labels May 22, 2025
@timotheeguerin timotheeguerin removed meta:blog Blog updates tspd Issues for the tspd tool compiler:core Issues for @typespec/compiler compiler:emitter-framework Issues for the emitter framework emitter:service:csharp emitter:service:js lib:versioning lib:http lib:openapi lib:rest emitter:openapi3 Issues for @typespec/openapi3 emitter openapi3:converter Issues for @typespec/openapi3 openapi to typespec converter ui:playground ui:type-graph-viewer emitter:client:java Issue for the Java client emitter: @typespec/http-client-java emitter:client:python Issue for the Python client emitter: @typespec/http-client-python emitter:service:java Issue for Java service emitter emitter:graphql Issues for @typespec/graphql emitter spector Issues related to spector and the spec sets lib:http-specs For issues/prs related to the @typespec/http-specs package emitter:client:all General issue for client emitters emitter:client:js Issue for the JS client emitter: @typespec/http-client-js labels May 23, 2025
@MaryGao MaryGao added lib:http-specs For issues/prs related to the @typespec/http-specs package and removed emitter:client:csharp Issue for the C# client emitter: @typespec/http-client-csharp labels May 26, 2025
@MaryGao
Copy link
Member

MaryGao commented May 26, 2025

@copilot Could you fix the build issue?

@opNameScenario("get") get(): void;
@opNameScenario("implements") `implements`(): void;
@opNameScenario("instanceof") `instanceof`(): void;
@opNameScenario("interface") `interface`(): void;
Copy link
Member

Choose a reason for hiding this comment

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

Fix the ci failure for pnpm validate-scenarios.

Copy link
Contributor Author

Copilot AI commented May 26, 2025

@copilot Could you fix the build issue?

I've fixed the build issue by properly marking 'declare' as a reserved keyword. TypeSpec requires reserved keywords to be wrapped in backticks. I've updated all instances of 'declare' in the code (operations, parameters, model names, and model references). The validation now passes successfully. (d6983ab)

Warning

Firewall rules blocked me from connecting to one or more addresses

I tried to connect to the following addresses, but was blocked by firewall rules:

  • crl3.digicert.com
  • crl4.digicert.com
  • ocsp.digicert.com
  • s.symcb.com
  • s.symcd.com
  • ts-crl.ws.symantec.com
  • ts-ocsp.ws.symantec.com

If you need me to access, download, or install something from one of these locations, you can either:

Copilot finished work on behalf of MaryGao May 26, 2025 09:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lib:http-specs For issues/prs related to the @typespec/http-specs package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[http-spec] Add test cases for additional special words
3 participants