chore: Automate data model generation from upcoming CycloneDX 2.0 machine-readable specification
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 25/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Necesita aclaración
- Estado de actividad
- Tranquilo
- Stack tecnológico
- json, typescript
- Área
- build-system, tooling
Línea de trabajo
Comienza con los JSON schemas modulares de CycloneDX 2.0 y revisa las implementaciones de prueba de concepto existentes mencionadas en el issue. Evalúa cómo deben gestionarse las referencias de esquema y la composición, y después define el workflow de generación y build; se considera terminado cuando los modelos TypeScript deterministas se generan antes del build y se commitean en el repositorio.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Description
The current data models in this library are primarily handwritten and manually maintained. While functional, this approach introduces significant overhead in terms of development effort, code review, and long-term maintenance.
With the introduction of CycloneDX 2.0, the specification is evolving toward a modularized, machine-readable schema architecture. This creates an opportunity to fundamentally shift how data models are produced in this project: from manual implementation to schema-driven code generation.
This issue proposes aligning the library with that direction by adopting automated model generation based on the CycloneDX 2.0 modular JSON schemas.
Reference (work in progress):
- Python library discussion: https://github.com/CycloneDX/cyclonedx-python-lib/issues
- CycloneDX 2.0 modular schemas: https://github.com/CycloneDX/specification/tree/2.0-dev/schema/2.0/model
Problem
- Data models are manually implemented and maintained
- High maintenance and review overhead
- Repetitive and error-prone contributor work
- Slower adoption of specification updates
- Risk of inconsistencies with the official specification
Proposal
Introduce a schema-driven model generation pipeline based on the CycloneDX 2.0 modular JSON schemas.
Key aspects:
- Use the official modular schema definitions as the single source of truth
- Automatically generate JavaScript/TypeScript data models from these schemas
- Support the modular structure (i.e., multiple interdependent schema files)
- Integrate generation into the build and/or release workflow
- Ensure generated models remain aligned with upstream specification changes
This would replace most handwritten models with deterministically generated code, reducing manual effort and improving consistency.
Existing proof-of-concept implementations have already demonstrated feasibility. These should be revisited and consolidated into a production-ready approach.
Pipeline:
CycloneDX JSON Schema
↓
Preprocessing (if needed)
↓
Code Generation (datamodel-code-generator)
↓
Post-processing (formatting, adjustments)
↓
Generated Python Models
Possible Tools / Libraries
The following tools may be evaluated for compatibility with modular JSON Schema processing and TypeScript generation:
-
quicktype (Apache 2.0)
Generates TypeScript models from JSON Schema and other inputs -
json-schema-to-typescript (MIT)
Strong support for JSON Schema → TS interfaces (including unions and enums) -
typebox (MIT)
Schema-first approach with runtime validation and static typing -
ajv + tooling (MIT)
Useful for schema validation and potential type generation workflows -
Custom generator layer (optional)
May be required to properly resolve CycloneDX modular schema composition and cross-references
Expected Benefits
- Significant reduction in manual maintenance effort
- Guaranteed alignment with the official CycloneDX specification
- Faster and safer adoption of future spec versions
- Improved consistency and correctness of data models
- Better contributor experience (less repetitive work)
Considerations / Open Questions
- What is the exact structure and format of the CycloneDX 2.0 machine-readable specification (JSON Schema variants, bundling, refs)?
- JSON Schema it is
- How should modular schemas be resolved and composed during generation?
- Should generated code be committed to the repository or produced at build time?
- decision: generated before build time, and commited to the repo
- How should custom extensions or library-specific logic be layered on top of generated models?
- What strategy ensures backward compatibility with CycloneDX 1.x?
- easy path: breaking change, and only support CDX 2.0 from then on
Additional Context
This effort aligns closely with the goals of CycloneDX 2.0 to provide a modular, tooling-friendly specification. Leveraging this architecture for automated model generation will significantly improve the long-term sustainability and scalability of this library.
Note: This issue serves as a meta-ticket to coordinate related subtasks, experiments, and implementation steps for introducing schema-driven model generation.
- Lenguaje dominante
- TypeScript
- Estrellas
- 25
- Forks
- 16
- Merge medio
- 7 d 18 h
- PR fusionados (30 d)
- 5
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de CycloneDX/cyclonedx-javascript-library
-
export for denoAbiertoenhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
-
CycloneDX 1.7.1Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 48/100
-
Dificultad 3/5 1-2 días Aptitud para principiantes 68/100
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 25/100
-
feat: Deserializer/DenormalizerAbiertoenhancement schema 2.0
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
Todos los issues de CycloneDX/cyclonedx-javascript-library
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
JuliusBrussee/caveman#1449 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 78/100
linagora/twake-calendar-frontend#1924 ·
Los mantenedores suelen responder en 1 día
-
Add: Class TV ModaAbiertocheck:passed streams:add
Dificultad 1/5 Menos de una hora Aptitud para principiantes 65/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
libnativeapi/nativeapi#21 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
GiganticMinecraft/seichi-playguide#183 ·
Los mantenedores suelen responder en 1 día