Skip to content

Conversation

@jdacoello
Copy link
Contributor

This PR does some rework that enhances the way vspec is exported to fit the s2dm modeling approach based on GraphQL SDL. It includes aspects like:

  • Handling corner cases
  • Using extended attributes
  • Annotation of mappings
  • Improvements to the way how vspec is processed with pandas DataFrame
  • ...

… enums

- Implement nested domain structure with underscore prefix for root types
  - Root types use _ prefix (e.g., _Vehicle.graphql) to sort first in folders
  - Child types use immediate names only (e.g., Seat.graphql instead of Vehicle_Cabin_Seat.graphql)
  - Folder hierarchy provides full context

- Embed allowed value enums in type files
  - Enums generated from 'allowed' values are placed at bottom of type files
  - Removes separate enum files for better maintainability
  - Applies to both flat and nested structures

- Update documentation
  - Document all three output modes: single file, modular flat, modular nested
  - Add clear guidance on when to use each mode
  - Include visual directory structure examples
  - Explain underscore prefix convention and enum embedding

All tests pass successfully.

Signed-off-by: Daniel Alvarez-Coello <8550265+jdacoello@users.noreply.github.com>
…pport

- Updated get_metadata_df() to accept extended_attributes tuple parameter
- Made 'instantiate' a standard column for leaves (always included)
- Extended attributes now only included when explicitly requested via -e CLI flags
- Added debug logging to show DataFrame structure and found extended attributes
- Respects CLI flags: -e/--extended-attributes for whitelisting custom attributes

This change improves performance by making extended attributes available
directly in DataFrame columns, enabling O(1) access instead of O(n) tree
traversals.

Signed-off-by: Daniel Alvarez-Coello <8550265+jdacoello@users.noreply.github.com>
- Added missing KeyValue input type definition
- Simplified directive signature with element, fqn, and metadata fields
- Updated VspecElement enum with clearer descriptions
- Fixes schema loading failures caused by undefined KeyValue type

Signed-off-by: Daniel Alvarez-Coello <8550265+jdacoello@users.noreply.github.com>
- Move non-instantiated properties to parent type
- Naming: {branchName}{PropertyName} (e.g., Door.Kind -> doorKind)
- Optimize with DataFrame column access vs tree lookups
- Pass extended_attributes through schema generation
- Add test_non_instantiated_property_hoisting with fixtures

Signed-off-by: Daniel Alvarez-Coello <8550265+jdacoello@users.noreply.github.com>
S2DM exporter only needs -e/--extended-attributes for explicit whitelisting.
The --extend-all-attributes flag is not needed for this exporter.

Signed-off-by: Daniel Alvarez-Coello <8550265+jdacoello@users.noreply.github.com>
Consolidate vspec directive format and fix enum references:

- Add QUANTITY_KIND and UNIT to VspecElement enum for unit annotations
- Update unit enum directives to new format:
- Remove obsolete template definitions (vspec_fqn, vspec_unit, etc.)
- Replace all VspecType references with VspecElement throughout codebase
- Update modular_export_utils.py enum filtering to use VspecElement
- Fix test for hoisted field naming (someSignal instead of doorSomeSignal)

All 13 S2DM tests passing.

Signed-off-by: Daniel Alvarez-Coello <8550265+jdacoello@users.noreply.github.com>
… support

Signed-off-by: Daniel Alvarez-Coello <8550265+jdacoello@users.noreply.github.com>
Signed-off-by: Daniel Alvarez-Coello <8550265+jdacoello@users.noreply.github.com>
…GraphQL because the outer quotes must be double.

Signed-off-by: Daniel Alvarez-Coello <8550265+jdacoello@users.noreply.github.com>
…en modular output mode is selected

Signed-off-by: Daniel Alvarez-Coello <8550265+jdacoello@users.noreply.github.com>
Signed-off-by: Daniel Alvarez-Coello <8550265+jdacoello@users.noreply.github.com>
… construct

Signed-off-by: Daniel Alvarez-Coello <8550265+jdacoello@users.noreply.github.com>
…truction

Signed-off-by: Daniel Alvarez-Coello <8550265+jdacoello@users.noreply.github.com>
Signed-off-by: Daniel Alvarez-Coello <8550265+jdacoello@users.noreply.github.com>
Signed-off-by: Daniel Alvarez-Coello <8550265+jdacoello@users.noreply.github.com>
Signed-off-by: Daniel Alvarez-Coello <8550265+jdacoello@users.noreply.github.com>
- Added `metadata_tracker.py` for initializing and managing VSS metadata.
- Created `reference_generator.py` to handle VSS reference file generation alongside GraphQL schema output.
- Developed `schema_generator.py` for orchestrating the complete S2DM GraphQL schema generation process.
- Introduced `type_builders.py` for constructing GraphQL types from VSS elements, including unit enums, instance types, and struct types.
- Updated tests to reflect changes in module imports and ensure functionality of new features.

Signed-off-by: Daniel Alvarez-Coello <8550265+jdacoello@users.noreply.github.com>
@jdacoello jdacoello force-pushed the refactor/s2dm-exporter branch from 5ae1f3a to 6e5ca43 Compare December 19, 2025 14:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant