You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- **Arrays** → GraphQLLists (with natural plural field names)
86
86
- **Allowedvalues** → GraphQLEnums
87
87
88
+
#### List Field Names (Automatic Pluralization)
89
+
90
+
WhenVSSbrancheshaveinstances (like `Seat` with multiple rows/positions), theparenttypegetsalistfield. TheS2DMexporterautomaticallygenerates **naturalpluralnames** usingtheinflectlibrary:
91
+
92
+
- `seat` → `seats: [Vehicle_Cabin_Seat]`
93
+
- `door` → `doors: [Vehicle_Cabin_Door]`
94
+
- `window` → `windows: [Vehicle_Cabin_Window]`
95
+
- `battery` → `batteries: [Vehicle_Battery]`
96
+
- `mirror` → `mirrors: [Vehicle_Body_Mirror]`
97
+
98
+
ThisimprovesGraphQLschema readability by following common naming conventions instead of using mechanical suffixes like `_s`.
99
+
100
+
**Example:**
101
+
```graphql
102
+
type Vehicle_Cabin {
103
+
"""Cabin seats for passengers."""
104
+
seats: [Vehicle_Cabin_Seat]
105
+
106
+
"""Cabin doors."""
107
+
doors: [Vehicle_Cabin_Door]
108
+
}
109
+
```
110
+
111
+
**Tracking:** All pluralized field names are logged to `vspec_reference/pluralized_field_names.yaml` showing the original VSS FQN, the plural field name used, and its location in the GraphQL schema.
112
+
88
113
#### Enum Value Sanitization
89
114
90
115
GraphQL enum values must follow strict naming rules (alphanumeric + underscore only, cannot start with a digit). The S2DM exporter automatically sanitizes VSS enum values to comply with GraphQL requirements:
This ensures complete traceability between the VSS source and the generated GraphQL schema.
115
140
141
+
### GraphQL Naming Convention Warnings
142
+
143
+
GraphQL best practices recommend using **singular names for types** (e.g., `User` not `Users`, `Product` not `Products`). The S2DM exporter automatically detects VSS branches with plural names and generates warnings to help identify potential naming convention violations.
144
+
145
+
**Detection:** The exporter uses the inflect library to identify potential plural type names. It maintains a whitelist of known exceptions (acronyms like "ADAS", "ABS", Latin words like "Status", "Chassis") to reduce false positives.
146
+
147
+
**Warning Output:** When plural type names are detected, two files are generated in `vspec_reference/`:
148
+
149
+
1.**`plural_type_warnings.yaml`** - Lists all detected plural type names:
150
+
```yaml
151
+
# WARNING: These elements in the reference model seem to have a plural name...
152
+
153
+
Vehicle.Cabin.Lights:
154
+
singular: Light
155
+
currentNameInGraphQLModel: Vehicle_Cabin_Lights
156
+
157
+
Vehicle.Body.Mirrors:
158
+
singular: Mirror
159
+
currentNameInGraphQLModel: Vehicle_Body_Mirrors
160
+
161
+
# Whitelisted words (excluded from plural detection):
162
+
whitelisted_non_plurals:
163
+
- ADAS
164
+
- ABS
165
+
- Status
166
+
- Chassis
167
+
# ... etc
168
+
```
169
+
170
+
2.**Console warnings:** During export, warnings are logged for immediate visibility:
171
+
```
172
+
WARNING: Type 'Vehicle_Cabin_Lights' uses potential plural name 'Lights'.
0 commit comments