5 releases

0.2.5 Aug 5, 2024
0.2.4 Aug 2, 2024
0.2.2 Aug 2, 2024
0.2.1 Aug 1, 2024
0.2.0 Aug 1, 2024

#258 in HTTP server

BSD-3-Clause

190KB
5K SLoC

Rust 4.5K SLoC // 0.0% comments Handlebars 682 SLoC

Argentum ToolKit. REST Generator.

REST Generator is a tools that creates API libraries from OpenAPI specification.

Supported generators

[cols="1,3,1"] |=== |Language | Type | Supported versions

|Rust |Server side API package |3.1 and 3

|===

Key features

  • Parsing instead of validation
  • Generated code compatible with Argentum REST
  • Clean and human-readable error responses
  • Low code duplication in generated code
  • Extendable and reusable generated code

How to install

Via cargo install

[source,shell]

cargo install argentum_rest_generator_app

.From source codes .Clone [source,shell]

git clone git@gitlab.com:argentum-toolkit/argentum.git

.Install binary [source,shell]

cargo install --path argentum_rest_generator_app/

How to use

.Generate REST API server library [source,shell]

argentum_rest_generator_app --input api-doc/openapi.yaml --output rest/ --package-name user_account_rest

Or you can generate via cargo run (sources should be cloned)

.Example [source,shell]

cd argentum/argentum_rest_generator_app

cargo run --   --input ../argentum_user_account/api-doc/openapi.yaml --output ../argentum_user_account/rest/ --package-name argentum_user_account_rest

Restrictions

  • supports only $ref params in case if OpenAPI objects supports $ref. (Doesn't support embedded objects in this case)
  • Schemas supports only Object type (Array, AnyOf, AllOf are not implemented yet)
  • we don't use OpenAPI tags. If you need similar functionality, we would like to recommend split your API to packages

Dependencies

~63MB
~1M SLoC