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

question: getting doc comments from BorshSchema #324

Open
dzmitry-lahoda opened this issue Dec 22, 2024 · 2 comments
Open

question: getting doc comments from BorshSchema #324

dzmitry-lahoda opened this issue Dec 22, 2024 · 2 comments

Comments

@dzmitry-lahoda
Copy link
Contributor

I am writing generator from BorshSchema.

Unfortunately it does not capture doc comments (as it seems).

Is it viable to add such capture to schema?

@dj8yfo
Copy link
Collaborator

dj8yfo commented Dec 22, 2024

@dzmitry-lahoda can you elaborate an example of how you see them captured?

I've seen an example where doc comments needed to be propagated from derive macro input to doc comments in derive macro output, but it happened elsewhere, and i don't instantly understand how you or somebody else could find them useful with regard to BorshSchema.

@dzmitry-lahoda
Copy link
Contributor Author

dzmitry-lahoda commented Dec 22, 2024

I have a executable binary crate . Binary references my types from other lib crate. I get borsh schema container for enum attributed with BorshSchema.
For all declaration-definitions I generate borsh-TS classes.

Cheap way to add TS client for borsh-rs BorshSchema with some documentation for users would be to get doc comments from BorshSchema.

Other approaches seems overkill for me now - write own macro(which will somehow integrated with borsh derive macros so that new macro will have some hash map of definitions as they generated by borsh to get docs) or run full rust parser.

Also I was thinking about using https://github.com/WebAssembly/component-model/blob/main/design/mvp/WIT.md vs BorshSchema as DSL for TS generation. WIT gives me access to doc comments, BorshSchema not.

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

No branches or pull requests

2 participants