wing icon indicating copy to clipboard operation
wing copied to clipboard

feat: jsify struct schema with docs

Open eladcon opened this issue 1 year ago • 4 comments

Emits struct docs and struct's fields docs into the generated JSON schema.

For example, this struct will emit the following schema:

/// AA is a struct
struct AA {
  /// XXX is a string
  xxx: str;
  yyy: num;
}
const AA = $stdlib.std.Struct._createJsonSchema({
      $id: "/AA",
      type: "object",
      description: "AA is a struct",
      properties: {
        "xxx": { 
           "type": "string" , 
           "description": "```wing\nxxx: str\n```\n---\n XXX is a string" ,
        },
        "yyy": { 
           "type": "number" , 
           "description": "```wing\nyyy: num\n```" ,
        },
      },
      required: [
        "xxx",
        "yyy",
      ]
    });

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.

eladcon avatar Jul 28 '24 19:07 eladcon

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

Topic Owner
Wing SDK and standard library @chriscbr
Wing Console @skyrpex
Wing compiler and language design @chriscbr
VSCode extension and language server @chriscbr
Wing CLI @chriscbr
Documentation @boyney123
Examples @boyney123
Wing Playground @skyrpex

github-actions[bot] avatar Jul 28 '24 19:07 github-actions[bot]

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

Last Updated (UTC) 2024-07-29 11:55

monadabot avatar Jul 28 '24 19:07 monadabot

Benchmarks

Comparison to Baseline ⬜🟥⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜
Benchmark Before After Change
version 58ms±0.7 57ms±0.5 -1ms (-1.53%)⬜
empty.test.w -t sim 374ms±6.61 390ms±24.24 +15ms (+4.09%)🟥
empty.test.w -t tf-aws 622ms±9.16 621ms±1.84 -1ms (-0.17%)⬜
hello_world.test.w -t sim 410ms±3.05 415ms±3.73 +5ms (+1.24%)⬜
hello_world.test.w -t tf-aws 1511ms±17.83 1511ms±10.79 +0ms (+0.01%)⬜
jsii_big.test.w -t sim 2970ms±11.76 2968ms±16.82 -2ms (-0.05%)⬜
jsii_big.test.w -t tf-aws 3178ms±8.99 3205ms±11.09 +28ms (+0.87%)⬜
functions_1.test.w -t sim 403ms±5.04 410ms±5.83 +7ms (+1.63%)⬜
functions_1.test.w -t tf-aws 857ms±4.96 869ms±6.18 +13ms (+1.47%)⬜
functions_10.test.w -t sim 507ms±8.18 496ms±15.4 -11ms (-2.15%)⬜
functions_10.test.w -t tf-aws 2189ms±15.91 2233ms±16.24 +44ms (+2.01%)⬜
jsii_small.test.w -t sim 376ms±3.57 381ms±5.81 +6ms (+1.51%)⬜
jsii_small.test.w -t tf-aws 619ms±4.28 632ms±3.57 +12ms (+2%)⬜

⬜ 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 57ms 56ms 58ms 1ms 1ms
empty.test.w -t sim 390ms 368ms 479ms 24ms 34ms
empty.test.w -t tf-aws 621ms 615ms 625ms 2ms 3ms
hello_world.test.w -t sim 415ms 409ms 424ms 4ms 5ms
hello_world.test.w -t tf-aws 1511ms 1486ms 1533ms 11ms 15ms
jsii_big.test.w -t sim 2968ms 2928ms 3000ms 17ms 24ms
jsii_big.test.w -t tf-aws 3205ms 3183ms 3232ms 11ms 16ms
functions_1.test.w -t sim 410ms 398ms 427ms 6ms 8ms
functions_1.test.w -t tf-aws 869ms 858ms 884ms 6ms 9ms
functions_10.test.w -t sim 496ms 458ms 517ms 15ms 22ms
functions_10.test.w -t tf-aws 2233ms 2205ms 2280ms 16ms 23ms
jsii_small.test.w -t sim 381ms 368ms 394ms 6ms 8ms
jsii_small.test.w -t tf-aws 632ms 624ms 642ms 4ms 5ms
Last Updated (UTC) 2024-07-29 11:23

monadabot avatar Jul 28 '24 19:07 monadabot

:x: Unstable Self-Mutation :x:

Self-mutation has run twice in a row. There may be a something non-deterministic in the build or test process. Check the last mutation commit (10ba616aebd41d2a32621f6eac93e832a965604b) for suspicious changes. This is typically caused by:

  • Absolute paths
  • Timestamps
  • Random values
  • Flakey tests (relying on one of the above)

monadabot avatar Jul 29 '24 11:07 monadabot

Hi,

This PR has not seen activity in 20 days. Therefore, we are marking the PR as stale for now. It will be closed after 7 days. If you need help with the PR, do not hesitate to reach out in the winglang community Discord. Feel free to re-open this PR when it is still relevant and ready to be worked on again. Thanks!

github-actions[bot] avatar Aug 19 '24 06:08 github-actions[bot]

Hi,

This PR has not seen activity in 20 days. Therefore, we are marking the PR as stale for now. It will be closed after 7 days. If you need help with the PR, do not hesitate to reach out in the winglang community Discord. Feel free to re-open this PR when it is still relevant and ready to be worked on again. Thanks!

github-actions[bot] avatar Sep 09 '24 06:09 github-actions[bot]