Skip to content

Commit

Permalink
fix(sdk): missing sourceModule info (#3968)
Browse files Browse the repository at this point in the history
Fixes a regression from #3884 - tree.json was no longer being emitted with `sourceModule` information, causing some issues in the Wing Console. Thanks @polamoros for catching this 🙏 

## Checklist

- [x] Title matches [Winglang's style guide](https://www.winglang.io/contributing/start-here/pull_requests#how-are-pull-request-titles-formatted)
- [x] Description explains motivation and solution
- [x] Tests added (always)
- [ ] Docs updated (only required for features)
- [ ] Added `pr/e2e-full` label if this feature requires end-to-end testing

*By submitting this pull request, I confirm that my contribution is made under the terms of the [Wing Cloud Contribution License](https://github.com/winglang/wing/blob/main/CONTRIBUTION_LICENSE.md)*.
  • Loading branch information
Chriscbr authored Aug 25, 2023
1 parent d4ae09d commit 554920d
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 0 deletions.
7 changes: 7 additions & 0 deletions libs/wingsdk/src/core/tree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@ export interface DisplayInfo {
* @default false (visible)
*/
readonly hidden?: boolean;

/**
* The source file or library where the construct was defined.
* @default - no source information
*/
readonly sourceModule?: string;
}

/**
Expand Down Expand Up @@ -159,6 +165,7 @@ function synthDisplay(construct: IConstruct): DisplayInfo | undefined {
title: display.title,
description: display.description,
hidden: display.hidden,
sourceModule: display.sourceModule,
};
}
return;
Expand Down
14 changes: 14 additions & 0 deletions libs/wingsdk/test/target-sim/__snapshots__/api.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ return class Handler {
},
"display": {
"description": "A cloud function (FaaS)",
"sourceModule": "@winglang/sdk",
"title": "get()",
},
"id": "OnRequestHandler-e645076f",
Expand Down Expand Up @@ -346,6 +347,7 @@ return class Handler {
},
"display": {
"description": "A cloud function (FaaS)",
"sourceModule": "@winglang/sdk",
"title": "get()",
},
"id": "OnRequestHandler-e645076f",
Expand Down Expand Up @@ -534,6 +536,7 @@ return class Handler {
},
"display": {
"description": "A cloud function (FaaS)",
"sourceModule": "@winglang/sdk",
"title": "get()",
},
"id": "OnRequestHandler-e645076f",
Expand Down Expand Up @@ -722,6 +725,7 @@ return class Handler {
},
"display": {
"description": "A cloud function (FaaS)",
"sourceModule": "@winglang/sdk",
"title": "get()",
},
"id": "OnRequestHandler-e645076f",
Expand Down Expand Up @@ -910,6 +914,7 @@ return class Handler {
},
"display": {
"description": "A cloud function (FaaS)",
"sourceModule": "@winglang/sdk",
"title": "get()",
},
"id": "OnRequestHandler-e645076f",
Expand Down Expand Up @@ -1230,6 +1235,7 @@ return class Handler {
},
"display": {
"description": "A cloud function (FaaS)",
"sourceModule": "@winglang/sdk",
"title": "get()",
},
"id": "OnRequestHandler-e645076f",
Expand Down Expand Up @@ -1416,6 +1422,7 @@ return class Handler {
},
"display": {
"description": "A cloud function (FaaS)",
"sourceModule": "@winglang/sdk",
"title": "get()",
},
"id": "OnRequestHandler-e645076f",
Expand Down Expand Up @@ -1692,6 +1699,7 @@ return class Handler {
},
"display": {
"description": "A cloud function (FaaS)",
"sourceModule": "@winglang/sdk",
"title": "get()",
},
"id": "OnRequestHandler-7c48a9f0",
Expand All @@ -1704,6 +1712,7 @@ return class Handler {
},
"display": {
"description": "A cloud function (FaaS)",
"sourceModule": "@winglang/sdk",
"title": "post()",
},
"id": "OnRequestHandler-f6d90a7f",
Expand Down Expand Up @@ -1982,6 +1991,7 @@ return class Handler {
},
"display": {
"description": "A cloud function (FaaS)",
"sourceModule": "@winglang/sdk",
"title": "get()",
},
"id": "OnRequestHandler-7c48a9f0",
Expand All @@ -1994,6 +2004,7 @@ return class Handler {
},
"display": {
"description": "A cloud function (FaaS)",
"sourceModule": "@winglang/sdk",
"title": "get()",
},
"id": "OnRequestHandler-f6d90a7f",
Expand Down Expand Up @@ -2182,6 +2193,7 @@ return class Handler {
},
"display": {
"description": "A cloud function (FaaS)",
"sourceModule": "@winglang/sdk",
"title": "get()",
},
"id": "OnRequestHandler-e645076f",
Expand Down Expand Up @@ -2379,6 +2391,7 @@ return class Handler {
},
"display": {
"description": "A cloud function (FaaS)",
"sourceModule": "@winglang/sdk",
"title": "get()",
},
"id": "OnRequestHandler-e645076f",
Expand Down Expand Up @@ -2567,6 +2580,7 @@ return class Handler {
},
"display": {
"description": "A cloud function (FaaS)",
"sourceModule": "@winglang/sdk",
"title": "post()",
},
"id": "OnRequestHandler-e645076f",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ bucket: (function(env) {
},
"display": {
"description": "A cloud function (FaaS)",
"sourceModule": "@winglang/sdk",
"title": "setConsumer()",
},
"id": "Queue-SetConsumer-401ee792",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ return class Handler {
},
"display": {
"description": "A cloud function (FaaS)",
"sourceModule": "@winglang/sdk",
"title": "Function",
},
"id": "Function",
Expand Down
6 changes: 6 additions & 0 deletions libs/wingsdk/test/target-sim/__snapshots__/queue.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ async handle(message) {
},
"display": {
"description": "A cloud function (FaaS)",
"sourceModule": "@winglang/sdk",
"title": "setConsumer()",
},
"id": "my_queue-SetConsumer-e645076f",
Expand Down Expand Up @@ -414,6 +415,7 @@ async handle(message) {
},
"display": {
"description": "A cloud function (FaaS)",
"sourceModule": "@winglang/sdk",
"title": "setConsumer()",
},
"id": "my_queue-SetConsumer-e645076f",
Expand Down Expand Up @@ -608,6 +610,7 @@ async handle(message) {
},
"display": {
"description": "A cloud function (FaaS)",
"sourceModule": "@winglang/sdk",
"title": "setConsumer()",
},
"id": "my_queue-SetConsumer-e645076f",
Expand Down Expand Up @@ -938,6 +941,7 @@ async handle(message) {
},
"display": {
"description": "A cloud function (FaaS)",
"sourceModule": "@winglang/sdk",
"title": "setConsumer()",
},
"id": "my_queue-SetConsumer-e645076f",
Expand Down Expand Up @@ -975,6 +979,7 @@ async handle(message) {
},
"display": {
"description": "A cloud function (FaaS)",
"sourceModule": "@winglang/sdk",
"title": "Function",
},
"id": "Function",
Expand Down Expand Up @@ -1156,6 +1161,7 @@ async handle(message) {
},
"display": {
"description": "A cloud function (FaaS)",
"sourceModule": "@winglang/sdk",
"title": "setConsumer()",
},
"id": "my_queue-SetConsumer-e645076f",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ console.log(\\"Hello from schedule!\\");
},
"display": {
"description": "A cloud function (FaaS)",
"sourceModule": "@winglang/sdk",
"title": "onTick()",
},
"id": "my_schedule-OnTick-e645076f",
Expand Down Expand Up @@ -358,6 +359,7 @@ console.log(\\"Hello from schedule!\\");
},
"display": {
"description": "A cloud function (FaaS)",
"sourceModule": "@winglang/sdk",
"title": "onTick()",
},
"id": "my_schedule-OnTick-e645076f",
Expand Down Expand Up @@ -529,6 +531,7 @@ console.log(\\"Hello from schedule!\\");
},
"display": {
"description": "A cloud function (FaaS)",
"sourceModule": "@winglang/sdk",
"title": "onTick()",
},
"id": "my_schedule-OnTick-e645076f",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ async handle(message) {
},
"display": {
"description": "A cloud function (FaaS)",
"sourceModule": "@winglang/sdk",
"title": "onStart()",
},
"id": "my_service-ServiceOnStartef2b13b9",
Expand Down

0 comments on commit 554920d

Please sign in to comment.