This project contains a Taskfile collection for different purposes to avoid redundancies in each project.
!!! note
In order to use remote tasks, since it is still an [experimental feature](https://taskfile.dev/experiments/remote-taskfiles/), please remind to set the `TASK_X_REMOTE_TASKFILES` environment variable:
export TASK_X_REMOTE_TASKFILES=1
The npm.yaml file contains a single task that installs a package, if not present already, via the npm CLI, i.e.:
version: 3
includes:
npm_utils: https://raw.githubusercontent.com/Terradue/taskfile-utils/refs/heads/main/npm.yaml
tasks:
generate_docs:
desc: Given an input OpenAPI YAML document, creates Redocly human-readable documentation.
deps:
- task: npm_utils:conditional_install
vars:
PACKAGE: '@redocly/cli'
cmds:
- redocly build-docs {{.API}} --output={{.OUTPUT}}The pip.yaml file contains a single task that installs a package, if not present already, via the pip CLI, i.e.:
version: 3
includes:
pip_utils: https://raw.githubusercontent.com/Terradue/taskfile-utils/refs/heads/main/pip.yaml
tasks:
generate_skeleton:
desc: Given an input OpenAPI YAML document, creates FastAPI server skeleton with Pydantic v2 models.
deps:
- task: pip_utils:conditional_install
vars:
PACKAGE: fastapi-code-generator
cmds:
- fastapi-codegen --input {{.API}} --output {{.OUTPUT}} --output-model-type pydantic_v2.BaseModel
The asyncapi.yaml file contains tasks to generate contents, given an AsyncAPI document:
Allow invoke the AsyncAPI Generator command (it will be installed, if not present), with arbitrary parameters:
API: the reference to the AsyncAPI document, typically a YAML document;TEMPLATE: the AsyncAPI Generator template, i.e.@asyncapi/[email protected], see the related documentation;OUTPUT: the reference to the directory where the AsyncAPI Generator produces the output file(s);AUX_PARAMETER: any auxiliary AsyncAPI Generator parameter(s).
By wrapping the previous command, generates an HTML human-readable document, with arbitrary parameters:
API: the reference to the AsyncAPI document, typically a YAML document;OUTPUT: the reference to the directory where the AsyncAPI Generator produces the output file(s).
Given an input OpenAPI YAML document, generates Pydantic v2 models, with arbitrary parameters:
API: the reference to the AsyncAPI document, typically a YAML document;OUTPUT: the reference to the directory where the AsyncAPI Generator produces the output file(s).
The java.yaml file contains tasks to execute a simple Java jar file, by hiding the artifact download from the Maven Central Repository:
Download, if not present in the local M2 repo already, and executes an arbitrary artifact identified by the canonical GAV coordinates in the format of <groupId>:<artifactId>[:<type>[:<classifier>]]:<version>, with arbitrary parameters:
GAV: the artifact coordinates, i.e.net.sourceforge.plantuml:plantuml-mit:1.2025.3;OPTIONS: the Java CLI options, i.e.-svg -q -pipe.
Optional parameters below are also supported:
MAVEN_REPO: the Maven Central Repository URL,https://repo1.maven.org/maven2by default;LOCAL_M2_REPO: the local File System path where artifacts will be stored,$HOME/.m2/repositoryby default.
The json.yaml file contains tasks to generate contents, given a JSON Schema document:
Given a JSON Schema, generates the related Pydantic v2 models (with field aliases), with arbitrary parameters:
SCHEMA: the reference to a JSON Schema file (it can be expressed as a YAML file).OUTPUT: the reference to the directory where the AsyncAPI Generator produces the output file(s).
Optional parameters below are also supported:
BASE_CLASS: the Pydantic v2 base class,pydantic.BaseModelby default.
Executes a strict JSON Schema check of an instance file against an input schema, with arbitrary parameters:
SCHEMA: the reference to a JSON Schema file (it can be expressed as a YAML file).INSTANCE: the reference to the instance file that can needs to be checked against the input schema.
The openapi.yaml file contains tasks to generate contents, given an OpenAPI document:
Generates an HTML Redocly human-readable document, with arbitrary parameters:
API: the reference to the OpenAPI document, typically a YAML document;OUTPUT: the reference to the the output file where documentation will be produced.
Given an input OpenAPI document, generates a FastAPI server skeleton with Pydantic v2 models, with arbitrary parameters:
API: the reference to the OpenAPI document, typically a YAML document;OUTPUT: the reference to the directory where the the output file(s) will be produced.