🦀 OpenAPI code generation 🐷

Related tags

Command-line pig
Overview

Pig

🦀 OpenAPI code generation 🐷

Install

cargo install --git [email protected]:truchi/pig.git --locked

Usage

🦀 OpenAPI code generation 🐷

Usage: pig [OPTIONS] [CONFIG]

Arguments:
 [CONFIG]  Path of the `pig.yaml` file (leave empty to search upwards from the current directory)

Options:
 -w, --watch    Watch mode
 -h, --help     Print help
 -V, --version  Print version

Config

Pig uses a pig.yaml configuration file:

# This entry tells `pig` to load `./openapi.yaml`
# as the context for `./templates/**/*.jinja`
# and render that into the `./output` directory:
- api: "openapi.yaml"
  in: "templates"
  out: "output"

# You can have as many entries as you want:
- api: "openapi.yaml"
  in: "templates"
  out: "../other/output"

OpenAPI

Pig supports OpenAPI v3.0.x.

References are resolved into the referenced object, adding:

  • $ref: the $ref string (file path resolved), e.g. /path/to/file.yaml#/path/to/Object
  • $file: the file path part of the $ref, e.g. /path/to/file.yaml
  • $keys: the key part of the $ref as an array, e.g. ["path", "to", "Object"]
  • $name: the last key of the $ref, e.g. Object

Pig detects circular references.

Templates

Pig uses Tera as its template engine.

Two extra files are written to the output directory: .pig.context.json and .pig.context.yaml. Those contain the context given to templates, i.e. the OpenAPI specification.

You might also like...
⭐ Advent of Code 2020: Мade with Rust

Advent of Code 2020: Мade with Rust When I was solving puzzles, my goal was to practice writing idiomatic Rust. My solutions do not claim to be the fa

Count your code by tokens, types of syntax tree nodes, and patterns in the syntax tree. A tokei/scc/cloc alternative.

tcount (pronounced "tee-count") Count your code by tokens, types of syntax tree nodes, and patterns in the syntax tree. Quick Start Simply run tcount

Warp is a blazingly fast, Rust-based terminal that makes you and your team more productive at running, debugging, and deploying code and infrastructure.
Warp is a blazingly fast, Rust-based terminal that makes you and your team more productive at running, debugging, and deploying code and infrastructure.

Warp is a blazingly fast, Rust-based terminal that makes you and your team more productive at running, debugging, and deploying code and infrastructure.

A CLI for analyzing the programming languages and how much code written in a project.
A CLI for analyzing the programming languages and how much code written in a project.

projlyzer A CLI for analyzing the programming languages and how much code written in a project. New features are on the way... Example Screenshot Buil

Source code for our paper
Source code for our paper "Higher-order finite elements for embedded simulation"

Higher-order Finite Elements for Embedded Simulation This repository contains the source code used to produce the results for our paper: Longva, A., L

Multi-Architecture Code Emission Library

macel Multi-Architecture Code Emission Library (macel) is a library which implements a low-level intermediate representation meant to expose on machin

Unwrap Macros to help Clean up code and improve production.

unwrap_helpers Unwrap Macros to help Clean up code and improve production. This does include a pub use of https://github.com/Mrp1Dev/loop_unwrap to ga

Code examples for https://www.poor.dev/blog/terminal-anatomy/

This repository contains examples from the Anatomy of a Terminal Emulator blog post. Each folder contains a separate example and can be run separately

Verified Rust for low-level systems code

See Goals for a brief description of the project's goals. Building the project The main project source is in source. tools contains scripts for settin

Chemical structure generation for protein sequences as SMILES string.

proteinogenic Chemical structure generation for protein sequences as SMILES string. ?? Usage This crate builds on top of purr, a crate providing primi

Martin Larralde 4 Aug 4, 2022
Next-generation, type-safe CLI parser for Rust

Next-generation, type-safe CLI parser for Rust

0918nobita 19 Jul 20, 2022
EVA ICS v4 is a new-generation Industrial-IoT platform for Industry-4.0 automated control systems.

EVA ICS v4 EVA ICS® v4 is a new-generation Industrial-IoT platform for Industry-4.0 automated control systems. The world-first and only Enterprise aut

EVA ICS 25 Feb 1, 2023
Tooling and library for generation, validation and verification of supply chain metadata documents and frameworks

Spector Spector is both tooling and a library for the generation, validation and verification of supply chain metadata documents and frameworks. Many

Kusari 13 May 4, 2023
languagetool-code-comments integrates the LanguageTool API to parse, spell check, and correct the grammar of your code comments!

languagetool-code-comments integrates the LanguageTool API to parse, spell check, and correct the grammar of your code comments! Overview Install MacO

Dustin Blackman 17 Dec 25, 2022
ChatGPT-Code-Review is a Rust application that uses the OpenAI GPT-3.5 language model to review code

ChatGPT-Code-Review is a Rust application that uses the OpenAI GPT-3.5 language model to review code. It accepts a local path to a folder containing code, and generates a review for each file in the folder and its subdirectories.

Greg P. 15 Apr 22, 2023
Code-shape is a tool for extracting definitions from source code files

Code-shape Code-shape is a tool that uses Tree-sitter to extract a shape of code definitions from a source code file. The tool uses the same language

Andrew Hlynskyi 3 Apr 21, 2023
rehype plugin to use tree-sitter to highlight code in pre code blocks

rehype-tree-sitter rehype plugin to use tree-sitter to highlight code in <pre><code> blocks Contents What is this? When should I use this? Install Use

null 5 Jul 25, 2023
📜🔁🎶 A CLI which converts morse code into sound

morse2sound ?? A CLI which converts morse code to sound Big shoutout to Br1ght0ne for guiding me how to use Rust on stream

Ilya Revenko 15 Dec 4, 2022
Tokei is a program that displays statistics about your code.

Tokei is a program that displays statistics about your code. Tokei will show the number of files, total lines within those files and code, comments, and blanks grouped by language.

null 7.5k Jan 1, 2023