Licensing
The @spartaficial packages are commercial software: generating code requires a valid licence key, while building, testing and shipping the code you generated never does. This page tells you how to set the key up, what it covers, what still works without one, and what each licence error means.
Getting set up
Set one environment variable:
SPARTAFICIAL_LICENSE_KEY=<your key>
That is the only configuration. There is no config-file field and no CLI flag, deliberately, so a key cannot be committed to a repository by accident or overridden per invocation.
In CI, add it as a secret:
# GitHub Actions
- run: npx openapi-to-zod
env:
SPARTAFICIAL_LICENSE_KEY: ${{ secrets.SPARTAFICIAL_LICENSE_KEY }}
# Azure Pipelines
- script: npx openapi-to-zod
env:
SPARTAFICIAL_LICENSE_KEY: $(SPARTAFICIAL_LICENSE_KEY)
What the key is bound to
Each key names your organisation and an expiry date. One key covers every @spartaficial package in every project you own: set the same value wherever you run the generators, and you are done. You do not need a separate key per tool or per repository.
A key can optionally be restricted to a single project. Only then does it also carry that project's package.json name, and only then does it matter where you run the generator from: the project is resolved from the location of your codegen config file, not from the current working directory, so running the CLI from a monorepo root binds to the workspace the config lives in rather than the repo root.
Direct mode is the exception for restricted keys. openapi-to-k6 --input … --output … --output-types … has no config file to resolve from, so the project comes from the current directory: run it from the directory whose package.json your key names, or a perfectly valid restricted key reports PACKAGE_NAME_MISMATCH. When that happens the error says which directory was read, so the cause is visible rather than mysterious. There is deliberately no flag to override it. A key that is not restricted never reads package.json at all.
Using the generators from code
The programmatic API, new OpenApiGenerator(spec).generate() and its siblings, checks the licence the first time it extracts operations from a spec, reading SPARTAFICIAL_LICENSE_KEY from the environment at that moment. A restricted key is then compared against the package.json nearest to the current working directory, because there is no config file to resolve it from. Failures surface as a thrown LicenseVerificationError whose message is the same text the CLI prints and whose code is one of the codes below.
What still works without a key
A licence is required to generate. It is never required to build.
| Action | Needs a key |
|---|---|
openapi-to-zod, openapi-to-typescript, … (generation) | Yes |
--help, --version | No |
init (scaffold a config) | No |
| Compiling code that was already generated | No |
import ... from "@spartaficial/openapi-to-k6/runtime" | No |
playwright test against a generated client | No |
This is a hard guarantee, not an incidental one. If your licence lapses, your application keeps building and shipping from the code already in your repository; only re-running codegen fails. Generated files contain no licence logic of any kind.
Errors
Every failure exits non-zero, writes nothing, and names a code.
| Code | Meaning | Fix |
|---|---|---|
LICENSE_KEY_MISSING | SPARTAFICIAL_LICENSE_KEY is unset or empty | Set the variable |
INVALID_SIGNATURE | The key was altered or truncated | Re-copy it in full |
EXPIRED | Past the valid-to date | Renew |
NOT_YET_VALID | Before the valid-from date | Check the system clock |
PACKAGE_NAME_MISMATCH | The key is restricted to a different project; both are named | Run it in that project, or request a wider key |
PACKAGE_JSON_INVALID | The key is restricted, and no package.json with a name exists | Run from inside your project |
ISSUER_MISMATCH | Not issued by Spartaficial | Re-request the key |
INVALID_FORMAT | Not a license key at all | Re-copy it |
INVALID_HEADER | Header is corrupt or uses another algorithm | Re-copy it |
INVALID_PAYLOAD | Payload is corrupt, or carries a retired claim | Request a fresh key |
UNKNOWN_KEY_ID | Signed with a key this build does not know | Upgrade the package, or re-request |
LICENSE_CONFIG_INVALID | A restricted key met a verifier with no project to compare | Report it; this is an integration fault |
One failure carries no code, because it is not about your licence at all:
| Error | Meaning | Fix |
|---|---|---|
MissingSigningKeyError | The package was published without a signing key embedded | Report it; nothing you can do locally will help |
That is a packaging fault on our side. Your licence is fine, and no version of it will work against such a build.
A run also warns for the 28 days before expiry, once per run.
Buying or renewing a key
To buy or renew a key, contact Cerios - Spartaficial. A key is issued for your organisation with a validity of up to twenty-four months; twelve months is the usual term.