You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to make a tool to auto-generate the javascript FFI for elm (what you have in @tauri/api but for elm), including custom Commands. Having a way to get those types would be also beneficial for doing the same for other languages (rescript, purescript) and even for typescript (so you don't have to keep the api up to date by hand).
Describe the solution you'd like
A tool to extract all the Commands (names and types) in an easy processable format (maybe jsonschema, protobuf declaration or similar) so they can be used for automatic clientside code generation.
Alternatives considered
Writing the ports (thats how elm calls javascript FFI) by hand is possible but tedious.
Parsing the API library and generating the Ports from that, the downside is not having the custom commands included.that's
leiserfg
changed the title
[feat] Is there a way to get the signature of all the commands that can be invoked at comptime?
[feat] Is there a way to get the signature of all the commands that can be invoked?
Feb 24, 2023
I'd count this as a duplicate of #1514. The title may not suggest that but the discussion broadened/generalized a bit and especially the tauri-bindgen and tauri-specta projects mentioned there go in the direction you're asking for.
There is also a potentially interesting discussion in #3256.
With #3256 we can theoretically generate a signature type for each command (one that tracks parameters, returns and async-ness) but I don't see what benefit that would bring in the context of tauri-core (I had thought in the past that maybe we could inject generating javascript bindings straight from Rust, but that idea isn't too useful either bc of lacking typescript support) so I think projects like what fabian mentioned are more equipped to help here and this is not something tauri core should concern itself with.
Btw your problem description sounds exactly like what I started tauri-bindgen for. Feel free to create an issue over there and we can discuss adding codegen support for elm 👍🏻
Describe the problem
I want to make a tool to auto-generate the javascript FFI for elm (what you have in @tauri/api but for elm), including custom Commands. Having a way to get those types would be also beneficial for doing the same for other languages (rescript, purescript) and even for typescript (so you don't have to keep the api up to date by hand).
Describe the solution you'd like
A tool to extract all the Commands (names and types) in an easy processable format (maybe jsonschema, protobuf declaration or similar) so they can be used for automatic clientside code generation.
Alternatives considered
Additional context
Maybe https://docs.rs/schemars/latest/schemars/ could bring some inspiration.
The text was updated successfully, but these errors were encountered: