Skip to content

feat: generate fns instead of #[test]#78

Open
d2weber wants to merge 2 commits into
mainfrom
gen_fns
Open

feat: generate fns instead of #[test]#78
d2weber wants to merge 2 commits into
mainfrom
gen_fns

Conversation

@d2weber

@d2weber d2weber commented Jun 19, 2026

Copy link
Copy Markdown
Collaborator

Closes #77


Edit: Corresponding PR to use this in core: chatmail/core#8350

@d2weber d2weber marked this pull request as ready for review June 19, 2026 18:09
@@ -0,0 +1,82 @@
{

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Note for other reviewers: we have generated typescript files committed, so it is somewhat expected to commit generated files in this case too. If we decide to remove generated files, it should be in another PR. They are somewhat useful to spot the changes between versions of the generator.

Comment thread README.md Outdated
Now you can connect any JSON-RPC client to `ws://localhost:3000/rpc` and call the `shout` and `add` methods.

After running `cargo test` you will find an autogenerated TypeScript client in the `typescript/generated` folder and an `openrpc.json` file in the root fo your project.
After running `cargo test` you will find an autogenerated TypeScript client in the `typescript/generated` folder and an `openrpc.json` file in the root fo your project. (`cargo test` sets the current working directory to `CARGO_MANIFEST_DIR`.)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can as well fix the typo "fo" -> "of".

But i'm not sure what "cargo test sets the current working directory to CARGO_MANIFEST_DIR", seems like an "implementation detail" that is interesting when reviewing this PR to understand why explicit std::env::var("CARGO_MANIFEST_DIR") is removed, but not interesting for the readme reader who may not even know what CARGO_MANIFEST_DIR is.

Comment thread README.md
}

#[test]
fn write_files() {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Don't know how difficult it is to move this to build.rs (see discussion in #77), but likely better done in another PR.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Yes actually the point of this PR was to make use in build.rs possible, see the core PR chatmail/core#8350 I now linked in the description of this PR.

I thought in the readme it might be more concise keep using the #[test] approach but we can also describe the build.rs approach in the readme.

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.

Generating as #[test] causes rebuild

2 participants