Conversation
…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>
a63e402 to
479032e
Compare
| @vspec( | ||
| element: SENSOR, | ||
| fqn: "Vehicle.Speed", | ||
| metadata: [ |
There was a problem hiding this comment.
why not a dict as value, so taking 1:1 what is in the source?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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). | |||
There was a problem hiding this comment.
sources are gql specific and should be moved into s2dm dir
There was a problem hiding this comment.
The graphql related utils were moved to the s2dm directory as suggested.
147c8ce to
366bdba
Compare
|
@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
|
c8aa548 to
c702c27
Compare
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>
877ea5e to
f63becd
Compare
…ec file Signed-off-by: JD Alvarez <8550265+jdacoello@users.noreply.github.com>

No description provided.