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: Add zod schemas for app metadata living in config.json #14952

Closed

Conversation

smk1993
Copy link
Contributor

@smk1993 smk1993 commented May 9, 2024

What does this PR do?

provides type check using "AppMeta" type on existing config.json files .
Fixed imports on dependent files

Mandatory Tasks (DO NOT REMOVE)

  • I have self-reviewed the code (A decent size PR without self-review might be rejected)
  • I have added a Docs issue here if this PR makes changes that would require a documentation change
  • I have added or modified automated tests that prove my fix is effective or that my feature works (PRs might be rejected if logical changes are not properly tested)

How should this be tested?

  • Are there environment variables that should be set?
  • What are the minimal test data to have?
  • What is expected (happy path) to have (input and output)?
  • Any other important info that could help to test that PR

Checklist

Copy link

vercel bot commented May 9, 2024

@smk1993 is attempting to deploy a commit to the cal Team on Vercel.

A member of the Team first needs to authorize it.

@graphite-app graphite-app bot added the community Created by Linear-GitHub Sync label May 9, 2024
@graphite-app graphite-app bot requested review from a team May 9, 2024 07:01
Copy link
Contributor

github-actions bot commented May 9, 2024

Thank you for following the naming conventions! 🙏 Feel free to join our discord and post your PR link.

@github-actions github-actions bot added Low priority Created by Linear-GitHub Sync ⚡ Quick Wins A collection of quick wins/quick fixes that are less than 30 minutes of work ✅ good first issue Good for newcomers ✨ feature New feature or request labels May 9, 2024
@dosubot dosubot bot added the app-store area: app store, apps, calendar integrations, google calendar, outlook, lark, apple calendar label May 9, 2024
@smk1993 smk1993 changed the title #14808 Add zod schemas for app metadata living in config.json feat: Add zod schemas for app metadata living in config.json May 9, 2024
Copy link

graphite-app bot commented May 9, 2024

Graphite Automations

"Add community label" took an action on this PR • (05/09/24)

1 label was added to this PR based on Keith Williams's automation.

"Add foundation team as reviewer" took an action on this PR • (05/09/24)

1 reviewer was added to this PR based on Keith Williams's automation.

"Add consumer team as reviewer" took an action on this PR • (05/09/24)

1 reviewer was added to this PR based on Keith Williams's automation.

Copy link
Contributor

github-actions bot commented May 9, 2024

📦 Next.js Bundle Analysis for @calcom/web

This analysis was generated by the Next.js Bundle Analysis action. 🤖

Seventy-nine Pages Changed Size

The following pages changed size from the code in this PR compared to its base branch:

Page Size (compressed) First Load % of Budget (350 KB)
/[user]/[type] 410.94 KB 639.35 KB 182.67% (🟢 -0.33%)
/[user]/[type]/embed 410.94 KB 639.36 KB 182.67% (🟢 -0.33%)
/apps 276.7 KB 505.11 KB 144.32% (🟢 -0.57%)
/apps/[slug] 294.41 KB 522.83 KB 149.38% (🟢 -0.51%)
/apps/[slug]/[...pages] 585.5 KB 813.92 KB 232.55% (🟢 -0.42%)
/apps/categories 254.66 KB 483.08 KB 138.02% (🟢 -0.50%)
/apps/categories/[category] 258.98 KB 487.4 KB 139.26% (🟢 -0.51%)
/apps/installed/[category] 278.19 KB 506.61 KB 144.74% (🟢 -0.50%)
/availability 462.63 KB 691.05 KB 197.44% (🟢 -0.60%)
/availability/[schedule] 409.02 KB 637.44 KB 182.13% (🟢 -0.60%)
/booking/[uid] 225.52 KB 453.94 KB 129.70% (🟢 -0.19%)
/booking/[uid]/embed 225.53 KB 453.94 KB 129.70% (🟢 -0.19%)
/bookings/[status] 322.44 KB 550.86 KB 157.39% (🟢 -0.51%)
/d/[link]/[slug] 410.75 KB 639.17 KB 182.62% (🟢 -0.34%)
/enterprise 254.72 KB 483.14 KB 138.04% (🟢 -0.50%)
/event-types 554.69 KB 783.11 KB 223.75% (🟢 -0.43%)
/event-types/[type] 433.73 KB 662.15 KB 189.19% (🟢 -0.55%)
/getting-started/[[...step]] 404.04 KB 632.46 KB 180.70% (🟢 -0.15%)
/insights 473.14 KB 701.56 KB 200.44% (🟢 -0.64%)
/more 254.23 KB 482.65 KB 137.90% (🟢 -0.50%)
/org/[orgSlug]/[user]/[type] 411.14 KB 639.56 KB 182.73% (🟢 -0.33%)
/org/[orgSlug]/[user]/[type]/embed 411.16 KB 639.58 KB 182.74% (🟢 -0.34%)
/org/[orgSlug]/instant-meeting/team/[slug]/[type] 410.76 KB 639.18 KB 182.62% (🟢 -0.33%)
/org/[orgSlug]/team/[slug]/[type] 410.96 KB 639.38 KB 182.68% (🟢 -0.34%)
/settings/admin 260.32 KB 488.74 KB 139.64% (🟢 -0.50%)
/settings/admin/apps 273.4 KB 501.82 KB 143.38% (🟢 -0.52%)
/settings/admin/apps/[category] 273.38 KB 501.8 KB 143.37% (🟢 -0.51%)
/settings/admin/flags 264.43 KB 492.85 KB 140.81% (🟢 -0.50%)
/settings/admin/impersonation 260.68 KB 489.1 KB 139.74% (🟢 -0.53%)
/settings/admin/oAuth 272.48 KB 500.9 KB 143.11% (🟢 -0.50%)
/settings/admin/oAuth/oAuthView 94.12 KB 322.54 KB 92.15% (🟢 -0.24%)
/settings/admin/orgMigrations/_OrgMigrationLayout 248.69 KB 477.11 KB 136.32% (🟢 -0.55%)
/settings/admin/orgMigrations/moveTeamToOrg 298.33 KB 526.75 KB 150.50% (🟢 -0.52%)
/settings/admin/orgMigrations/moveUserToOrg 317.59 KB 546 KB 156.00% (🟢 -0.56%)
/settings/admin/orgMigrations/removeTeamFromOrg 298.08 KB 526.5 KB 150.43% (🟢 -0.52%)
/settings/admin/orgMigrations/removeUserFromOrg 298.09 KB 526.51 KB 150.43% (🟢 -0.52%)
/settings/admin/organizations 261.88 KB 490.3 KB 140.09% (🟢 -0.50%)
/settings/admin/organizations/[id]/edit 260.7 KB 489.12 KB 139.75% (🟢 -0.50%)
/settings/admin/users 262.57 KB 490.99 KB 140.28% (🟢 -0.50%)
/settings/admin/users/[id]/edit 391.18 KB 619.6 KB 177.03% (🟢 -0.52%)
/settings/admin/users/add 390.92 KB 619.34 KB 176.95% (🟢 -0.51%)
/settings/billing 260.42 KB 488.84 KB 139.67% (🟢 -0.50%)
/settings/developer/api-keys 264.47 KB 492.89 KB 140.83% (🟢 -0.51%)
/settings/developer/webhooks 264.55 KB 492.97 KB 140.85% (🟢 -0.51%)
/settings/developer/webhooks/[id] 265.57 KB 493.98 KB 141.14% (🟢 -0.50%)
/settings/developer/webhooks/new 265.56 KB 493.98 KB 141.14% (🟢 -0.50%)
/settings/my-account/appearance 313.22 KB 541.64 KB 154.76% (🟢 -0.52%)
/settings/my-account/calendars 270.96 KB 499.38 KB 142.68% (🟢 -0.51%)
/settings/my-account/conferencing 272.26 KB 500.68 KB 143.05% (🟢 -0.50%)
/settings/my-account/out-of-office 265.07 KB 493.49 KB 141.00% (🟢 -0.51%)
/settings/my-account/profile 403.96 KB 632.38 KB 180.68% (🟢 -0.44%)
/settings/organizations/appearance 284.34 KB 512.76 KB 146.50% (🟢 -0.51%)
/settings/organizations/billing 260.5 KB 488.92 KB 139.69% (🟢 -0.50%)
/settings/organizations/dsync 330.1 KB 558.52 KB 159.58% (🟢 -0.39%)
/settings/organizations/general 347.99 KB 576.41 KB 164.69% (🟢 -0.56%)
/settings/organizations/members 428.74 KB 657.15 KB 187.76% (🟢 -0.52%)
/settings/organizations/platform/oauth-clients 262.99 KB 491.41 KB 140.40% (🟢 -0.50%)
/settings/organizations/platform/oauth-clients/create 263.14 KB 491.55 KB 140.44% (🟢 -0.51%)
/settings/organizations/privacy 265.89 KB 494.31 KB 141.23% (🟢 -0.56%)
/settings/organizations/profile 396.49 KB 624.91 KB 178.55% (🟢 -0.50%)
/settings/organizations/sso 271.24 KB 499.66 KB 142.76% (🟢 -0.48%)
/settings/organizations/teams/other 261.07 KB 489.49 KB 139.86% (🟢 -0.51%)
/settings/organizations/teams/other/[id]/appearance 273.22 KB 501.64 KB 143.33% (🟢 -0.50%)
/settings/organizations/teams/other/[id]/members 268.05 KB 496.46 KB 141.85% (🟢 -0.54%)
/settings/organizations/teams/other/[id]/profile 467.31 KB 695.73 KB 198.78% (🟢 -0.38%)
/settings/security/impersonation 265.33 KB 493.74 KB 141.07% (🟢 -0.50%)
/settings/security/password 302.83 KB 531.25 KB 151.79% (🟢 -0.52%)
/settings/security/sso 270.49 KB 498.91 KB 142.55% (🟢 -0.51%)
/settings/security/two-factor-auth 268.75 KB 497.17 KB 142.05% (🟢 -0.50%)
/settings/teams 259.99 KB 488.41 KB 139.54% (🟢 -0.50%)
/settings/teams/[id]/appearance 273.21 KB 501.62 KB 143.32% (🟢 -0.50%)
/settings/teams/[id]/billing 260.5 KB 488.92 KB 139.69% (🟢 -0.50%)
/settings/teams/[id]/profile 468.14 KB 696.56 KB 199.02% (🟢 -0.38%)
/team/[slug]/[type] 410.92 KB 639.34 KB 182.67% (🟢 -0.34%)
/team/[slug]/[type]/embed 410.96 KB 639.38 KB 182.68% (🟢 -0.34%)
/teams 254.45 KB 482.87 KB 137.96% (🟢 -0.50%)
/upgrade 254.58 KB 482.99 KB 138.00% (🟢 -0.50%)
/workflows 285.8 KB 514.21 KB 146.92% (🟢 -0.54%)
/workflows/[workflow] 408.16 KB 636.58 KB 181.88% (🟢 -0.55%)
Details

