OpenAPITools / OpenAPITools/openapi-generator
[BUG]Python generator produces invalid license value in pyproject.toml
Open
@kay-schecker is already working on this.
Since Sep 29, 2025.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
🐛 Bug Report:
Describe the bug
Python generator produces invalid license = "NoLicense" in pyproject.toml, causing python -m build to fail. The value "NoLicense" is not a valid SPDX identifier according to PEP 621 standards.
Steps to Reproduce
Steps to reproduce the behavior:
- Create an OpenAPI spec without a license field (or with a non-standard license)
- Generate Python client using:
openapi-generator-cli generate -i spec.json -c openapi.yml -g python -o dist --skip-validate-spec - Navigate to the generated
distdirectory - Run
python -m build - See error:
configuration error: `project.license` must be valid exactly by one definition (0 matches found) GIVEN VALUE: "NoLicense"
Expected behavior
The generator should either:
- Use a valid SPDX identifier like
"UNLICENSED"(proper SPDX term for unlicensed code) - Omit the license field entirely from pyproject.toml if no license is specified
- Use the table format:
license = {text = "Proprietary"}
According to PEP 621, the license field must be either:
- A valid SPDX string identifier
{file = "LICENSE"}format{text = "license text"}format
"NoLicense" is not a recognized SPDX identifier and causes the build to fail.
Environment
- OpenAPI Generator version: 7.14.0 (also occurs in 7.11.0)
- Generator: python
- Python version: 3.13
- Build tool: python -m build
Additional context
Full error traceback:
ValueError: invalid pyproject.toml config: `project.license`.
configuration error: `project.license` must be valid exactly by one definition (0 matches found):
- {type: string, format: 'SPDX'}
- type: table
keys:
'file': {type: string}
required: ['file']
- type: table
keys:
'text': {type: string}
required: ['text']
Reference: https://peps.python.org/pep-0621/#license
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.