CycloneDX / CycloneDX/specification
Unique titles for JSON schema definitions
- Dominant language
- XSLT
- Stars
- 547
- Forks
- 93
- Avg merge
- 7h 11m
- Merged PRs (30d)
- 37
Description
When generating Python `pydantic` models from the released CycloneDX schemas using `datamodel-code-generator` with the `--use-title-as-name` flag, several model classes are created with names such as `Type` (naming collision with `typing.Type` class), `Type1`, `Type2`, etc. due to duplicate definition `title` properties in the schemas.
Would it be feasible to make these definition titles unique and more descriptive of what they represent to enhance automated generation of models? Example of suggested changes:
| Schema path | Current | Proposed | Generated model class |
| ------------------------------------------------------ | ---------------- | --------------------------- | ----------------------- |
| `.definitions.dataClassification.title` | `"Hash objects"` | `"Data Classification"` | `DataClassification` |
| `.definitions.issue.title` | `"Diff"` | `"Issue"` | `Issue` |
| `.definitions.externalReference.properties.type.title` | `"Type"` | `"External Reference Type"` | `ExternalReferenceType` |
| `.definitions.issue.properties.type.title` | `"Type"` | `"Issue Type"` | `IssueType` |
| `.definitions.patch.properties.type.title` | `"Type"` | `"Patch Type"` | `PatchType` |
| `.definitions.releaseNotes.properties.type.title` | `"Type"` | `"Release Type"` | `ReleaseType` |
| `.definitions.vulnerabilitySource.title` | `"Source"` | `"Vulnerability Source"` | `VulnerabilitySource` |
Contributor guide
Assessment
This issue has not been assessed yet.