Only the gzipped size is provided here based on an expert tip.

First Load is the size of the global bundle plus the bundle for the individual page. If a user were to show up to your website and land on a given page, the first load size represents the amount of javascript that user would need to download. If next/link is used, subsequent page loads would only need to download that page's bundle (the number in the "Size" column), since the global bundle has already been downloaded.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

The "Budget %" column shows what percentage of your performance budget the First Load total takes up. For example, if your budget was 100kb, and a given page's first load size was 10kb, it would be 10% of your budget. You can also see how much this has increased or decreased compared to the base branch of your PR. If this percentage has increased by 20% or more, there will be a red status indicator applied, indicating that special attention should be given to this. If you see "+/- <0.01%" it means that there was a change in bundle size, but it is a trivial enough amount that it can be ignored.

@hariombalhara
Copy link
Member

hariombalhara commented May 9, 2024

Hey @smk1993, thanks for the huge PR 🙏

But I think we should keep the config.json files as they are auto-generated through AppStore CLI and instead just parse config.json through a zod schema. That way config is still typed when we import it

It is easier to generate JSON files as compared to a .ts/.js file and automate it's modification through AppStore CLI.

Also, as zod parsing happens at run time and there are many many apps which could be a possible slow down. I was thinking that maybe we parse the config.json at compile time somehow. We want to ensure that people don't enter invalid, non-existent props in config.json.

@smk1993 smk1993 closed this May 9, 2024
@smk1993
Copy link
Contributor Author

smk1993 commented May 9, 2024

Thanks @hariombalhara for your feedback , I could try to wrap the config.json imports with a Zod schema , I will raise a sample PR for this , I will do it for all config files once its fine .
zod takes most of the time in the parse method , however there is a huge improvement in parsing from version 3.5 . In case of slowdown zod can be upgraded to version 3.5.
colinhacks/zod#205
Let me know your thoughts on this.
Thanks

@dosubot dosubot bot added this to the v4.2 milestone May 15, 2024
@dosubot dosubot bot modified the milestones: v4.2, v4.4 Jun 17, 2024
@dosubot dosubot bot modified the milestones: v4.4, v4.5 Jul 17, 2024
@dosubot dosubot bot modified the milestones: v4.5, v4.6 Sep 15, 2024
@dosubot dosubot bot modified the milestone: v4.6 Sep 15, 2024
@keithwillcode keithwillcode modified the milestones: v4.6, v4.5 Sep 15, 2024
@dosubot dosubot bot modified the milestones: v4.5, Community Only Sep 24, 2024
@dosubot dosubot bot removed this from the Community Only milestone Nov 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
app-store area: app store, apps, calendar integrations, google calendar, outlook, lark, apple calendar community Created by Linear-GitHub Sync ✨ feature New feature or request ✅ good first issue Good for newcomers Low priority Created by Linear-GitHub Sync ⚡ Quick Wins A collection of quick wins/quick fixes that are less than 30 minutes of work
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[CAL-3584] Add zod schemas for app metadata living in config.json
3 participants