-
Notifications
You must be signed in to change notification settings - Fork 164
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
[WIP] Merge JavaScript Server Generator to Main #3231
base: main
Are you sure you want to change the base?
[WIP] Merge JavaScript Server Generator to Main #3231
Conversation
❌ There is undocummented changes. Run The following packages have changes but are not documented.
Show changes |
You can try these changes at https://cadlplayground.z22.web.core.windows.net/prs/3231/ Check the website changes at https://tspwebsitepr.z22.web.core.windows.net/prs/3231/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make sure to update the tsconfig.ws.json so pnpm watch
build this too
…d a few bugs in output processing.
const argumentType = type.indexer.value; | ||
|
||
if (requiresJsonSerialization(ctx, argumentType)) { | ||
return `${expr}.map((item) => ${transposeExpressionToJson(ctx, argumentType, "item", module)})`; |
Check warning
Code scanning / CodeQL
Improper code sanitization Medium
improperly sanitized value
Code construction depends on an
improperly sanitized value
return `Object.fromEntries(Object.entries(${expr}).map(([key, value]) => [String(key), ${transposeExpressionToJson( | ||
ctx, | ||
argumentType, | ||
"value", | ||
module | ||
)}]))`; |
Check warning
Code scanning / CodeQL
Improper code sanitization Medium
improperly sanitized value
Code construction depends on an
improperly sanitized value
const argumentType = type.indexer.value; | ||
|
||
if (requiresJsonSerialization(ctx, argumentType)) { | ||
return `${expr}.map((item) => ${transposeExpressionFromJson(ctx, argumentType, "item", module)})`; |
Check warning
Code scanning / CodeQL
Improper code sanitization Medium
improperly sanitized value
Code construction depends on an
improperly sanitized value
return `Object.fromEntries(Object.entries(${expr}).map(([key, value]) => [key, ${transposeExpressionFromJson( | ||
ctx, | ||
argumentType, | ||
"value", | ||
module | ||
)}]))`; |
Check warning
Code scanning / CodeQL
Improper code sanitization Medium
improperly sanitized value
Code construction depends on an
This work-in-progress PR tracks merging the JavaScript server code generator to the TypeSpec repository.
The JavaScript server code generator creates HTTP bindings for TypeSpec HTTP services and exposes them for binding either to the Node.js http server directly, or to an Express.js app as middleware.
This is a large PR with some issues to be worked out before it can be merged:
http-server-javascript
, but this emitter is just capable of emitting an HTTP server. It can also emit TypeScript models alone, and HTTP is enabled as an optional feature of the emitter.Closes #3215