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

Feature request: export to string rather than file #57

Open
kran6a opened this issue Oct 27, 2024 · 0 comments
Open

Feature request: export to string rather than file #57

kran6a opened this issue Oct 27, 2024 · 0 comments

Comments

@kran6a
Copy link

kran6a commented Oct 27, 2024

Use case

I have a rust RPC server in which endpoints in files like /src/entity/subentity/action.rs.
I would like to build a type that includes all my RPC endpoints like the following:

type API = {
    user: {
        create: ...;
        delete: ...;
        update: ...;
    },
    post: {
        create: ...;
        update: ...;
        delete: ...;
    }
}

While it can be done with the current API by generating a ts file for each rs file I would like to be able to work in-memory so I don't have to generate ts files, read ts files, build the API type, write the final ts file then cleanup all files but API.ts.

Proposed solution

Either a function like generate_typescript_defs that returns a string or making the generate_typescript_defs return a string so that passing /dev/null as the output parameter results in no actual write to disk and the file content being returned.

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

1 participant