#yaml-config #open-api #generator #generate #found #api-client #experimental

app thanix

A yaml-to-rust code generator for generating Rust code from yaml config files e.g. as found in openAPI.

6 releases

0.1.0 Jan 17, 2024
0.1.0-beta.1 Feb 26, 2024
0.1.0-alpha.9 Jan 24, 2024
0.1.0-alpha.7 Jan 22, 2024
0.1.0-alpha.4 Jan 19, 2024

#136 in Database interfaces

Download history 8/week @ 2024-01-12 223/week @ 2024-02-23 51/week @ 2024-03-01 9/week @ 2024-03-08 2/week @ 2024-03-15 37/week @ 2024-03-29 70/week @ 2024-04-05

109 downloads per month

GPL-3.0 license

30KB
425 lines

████████╗██╗  ██╗ █████╗ ███╗   ██╗██╗██╗  ██╗
╚══██╔══╝██║  ██║██╔══██╗████╗  ██║██║╚██╗██╔╝
   ██║   ███████║███████║██╔██╗ ██║██║ ╚███╔╝
   ██║   ██╔══██║██╔══██║██║╚██╗██║██║ ██╔██╗
   ██║   ██║  ██║██║  ██║██║ ╚████║██║██╔╝ ██╗
   ╚═╝   ╚═╝  ╚═╝╚═╝  ╚═╝╚═╝  ╚═══╝╚═╝╚═╝  ╚═╝

Welcome to Thanix!

Thanix is an experimental cli application written in Rust for generating Rust code from yaml schema files like they are found as openAPI schemas.

build result

Installation

Be aware that Thanix currently is only developed on and for Linux distributions.
Support for other operating systems may be available in the future, but currently though it is not guaranteed to work.

Building from source

Building from source provides you with the most recent updates and changes to Thanix. However, be aware that these may be unstable, so downloading a tagged release is advised.

Also, make sure you have the Rust programming language and Cargo installed.

To build Thanix from source you need to follow these steps:

  1. Download the source code. To do so, run this command in your Terminal:
git clone git@github.com:The-Nazara-Project/Thanix.git

This will create a new directory called Thanix, move into it.

  1. Run the application directly

You can now run Thanix using the cargo run command. However, this process may take longer and may feel less comfortable.

Do not forget to pass the required CLI parameters to Thanix when doing this.

cargo run -- --input-file $PATH_TO_YOUR_YAML

This may look like this:

cargo run -- --input-file ./api_config.yaml

This step will result in your thanix_client being generated.

To view the next steps please scroll down to the Usage section.

Optional:

  1. Install Thanix using cargo install.

You can also install the crate on your system, so you always have it available. To do so, run this command while in the Thanix project directory:

cargo install --path .

This will install Thanix onto your system and it can be executed by simply running thanix in your terminal.

Install Thanix using Cargo

Thanix is also published on crates.io.

To install it simply run:

cargo install thanix

Install Cargo as a distribution package (TBA)

We are working on building packages for a variety of Linux distributions starting with openSUSE Tumbleweed.

You can install Thanix for openSUSE Tumbleweed using these steps:

  1. Add Repository
sudo zypper ar https://download.opensuse.org/repositories/home:/ByteOtter:/nazara-project/openSUSE_Tumbleweed/home:ByteOtter:nazara-project.repo
8m
  1. Refresh Repositories
sudo zypper ref
  1. Install Thanix
sudo zypper install Thanix

Zypper should now install Thanix for you.

NOTE: The repository location is temporary and will be changed once Thanix is out of beta. If you do not wish to deal with this, we suggest you install Thanix using one of the methods listed above. Thank you for understanding.

Usage

After you have installed Thanix in a way you see fit, you use it by passing it two mandatory parameters like this:

thanix --input-file $YOUR_API_YAML
  • The --input-file parameter is a path to your .yaml-file you want to use as an input. This is usually the API schema file your want to generate a client for.

Dependencies

~5MB
~94K SLoC