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

feat!: app.parameters #5915

Merged
merged 20 commits into from
Mar 25, 2024
Merged

feat!: app.parameters #5915

merged 20 commits into from
Mar 25, 2024

Conversation

hasanaburayyan
Copy link
Contributor

@hasanaburayyan hasanaburayyan commented Mar 12, 2024

Summary

BREAKING CHANGE: app.platformParameters has been changed to app.parameters

This PR now allows Wing authors to access the application's parameters through app.parameters for example:

let parameters = nodeof(this).app.parameters;

This also means that now wing structs can easily be added to platform parameters through the use of parameters.addSchema(Struct.schema()) as well structs can be read from the parameter list through Struct.fromJson(parameters.read())

Checklist

  • Title matches Winglang's style guide
  • Description explains motivation and solution
  • 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.

@hasanaburayyan hasanaburayyan requested a review from a team as a code owner March 12, 2024 15:03
Copy link

Thanks for opening this pull request! 🎉
Please consult the contributing guidelines for details on how to contribute to this project.
If you need any assistence, don't hesitate to ping the relevant owner over Slack.

Topic Owner
Wing SDK and utility APIs @chriscbr
Wing Console @ainvoner, @skyrpex, @polamoros
JSON, structs, primitives and collections @hasanaburayyan
Platforms and plugins @hasanaburayyan
Frontend resources (website, react, etc) @tsuf239
Language design @eladb
VSCode extension and language server @markmcculloh
Compiler architecture, inflights, lifting @yoav-steinberg
Wing Testing Framework @tsuf239
Wing CLI @markmcculloh
Build system, dev environment, releases @markmcculloh
Library Ecosystem @chriscbr
Documentation @hasanaburayyan
SDK test suite @tsuf239
Examples @hasanaburayyan
Wing Playground @eladcon

@monadabot
Copy link
Contributor

monadabot commented Mar 12, 2024

Console preview environment is available at https://wing-console-pr-5915.fly.dev 🚀

Last Updated (UTC) 2024-03-22 15:45

@monadabot
Copy link
Contributor

monadabot commented Mar 12, 2024

Benchmarks

Comparison to Baseline ⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜🟥🟥
Benchmark Before After Change
version 59ms±0.65 59ms±0.63 +1ms (+1.09%)⬜
empty.test.w -t sim 528ms±34.91 491ms±3.01 -37ms (-6.95%)⬜
empty.test.w -t tf-aws 706ms±5.31 709ms±5.54 +3ms (+0.46%)⬜
hello_world.test.w -t sim 515ms±4.65 530ms±9.7 +16ms (+3.06%)⬜
hello_world.test.w -t tf-aws 1652ms±6.67 1673ms±15.9 +21ms (+1.25%)⬜
functions_10.test.w -t sim 614ms±8.37 616ms±9.3 +2ms (+0.39%)⬜
functions_10.test.w -t tf-aws 2250ms±7.83 2251ms±13.29 +1ms (+0.04%)⬜
jsii_small.test.w -t sim 497ms±2.47 495ms±7.61 -1ms (-0.29%)⬜
jsii_small.test.w -t tf-aws 721ms±4.25 718ms±5.94 -3ms (-0.44%)⬜
jsii_big.test.w -t sim 2908ms±14.73 2914ms±7.16 +6ms (+0.21%)⬜
jsii_big.test.w -t tf-aws 3109ms±10.17 3119ms±15.89 +10ms (+0.33%)⬜
functions_1.test.w -t sim 516ms±6.69 537ms±6.71 +21ms (+4.07%)🟥
functions_1.test.w -t tf-aws 942ms±5.62 957ms±3.77 +15ms (+1.54%)🟥

⬜ Within 1.5 standard deviations
🟩 Faster, Above 1.5 standard deviations
🟥 Slower, Above 1.5 standard deviations

Benchmarks may vary outside of normal expectations, especially when running in GitHub Actions CI.

Results
name mean min max moe sd
version 59ms 58ms 61ms 1ms 1ms
empty.test.w -t sim 491ms 486ms 500ms 3ms 4ms
empty.test.w -t tf-aws 709ms 694ms 720ms 6ms 8ms
hello_world.test.w -t sim 530ms 516ms 556ms 10ms 14ms
hello_world.test.w -t tf-aws 1673ms 1641ms 1715ms 16ms 22ms
functions_10.test.w -t sim 616ms 597ms 638ms 9ms 13ms
functions_10.test.w -t tf-aws 2251ms 2214ms 2284ms 13ms 19ms
jsii_small.test.w -t sim 495ms 477ms 511ms 8ms 11ms
jsii_small.test.w -t tf-aws 718ms 707ms 734ms 6ms 8ms
jsii_big.test.w -t sim 2914ms 2897ms 2930ms 7ms 10ms
jsii_big.test.w -t tf-aws 3119ms 3096ms 3167ms 16ms 22ms
functions_1.test.w -t sim 537ms 524ms 557ms 7ms 9ms
functions_1.test.w -t tf-aws 957ms 950ms 967ms 4ms 5ms
Last Updated (UTC) 2024-03-22 15:50

@monadabot monadabot added the ⚠️ pr/review-mutation PR has been mutated and will not auto-merge. Clear this label if the changes look good! label Mar 12, 2024
@hasanaburayyan hasanaburayyan removed the ⚠️ pr/review-mutation PR has been mutated and will not auto-merge. Clear this label if the changes look good! label Mar 12, 2024
examples/tests/invalid/parameters.test.w Outdated Show resolved Hide resolved
examples/tests/invalid/parameters.test.w Outdated Show resolved Hide resolved
@monadabot monadabot added the ⚠️ pr/review-mutation PR has been mutated and will not auto-merge. Clear this label if the changes look good! label Mar 12, 2024
@hasanaburayyan
Copy link
Contributor Author

hasanaburayyan commented Mar 13, 2024

I think I could actually get Struct.fromParameters() to work without to much effort

struct AppParams {
  someMessage: str;
  someNumber: num;
}

let app = nodeof(this).app;

app.parameters.addSchema(AppParams.schema());
let appParams = AppParams.fromParameters(app.parameters);

log(appParams.someMessage);

Update: I added fromParameters

@eladb eladb changed the title feat: expose parameter registrar on IApp feat: expose parameter registrar on app Mar 13, 2024
@eladb eladb changed the title feat: expose parameter registrar on app feat: app.parameters Mar 13, 2024
tools/hangar/src/paths.ts Outdated Show resolved Hide resolved
libs/wingsdk/src/platform/parameter-registrar.ts Outdated Show resolved Hide resolved
docs/docs/04-standard-library/std/json.md Outdated Show resolved Hide resolved
libs/wingsdk/src/core/app.ts Show resolved Hide resolved
libs/wingsdk/src/platform/parameter-registrar.ts Outdated Show resolved Hide resolved
libs/wingsdk/src/platform/parameter-registrar.ts Outdated Show resolved Hide resolved
libs/wingsdk/src/std/json_schema.ts Outdated Show resolved Hide resolved
@hasanaburayyan hasanaburayyan changed the title feat: app.parameters feat!: app.parameters Mar 14, 2024
@hasanaburayyan hasanaburayyan added 🚧 pr/do-not-merge PRs with this label will not be automatically merged by mergify. and removed ⚠️ pr/review-mutation PR has been mutated and will not auto-merge. Clear this label if the changes look good! labels Mar 14, 2024
@monadabot monadabot added the ⚠️ pr/review-mutation PR has been mutated and will not auto-merge. Clear this label if the changes look good! label Mar 22, 2024
@hasanaburayyan hasanaburayyan removed 🚧 pr/do-not-merge PRs with this label will not be automatically merged by mergify. ⚠️ pr/review-mutation PR has been mutated and will not auto-merge. Clear this label if the changes look good! labels Mar 25, 2024
Copy link
Contributor

mergify bot commented Mar 25, 2024

Thanks for contributing, @hasanaburayyan! This PR will now be added to the merge queue, or immediately merged if hasan/platform-parameters-in-wing is up-to-date with main and the queue is empty.

mergify bot added a commit that referenced this pull request Mar 25, 2024
@mergify mergify bot merged commit effc7ac into main Mar 25, 2024
16 checks passed
@mergify mergify bot deleted the hasan/platform-parameters-in-wing branch March 25, 2024 16:46
@monadabot
Copy link
Contributor

Congrats! 🚀 This was released in Wing 0.64.0.

eladb pushed a commit that referenced this pull request Mar 25, 2024
## Summary
BREAKING CHANGE: `app.platformParameters` has been changed to `app.parameters`

This PR now allows Wing authors to access the application's parameters through `app.parameters` for example:
```js
let parameters = nodeof(this).app.parameters;
```
This also means that now wing structs can easily be added to platform parameters through the use of `parameters.addSchema(Struct.schema())` as well structs can be read from the parameter list through `Struct.fromJson(parameters.read())`


## 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)*.
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.

4 participants