Skip to content

Feat/s2dm exporter enhancements#486

Draft
jdacoello wants to merge 12 commits intoCOVESA:masterfrom
jdacoello:feat/s2dm-exporter-enhancements
Draft

Feat/s2dm exporter enhancements#486
jdacoello wants to merge 12 commits intoCOVESA:masterfrom
jdacoello:feat/s2dm-exporter-enhancements

Conversation

@jdacoello
Copy link
Contributor

No description provided.

…ance and annotate modified values with metadata

Signed-off-by: JD Alvarez <8550265+jdacoello@users.noreply.github.com>
…otation

Signed-off-by: JD Alvarez <8550265+jdacoello@users.noreply.github.com>
@jdacoello jdacoello force-pushed the feat/s2dm-exporter-enhancements branch from a63e402 to 479032e Compare February 6, 2026 14:50
@vspec(
element: SENSOR,
fqn: "Vehicle.Speed",
metadata: [
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not a dict as value, so taking 1:1 what is in the source?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This metadata can hold more than only the fields reported by the vss model. For example, I am now annotating when a name was modified. For instance, a leaf name in VSS is PascalCase, whereas in the export it becomes a field inside a type, which in GraphQL conventions is done with camelCase. However, I think I can assign to metadata:

Dict found in VSS model + Dict of extra stuff.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, a dictionary is not a built-in scalar in GraphQL. There are other community driven scalars specified. But, they don't offer the dictionary scalar. The closest one would be to say it's a JSON.

"""Annotation directive for Vspec mapping information."""
directive @vspec(
  """The element of the Vspec language to which the item in the GraphQL schema maps."""
  element: VspecElement,
  """The Fully Qualified Name (FQN) of the related element in Vspec (aka., path). Example: Vehicle.Cabin.Door.Window.position"""
  fqn: String
  """Additional metadata associated with the mapping."""
  metadata: JSON
) on OBJECT | FIELD_DEFINITION | ENUM | ENUM_VALUE
@vspec(
  element: SENSOR,
  fqn: "Vehicle.Speed",
  metadata: '{"source": "ecu0xAA", "quality": "100"}'
)

Is that what you mean? It seems feasible. But, I see a few limitations with that:

  • Less GraphQL-idiomatic (clients must parse JSON string), where the JSON can have multiple nested objects
  • No type safety
  • GraphQL introspection will provide metadata as a string

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's what I meant but encoding JSON into a string is not that great... then let's stick with the typed key vale pair. Although there exists the same problem that all values are forced to be strings and we are limiting ourselves to non complex metadata values, which in turn means that complex vales could be JSON strings...

@@ -117,28 +120,98 @@ def _process_allowed_enum_directives(
Process allowed value enum directives.

Annotates the enum type itself with @vspec(element, fqn, metadata),
but does NOT annotate individual enum values.
and annotates individual enum values that were modified with @vspec(metadata).
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sources are gql specific and should be moved into s2dm dir

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The graphql related utils were moved to the s2dm directory as suggested.

@jdacoello jdacoello force-pushed the feat/s2dm-exporter-enhancements branch from 147c8ce to 366bdba Compare February 9, 2026 13:12
@erikbosch
Copy link
Collaborator

@jdacoello - I noticed a regression in VSS master branch as the test there using Makefile gives a file rather than a directory as output, which was changed by your latest PR. No worries, I can fix that. I just want to double check that the help given for s2dm is correct. In the screenshot below it says for -o: "Output file or directory (when using --modular)". That text is understand it obsolete, could you if so possibly change it as part of this PR.

image

@jdacoello jdacoello marked this pull request as draft February 10, 2026 14:55
@jdacoello jdacoello force-pushed the feat/s2dm-exporter-enhancements branch from c8aa548 to c702c27 Compare February 19, 2026 13:23
Signed-off-by: JD Alvarez <8550265+jdacoello@users.noreply.github.com>
…GraphQL schema generation

Signed-off-by: JD Alvarez <8550265+jdacoello@users.noreply.github.com>
Move graphql_utils.py, graphql_scalars.py, graphql_directive_processor.py,
and modular_export_utils.py from utils/ to exporters/s2dm/ since they are
exclusively used by the s2dm exporter. Update all imports accordingly.

Signed-off-by: JD Alvarez <8550265+jdacoello@users.noreply.github.com>
…S2DM exporter

- Introduced short name collision detection and resolution strategy in the S2DM exporter.
- Added support for generating concise GraphQL type names using the last segment of the VSS path.
- Implemented progressive qualification for name collisions, allowing for parent and ancestor names to be added as needed.
- Updated the CLI options to include a flag for using fully qualified names.
- Enhanced the schema generation process to accommodate both short and fully qualified names based on user preference.
- Added comprehensive logging and reporting for name collisions, including a detailed YAML report.
- Created new tests to validate the functionality of short name collision detection and resolution.

Signed-off-by: JD Alvarez <8550265+jdacoello@users.noreply.github.com>
Signed-off-by: JD Alvarez <8550265+jdacoello@users.noreply.github.com>
…py errors

Signed-off-by: JD Alvarez <8550265+jdacoello@users.noreply.github.com>
Signed-off-by: JD Alvarez <8550265+jdacoello@users.noreply.github.com>
Problem appeared when field connects to type produced from vspec struct and it was resolving always to String due to name shortening missmatches.

Signed-off-by: JD Alvarez <8550265+jdacoello@users.noreply.github.com>
Signed-off-by: JD Alvarez <8550265+jdacoello@users.noreply.github.com>
@jdacoello jdacoello force-pushed the feat/s2dm-exporter-enhancements branch from 877ea5e to f63becd Compare March 2, 2026 15:15
…ec file

Signed-off-by: JD Alvarez <8550265+jdacoello@users.noreply.github.com>
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.

3 participants