Skip to content

Splitting Zitadel-rust project in sub crates#592

Closed
fcenedes wants to merge 17 commits intosmartive:mainfrom
fcenedes:main
Closed

Splitting Zitadel-rust project in sub crates#592
fcenedes wants to merge 17 commits intosmartive:mainfrom
fcenedes:main

Conversation

@fcenedes
Copy link
Copy Markdown
Contributor

@fcenedes fcenedes commented Feb 5, 2025

Hi there,

Major Changes, Possible Break
This PR is a first attempt to split the zitadel-rust crate into 3 crates :

  • zitadel-rust : Workspace
  • crates/zitadel : Helpers crate around Zitadel API, basically the former crate we all loved.
  • crates/zitadel-gen : Build and generates GRPC stufs from zitadel as Rust Structs and Tonic clients
  • crates/zitadel-examples: Various samples on how to use the zitadel crate

the zitadel-gen could be renamed zitadel-sys or whatever, but it should basicaly hold the same version as the zitadel version where the proto files are extracted.
The zitadel:: is properly re-exported, so if should have no impacts on downstream users

Minor Changes :
zitadel crate :

  • Another little addition, is an helper method to introspect a JWT token locally instead of calling the instrospect endpoint against a Zitadel instance. Note this only work with 3 legs JWT tokens, not opaque one.
  • Another modification is the ability to support arbitrary custom claims, letting the user of this crate to make his own impl
  • One axum deps has been yanked, so the Cargo.toml just reflect that.

the CI/CD needs probably be reviewed and fixed to be aligned if this PR is accepted

Don't be shy, if i wrote crappy code, just let me know :-)

@fcenedes
Copy link
Copy Markdown
Contributor Author

fcenedes commented Feb 5, 2025

well i realise i dont pass some linting. Wonder if i should revert back to buf instead of trying to do it myself :-)

i will amend this pr. Buf actually solve a couple of problems.

Sorry

@buehler
Copy link
Copy Markdown
Collaborator

buehler commented Feb 7, 2025

Will look into it on the weekend ;)
Splitting the code seems to be a good idea.

and yeah, buf has its perks ;) I learned that the hard way as well.

@buehler
Copy link
Copy Markdown
Collaborator

buehler commented Feb 7, 2025

One question that comes to mind: why use a third crate for examples? As far as I know in Rust people show examples inside the crate. Those are not compiled when the crate is downloaded right?

@fcenedes
Copy link
Copy Markdown
Contributor Author

fcenedes commented Feb 7, 2025

no particular reason, i will move them back into the zitadel crate.
EDIT : now i remember, i took inspiration from https://github.com/apache/datafusion/tree/main/datafusion-examples
probably to have them isolated from the main crate..but anyway :)

@fcenedes
Copy link
Copy Markdown
Contributor Author

you will have to exclude cargo clippy for the generated Tonic code.

@fcenedes
Copy link
Copy Markdown
Contributor Author

Heya,

As you've merged #593 that already have the crates being splitted. we can close this one.
i will propose another PR to distinguish publishing the gen crate (if this is what we want) from the wrapper crate.
I will also push for some documentation to guide new comers to this crate.

@fcenedes fcenedes closed this Mar 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants