Packages
Taxi projects & configuration
Taxi projects and files
A Taxi project contains a taxi.conf file, and a collection of files saved with a .taxi. extension.
A typical project might look like this:
.
├── src/
│ └── sample.taxi
├── tests/
│ └── hello-world/
│ ├── hello-world.spec.json
│ ├── input.csv
│ └── expected-output.json
└── taxi.confTaxi files are simple text files, saved with a .taxi extension.
The taxi.conf file
A taxi.conf file describes a project’s layout, and the plugins to be invoked after compilation. It follows the HOCON format, which is like supercharged JSON.
name: taxi/maven-sample
version: 0.3.0
sourceRoot: src/
plugins: {
taxi/kotlin: {
maven: {
groupId: "lang.taxi"
artifactId: "parent"
repositories: [
{
id: "internal-repo"
url: "https://newcorp.nexus.com"
snapshots: true
}
]
}
}
}
The source for the config can be seen here, which provides the complete documentation of how projects can be configured.
| Name | Definition |
|---|---|
| name | The name of the taxi project. By convention, follows a format of organisation/project-name |
| version | The version of the taxi project |
| sourceRoot | The root location of taxi files to be compiled |
| output | The folder where any generated artifacts will be written |
| plugins | A list of plugins to be enabled on the project |
| pluginSettings | Defines where plugins are fetched and loaded from |
| dependencies | A list of other taxi project dependencies that this project depends on |
| repositories | A list of taxi repositories to fetch content from |
| publishToRepository | Defines where this project should be published to, should other projects wish to depend on it |
| credentials | Tokens for publishing to a taxihub |
Dependencies
Projects may declare dependencies on other taxi projects. This provides a powerful mechanism for creating modular, re-usable taxonomies across organisations.
The format for declaring dependencies is:
dependencies: {
// Fetch from a taxihub listed in repositories
"org/ProjectName" : 0.2.0
// Fetch from a github repository, at a specific branch / tag
"com.orbitalhq/core" : "github:orbitalapi/orbital-core-taxi#0.34.0"
// Fetch from a gitlab repository (at https://gitlab.com) on the default branch
"org.test/dependencyA" : "gitlab:taxi-lang/test-project-a"
// Fetch from a different git provider
"org.test/dependencyB" : "https://someGitProvider.com/taxi-lang/test-project-a.git"
// Fetch from a subdirectory within a git repository (useful for monorepos)
// taxi.conf is expected at taxi/schema/taxi.conf relative to the repo root
"com.example/schemas" : "github:example/monorepo#0.34.0:taxi/schema"
}For details on sharing, publishing and depending on taxonomies, see Publishing Taxi projects
Repositories
Repositories are where the Taxi CLI downloads dependencies from. A repository is a taxihub.
Dependencies from git (like github: dependencies) don’t need a repository.
The Taxi CLI tries each repository in turn, until it finds the dependency.
Declare repositories in your taxi.conf file like this:
repositories: [
{
// The name of the repository. Optional. It's used to find credentials.
name: "taxihub",
// The address of the taxihub
url: "https://hub.example.com",
// Optional. taxihub is the only type, and the default.
type: "taxihub"
}
]A repository of any other type can’t be read. A dependency looked for there fails, naming the repository and its type.
For more on sharing projects, see Publishing Taxi projects.
Credentials
Credentials hold the token used to publish to a taxihub.
The repositoryName attribute must match the name attribute of publishToRepository.
credentials: [
{ repositoryName: "taxihub", token: "thp_…" }
]
Credentials don’t need to be defined in your project’s main taxi.conf - in fact, we recommend you don’t.
Instead, define them in ~/.taxi/taxi.conf (in your home directory). See below for
more detail on merging configuration files. The TAXIHUB_TOKEN environment variable can be used instead.
Each entry needs a token. Older versions of Taxi used a username and password here, which are no longer read.
See Publishing to a taxihub.
Linter config
Per-project linting rules can be specified in the taxi.conf, to disable or alter the severity of individual linter rules.
The format of the section is as follows:
linter: {
// The name of the linter rule.
no-duplicate-types-on-models: {
// Severity - optional - can be INFO | WARN | ERROR.
// Defaults to WARN
// Note that setting to ERROR will cause builds to fail if the rule is violated
severity: INFO
// enabled - optional - defaults to true
enabled: true
}
no-primitive-types-on-models: {enabled: false}
}Note that the entire linter section is optional. If omitted, all rules are enabled, with the severity defined by each rule. (By convention, this is WARN).
Merging multiple configuration files
By default, Taxi tooling will merge configuration files from the following locations:
- The root of the project -
./taxi.conf - The home directory -
~/.taxi/taxi.conf
This allows for storing of sensitive information - such as credentials - outside of main projects, and source control.