-
Notifications
You must be signed in to change notification settings - Fork 329
fix(openapi3): use escaped string literals in object values to prevent triple-quote syntax errors #9236
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…t triple-quote issues Co-authored-by: baywet <[email protected]>
Co-authored-by: baywet <[email protected]>
Co-authored-by: baywet <[email protected]>
Copilot
AI
changed the title
[WIP] Fix JSON interpretation issue in string property
fix(openapi3): use escaped string literals in object values to prevent triple-quote syntax errors
Dec 18, 2025
baywet
approved these changes
Dec 18, 2025
commit: |
Signed-off-by: Vincent Biret <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
Contributor
|
All changed packages have been documented.
Show changes
|
markcowl
approved these changes
Dec 29, 2025
github-merge-queue bot
pushed a commit
that referenced
this pull request
Dec 30, 2025
#9236 and #9228 introduced regressions where some syntax could end up being escaped twice, causing compilation issues after import This is an attempt to definitively fix all the escaping issues, not letting copilot drive... --------- Signed-off-by: Vincent Biret <[email protected]> Co-authored-by: Mark Cowlishaw <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Extension properties containing multi-line strings (e.g., JSON examples with embedded triple-quotes) were converted using TypeSpec's triple-quoted string format, causing syntax errors when the content itself contained
""".Changes
escapedStringLiteral()function incommon.tsthat always uses single-line format with proper escaping of newlines, quotes, backslashes, and template literal syntaxnormalizeObjectValueToTSValueExpression()indecorators.tsto use escaped literals for all string values in object literals instead of auto-selecting triple-quoted formatExample
Given an OpenAPI extension with JSON content containing Python docstrings:
Before: Invalid syntax with nested triple-quotes
After: Valid escaped string literal
example: "{\n \"source\": \"\"\"\ndef grade():\n \"\"\"Returns 1.0\"\"\"\n return 1.0\n\"\"\",\n}\n"Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
telemetry.astro.build/usr/local/bin/node node /home/REDACTED/work/typespec/typespec/website/node_modules/.bin/../astro/astro.js build sh nts/�� ebsite/src/content/docs/docs/emitters/openapi3/reference node /.bin/sh -p . ents/reference node js lmstxt --output-dir ../../websit--output-dir node(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.