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

Use re-export of serde_json in macros #540

Closed
Sufflope opened this issue Sep 18, 2024 · 0 comments · Fixed by #541
Closed

Use re-export of serde_json in macros #540

Sufflope opened this issue Sep 18, 2024 · 0 comments · Fixed by #541

Comments

@Sufflope
Copy link
Contributor

The v2 macros generate code that directly uses the crate serde_json. The problem is that the user code might not have this crate as a dependency.

So, they might get confusing errors (about a missing serde_json crate when there is no instance of serde_json string in their project), and in order for the generated code to compile, they have to add it as a dependency which may be picked up as "unused" by linting tools.

From what I gathered writing some proc-macro crates, the good practice is to depend yourself on the crate, re-export the symbols you need and reference it from your own namespace.

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 a pull request may close this issue.

1 participant