Skip to content

Rewrite generator not to use swagger-parser #4

@AmateurECE

Description

@AmateurECE

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.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions