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(api-gen): allow multiple json overrides for schema #1566

Merged
merged 8 commits into from
Jan 16, 2025

Conversation

patzick
Copy link
Collaborator

@patzick patzick commented Jan 7, 2025

Description

closes #1446

Type of change

Adds the possibility of multiple json overrides for schema

Copy link

vercel bot commented Jan 7, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
frontends-demo 🔄 Building (Inspect) Visit Preview Jan 16, 2025 9:58am
1 Skipped Deployment
Name Status Preview Updated (UTC)
shopware-frontends-docs ⬜️ Skipped (Inspect) Jan 16, 2025 9:58am

Copy link

pkg-pr-new bot commented Jan 7, 2025

Open in Stackblitz

@shopware/api-client

npm i https://pkg.pr.new/shopware/frontends/@shopware/api-client@1566

@shopware/api-gen

npm i https://pkg.pr.new/shopware/frontends/@shopware/api-gen@1566

@shopware-pwa/cms-base

npm i https://pkg.pr.new/shopware/frontends/@shopware-pwa/cms-base@1566

@shopware-pwa/composables-next

npm i https://pkg.pr.new/shopware/frontends/@shopware-pwa/composables-next@1566

@shopware-pwa/helpers-next

npm i https://pkg.pr.new/shopware/frontends/@shopware-pwa/helpers-next@1566

@shopware-pwa/nuxt3-module

npm i https://pkg.pr.new/shopware/frontends/@shopware-pwa/nuxt3-module@1566

commit: f640595

Copy link

codspeed-hq bot commented Jan 7, 2025

CodSpeed Performance Report

Merging #1566 will degrade performances by 38.47%

Comparing feat/multiple-patch-files (f640595) with main (87610c0)

🎉 Hooray! codspeed-node just leveled up to 4.0.0!

A heads-up, this is a breaking change and it might affect your current performance baseline a bit. But here's the exciting part - it's packed with new, cool features and promises improved result stability 🥳!
Curious about what's new? Visit our releases page to delve into all the awesome details about this new version.

Summary

⚡ 2 improvements
❌ 6 (👁 6) regressions
✅ 1 untouched benchmarks

Benchmarks breakdown

Benchmark main feat/multiple-patch-files Change
👁 [api-client][createAPIClient] - creating client 121.2 µs 196.9 µs -38.47%
👁 [api-client][createAdminAPIClient] - creating client 153.2 µs 210 µs -27.05%
👁 [api-client][transformPathToQuery] - transform with body params 66.6 µs 97.8 µs -31.86%
👁 [api-client][transformPathToQuery] - transform with header params 80.7 µs 92 µs -12.32%
[api-client][transformPathToQuery] - transform with path params 387.9 µs 89.1 µs ×4.4
👁 [api-client][transformPathToQuery] - transform with path,query,body,header params 83.1 µs 120.9 µs -31.28%
👁 [api-client][transformPathToQuery] - transform with query params 65.8 µs 97.7 µs -32.6%
[api-client][transformPathToQuery] - transform without any params 133.4 µs 85.2 µs +56.64%

Copy link
Collaborator

@mkucmus mkucmus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, this is what we've been waiting for <3
Only some debug stuff to be removed.

I've found also some unexpected behavior, but I don't think it refers to this PR:

  • when there is no ${apiType}Schema.json and I run the generate command, the CLI generates identical two files: storeApiSchema.d.ts and storeApiTypes.d.ts (the only difference is Shopware API version: unknown js doc for the last one. - reproduction https://stackblitz.com/edit/71b6o4og?file=api-types%2FstoreApiTypes.d.ts
  • when there is no ${apiType}Schema.json the CLI doesn't produce any debug info for generate command - I guess it's intended and having the file is required to proceed with the debug stuff and the whole merginc logic?

packages/api-gen/src/commands/generate.ts Outdated Show resolved Hide resolved
packages/api-gen/src/commands/generate.ts Outdated Show resolved Hide resolved
packages/api-gen/src/commands/generate.ts Show resolved Hide resolved
@vercel vercel bot temporarily deployed to Preview – shopware-frontends-docs January 16, 2025 09:35 Inactive
Copy link
Collaborator

@mkucmus mkucmus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🥇

@vercel vercel bot temporarily deployed to Preview – shopware-frontends-docs January 16, 2025 09:58 Inactive
@patzick
Copy link
Collaborator Author

patzick commented Jan 16, 2025

@mkucmus thanks for the review!

when there is no ${apiType}Schema.json and I run the generate command, the CLI generates identical two files: storeApiSchema.d.ts and storeApiTypes.d.ts (the only difference is Shopware API version: unknown js doc for the last one. - reproduction https://stackblitz.com/edit/71b6o4og?file=api-types%2FstoreApiTypes.d.ts

I'll put this to separate issue (#1591 ), by default it's taking existing schema file but then the version is harder to extract from TS file instead of json, I'll switch to pick json by default

when there is no ${apiType}Schema.json the CLI doesn't produce any debug info for generate command - I guess it's intended and having the file is required to proceed with the debug stuff and the whole merginc logic?

I added additional logs indicating when file is created because of --debug flag

@patzick patzick merged commit 541cd6e into main Jan 16, 2025
12 checks passed
@patzick patzick deleted the feat/multiple-patch-files branch January 16, 2025 10:22
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.

[FEATURE] allow multiple json overrides
2 participants