Skip to content

Unique titles for JSON schema definitions #203

Open
@howardj99

Description

@howardj99

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions