-
-
Notifications
You must be signed in to change notification settings - Fork 175
Open
Labels
bugSomething isn't workingSomething isn't working
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
dist
directory - 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
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working