Skip to content

Trim service-layer payloads in snapshot exports - #55

Merged
danmaps merged 2 commits into
mainfrom
copilot/fix-layers-json-bloat
Sep 23, 2026
Merged

danmaps merged 2 commits into
mainfrom
copilot/fix-layers-json-bloat

Conversation

Copilot AI commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

What

  • Reduce layers.json size for service-backed layers by exporting concise metadata only instead of full schema/sample payloads.
  • Exporter changes
    • Detect dataSourceKind == "service" during layer collection.
    • Skip heavyweight service-layer payloads:
      • fields
      • sampleData
      • field statistics
      • expensive feature/selection counts
    • Normalize service datasource values to a concise URL/path before serialization.
  • Docs
    • Update generated export documentation to clarify that service layers are metadata-only in layers.json.
  • CLI compatibility
    • Add a regression test covering metadata-only service-layer entries to ensure existing layer inspection continues to work.
if (isServiceLayer)
{
    info.DataSourcePath = GetConciseServiceUrl(info.DataSourcePath);
}
else if (exportFields)
{
    info.Fields = exportFastSchema ? CollectFieldInfoFast(fcDef) : CollectFieldInfo(fcDef);
}

Why

  • Snapshot exports for simple projects with ArcGIS Online/service layers were producing disproportionately large layers.json files.
  • The bulk came from serializing detail that is not needed for common CLI queries.

How to test

  • Create a map with ArcGIS Online / service-backed layers and run a snapshot export.
  • Inspect .arcgispro/context/layers.json and confirm service layers contain only concise metadata, not full field/sample payloads.
  • Run arcgis layer <name> against a service layer and confirm details still render correctly.

Notes / risks

  • Service-backed layers will no longer include field schemas or sampled rows in layers.json.
  • Local/file-backed layers keep their existing behavior.

Copilot AI linked an issue Sep 22, 2026 that may be closed by this pull request
Co-authored-by: danmaps <10421813+danmaps@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix layers.json bloat for service layers Trim service-layer payloads in snapshot exports Sep 22, 2026
Copilot AI requested a review from danmaps September 22, 2026 21:39
@danmaps
danmaps marked this pull request as ready for review September 23, 2026 00:53
@danmaps
danmaps merged commit 80935b5 into main Sep 23, 2026
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.

Snapshot: layers.json bloat for service layers

2 participants