Skip to content

fix: correct response shapes and member names that could never bind - #416

Merged
danielabbatt merged 1 commit into
mainfrom
fix/response-shape-defects
Sep 29, 2026
Merged

danielabbatt merged 1 commit into
mainfrom
fix/response-shape-defects

Conversation

@danielabbatt

@danielabbatt danielabbatt commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

Rebased onto main on 2026-09-29 (main builds as 1.70.147). Merges as 1.74.6.

Before merging, retarget the base to main. Base branches are not auto-deleted in this repo, so GitHub will not retarget for you, and merging into the old base leaves the work off main (what happened to #413). Merge only after #415 is on main, with a merge commit; do not squash, rebase or click Update branch.

Stacked on #415

Base is chore/update-to-latest-meraki-api. Merge #415 first, then retarget this to main. Merge both with merge commits. The changelog labels (1.74.5 for #415, 1.74.6 for this) assume that; each merge commit adds one to the longest-path height; a squash or rebase shifts them.

What

Find-ModelShapeMismatches.ps1 (added in #415) found endpoints whose declared return type cannot deserialize what the Dashboard API sends, and [DataMember] names that are misspelt so the property never bound. This PR fixes every finding assessed as real. It is breaking: public return types and property names change. Each is listed in the 1.74.6 changelog section.

Class of defect Count Fix
List<T> where the API sends {items, meta} 6 wrapper types deriving from ItemsResponseWithMeta<T> (one already existed and was wrapped in a List)
Single object where the API sends an array 6 List<T>
List<T> where the API sends a single object (single-resource paths) 10 T (one was List<SecurityEvent>, an unrelated type)
Stale model: NetworkMove has neither property the API now sends 1 CreateNetworkMoveAsync now returns NetworkMoveDetailed; NetworkMove [Obsolete]; MoveId + Result added
Misspelt [DataMember] names 6 corrected, property renamed where it carried the typo

Found while writing the tests

ItemsResponseWithMeta<T> and the three ItemsResponseMeta* classes had no [DataContract]. Because each derived wrapper is [DataContract] (opt-in), Newtonsoft marked the inherited Meta as ignored and silently dropped the API's meta object, for every existing wrapper, not just the new ones. Verified by resolving the contract: Meta <- Meta ignored=True. Fixed by adding [DataContract] to all four; Meta.Counts will start being populated where it was always null.

Deliberately not changed

  • Three object-vs-list findings are the known Meraki spec habit of documenting a list endpoint's item rather than the array (GetNetworkWirelessRfProfilesAsync is observed live as an array in the customer CSV).
  • Five endpoints the spec documents as an array whose only item is itself {items, meta}, where the library's wrapper is right.
  • NetworkFirmwareUpgrade.products flagged as a typo of product: a false positive, since both exist in the spec.

Callers

No code outside Meraki.Api/Interfaces and Meraki.Api/Data references any changed method or property (checked Meraki.Api, Meraki.Api.Test, Meraki.ApiChecker).

Verification

dotnet build Meraki.Api.slnx -c Debug   Build succeeded, 0 Error(s), 6 pre-existing CS0618 warnings
Meraki.Api.Test (Data namespace)        Total: 23, Errors: 0, Failed: 0   (9 new in ResponseShapeTests)
Meraki.Api.Test (Workflows)             Total: 12, Errors: 0, Failed: 0

The NetworkMovesResponse test failed first time with Meta.Counts == null, which is how the [DataContract] bug was found; it passes now. Every edited file kept its BOM and CRLF.

@danielabbatt
danielabbatt force-pushed the fix/response-shape-defects branch from 9d097af to 5349fcb Compare September 9, 2026 15:34
@danielabbatt
danielabbatt force-pushed the chore/update-to-latest-meraki-api branch from e3bc382 to 46f973a Compare September 9, 2026 15:35
@danielabbatt
danielabbatt force-pushed the fix/response-shape-defects branch from 5349fcb to 8536621 Compare September 9, 2026 15:35
@codacy-production

codacy-production Bot commented Sep 9, 2026 •

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 11 complexity

Metric Results
Complexity 11

View in Codacy

🟢 Coverage 57.14% diff coverage · +0.45% coverage variation

Metric Results
Coverage variation ✅ +0.45% coverage variation
Diff coverage ✅ 57.14% diff coverage

View coverage diff in Codacy

Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (b91f380) 7836 2683 34.24%
Head commit (9d400ac) 7839 (+3) 2719 (+36) 34.69% (+0.45%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#416) 7 4 57.14%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

AI Reviewer: run a review on demand. To trigger the first review automatically, go to your organization or repository integration settings. AI can make mistakes. Always validate suggestions.

Run reviewer

TIP This summary will be updated as you push new changes.

An audit against the v1.74.0 OpenAPI spec (Find-ModelShapeMismatches.ps1)
found Refit methods whose declared return type disagrees with the shape the
Dashboard API sends, so the call could never deserialize, and [DataMember]
names that are misspelt, so the property never bound.

Return types corrected (breaking for callers):

  List<T> where the API sends an {items, meta} wrapper (6):
    GetNetworkMovesAsync -> NetworkMovesResponse
    GetOrganizationCampusGatewayClustersAsync -> OrganizationCampusGatewayClustersResponse
    GetOrganizationSensorGatewaysConnectionsLatestAsync -> OrganizationSensorGatewaysConnectionsLatestResponse
    GetOrganizationSwitchPortsStatusesBySwitchAsync -> OrganizationSwitchPortsStatusesBySwitchResponse
    GetOrganizationIntegrationsXdrNetworksAsync -> OrganizationIntegrationsXdrByNetwork (already a wrapper)
    UpdateOrganizationSmSentryPoliciesAssignments -> OrganizationSmSentryPoliciesAssignmentsUpdateResponse
  Single object where the API sends an array (6): now List<T> of the same T.
  List<T> where the API sends a single object (10): now T, all single-resource
    paths. UpdateNetworkApplianceSdwanInternetPoliciesAsync was declared as
    List<SecurityEvent>, an unrelated type.

CreateNetworkMoveAsync returns NetworkMoveDetailed: the API stopped sending
networkMoveId and url, so NetworkMove is [Obsolete]. NetworkMoveDetailed gains
MoveId and Result (new NetworkMoveResult); its Status left the spec and is
nullable.

Misspellings fixed, renaming the property where it carried the typo:
occuredAt -> occurredAt, farenheit -> fahrenheit, moveLicenses -> movedLicenses,
intiator -> initiator, themeAssests -> themeAssets, address -> addresses.

Found while testing: ItemsResponseWithMeta<T> and the ItemsResponseMeta*
classes lacked [DataContract], so on every opt-in derived wrapper Newtonsoft
marked the inherited Meta as ignored and dropped the API's meta object. All
four now carry [DataContract]; pagination counts will start arriving.

Left alone as the known Meraki spec habit of documenting a list endpoint's
item rather than the array: rfProfiles, licensing entitlements, early-access
opt-ins, and five endpoints documented as an array whose only item is itself
an {items, meta} wrapper.

ResponseShapeTests covers the new shapes, the corrected names and Meta.
@danielabbatt
danielabbatt force-pushed the fix/response-shape-defects branch from dcef70e to 9d400ac Compare September 29, 2026 12:56

@danielabbatt danielabbatt left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Reviewed

@danielabbatt
danielabbatt changed the base branch from chore/update-to-latest-meraki-api to main September 29, 2026 13:46
@danielabbatt danielabbatt reopened this Sep 29, 2026
@danielabbatt
danielabbatt merged commit 568ea53 into main Sep 29, 2026
8 checks passed
@danielabbatt
danielabbatt deleted the fix/response-shape-defects branch September 29, 2026 14:10
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