CycloneDX / CycloneDX/specification

Unique titles for JSON schema definitions

Open
#203 3 comments 0 reactions 0 assignees View on GitHub
documentation format: JSON
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.