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

Rewrite generator not to use swagger-parser #4

Open
1 of 11 tasks
AmateurECE opened this issue Mar 11, 2024 · 3 comments
Open
1 of 11 tasks

Rewrite generator not to use swagger-parser #4

AmateurECE opened this issue Mar 11, 2024 · 3 comments
Assignees

Comments

@AmateurECE
Copy link
Owner

AmateurECE commented Mar 11, 2024

This dependency has proved itself to be problematic, so the generator implementation should be relieved of it. I'm thinking that it would be easiest for the consumers of this project if this rewrite took the form of a pure-Rust solution, however, I'm not yet convinced either way.

This could also open the door to improving the build system in this repository--currently, the generator is built using maven, and the whole thing is glued together with a Makefile. Perhaps there's an opportunity to generate the redfish-codegen crate using something like Bazel.

In the coming months, I'll try out a couple of solutions and begin work on this, and I'll try to keep this issue updated with progress.

A full Rust rewrite needs the following:

  • Primitive elements (e.g. case conversion) rewritten with unit testing.
    • text package
    • registry package
    • specification package
  • ModelMap implementation to map OpenAPI URIs to Rust paths. This should take the form of a Repository instead of the complicated to- and from- translational logic that exists today.
  • A primitive Rust expression builder to replace the existing Handebars template rendering scheme, which has only gotten increasingly complicated as time went on.
  • Build system improvements--the existing Makefile fails to be correct in surprising circumstances, is not hermetic, and relies on certain cargo keys to be set for the generated crates in order to allow uploading to crates.io. An improved system would generate a .crate file from the OpenAPI documents that can be uploaded independently to crates.io.
  • Model generation backend
  • Route generation backend for axum (that ideally can be extended to support additional frameworks in the future)
  • Registry generation backend
  • Generated crates contain the contents of existing, separate crates today. For example, the generated model crate under the new scheme would contain the contents of redfish-core.
@AmateurECE
Copy link
Owner Author

Building with Bazel might be possible leveraging the work described in bazelbuild/rules_rust#458.

@AmateurECE AmateurECE self-assigned this Mar 18, 2024
@AmateurECE
Copy link
Owner Author

The text package has been rewritten on the rust-generator branch.

@AmateurECE
Copy link
Owner Author

The resolution for this issue should also include a resolution for not just #3, but also #5, #6, #7, & #8, or at least lend itself easily to a resolution for these issues in any case.

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