[Dart] variable name conflict for MERAKI.COM
- Dominant language
- C#
- Stars
- 3.8k
- Forks
- 333
- Avg merge
- 16h 29m
- Merged PRs (30d)
- 116
Description
Found as part of https://github.com/microsoft/kiota/pull/7774:
Using the source code from 2026-06-17 and this command:
```
./it/generate-code.ps1 -descriptionUrl https://raw.githubusercontent.com/meraki/openapi/refs/heads/master/openapi/spec3.json -language dart -dev
.\it\exec-cmd.ps1 -descriptionUrl https://raw.githubusercontent.com/meraki/openapi/refs/heads/master/openapi/spec3.json -language dart
```
The generated client does not compile:
Analyzing lib...
```
error • networks\item\topology\linkLayer\link_layer_get_response_links_ends.dart:32:52 • A value of type
'LinkLayerGetResponseLinksEndsNode?' can't be assigned to a variable of type 'ParseNode'. Try changing the
type of the variable, or casting the right-hand type to 'ParseNode'. • invalid_assignment
```
The error line is the deserialization for field `node`:
```dart
/// The deserialization information for the current model
@override
Map getFieldDeserializers() {
var deserializerMap = {};
deserializerMap['device'] = (node) => device = node.getObjectValue(LinkLayerGetResponseLinksEndsDevice.createFromDiscriminatorValue);
deserializerMap['discovered'] = (node) => discovered = node.getObjectValue(LinkLayerGetResponseLinksEndsDiscovered.createFromDiscriminatorValue);
deserializerMap['node'] = (node) => node = node.getObjectValue(LinkLayerGetResponseLinksEndsNode.createFromDiscriminatorValue);
return deserializerMap;
}
```
It happens because the lamda expression parameter is named `node`, but the body of the lambda expression wants to assign to a field `node`.
It compiles if you change the parameter name like this:
```dart
/// The deserialization information for the current model
@override
Map getFieldDeserializers() {
var deserializerMap = {};
deserializerMap['device'] = (node) => device = node.getObjectValue(LinkLayerGetResponseLinksEndsDevice.createFromDiscriminatorValue);
deserializerMap['discovered'] = (node) => discovered = node.getObjectValue(LinkLayerGetResponseLinksEndsDiscovered.createFromDiscriminatorValue);
deserializerMap['node'] = (nodeX) => node = nodeX.getObjectValue(LinkLayerGetResponseLinksEndsNode.createFromDiscriminatorValue);
return deserializerMap;
}
```
Contributor guide
Research direction
Reproduce the failure with the two commands in the issue and the Meraki OpenAPI URL, then inspect the generated file at networks/item/topology/linkLayer/link_layer_get_response_links_ends.dart. Trace the Dart generator or template that emits getFieldDeserializers and the conflicting node names. Done means the generated Dart client passes analysis without the invalid_assignment error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- dart
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 72/100