Skip to content

fix: enable cross-service publish and WSDL re-import with external xsd:imports - #285

Merged
Alexander Zaslonov (azaslonov) merged 2 commits into
Azure:mainfrom
Alexey-Zheltov:fix/strip-source-arm-id-on-put
Sep 21, 2026
Merged

Alexander Zaslonov (azaslonov) merged 2 commits into
Azure:mainfrom
Alexey-Zheltov:fix/strip-source-arm-id-on-put

Conversation

@Alexey-Zheltov

Copy link
Copy Markdown
Collaborator

Summary

Fixes two independent publish failures verified end-to-end against a live Developer-tier APIM instance.

1. Cross-service publish rejected (HTTP 400)

Extracted artifacts carry the source service's ARM paths, and the publisher sent them verbatim. Newer APIM api-versions reject these with ValidationError: Cross-service resource references are not allowed, failing every resource PUT when the target differs from the source service (27/27 errors in repro).

  • stripSourceArmId() in apim-client: strip the top-level id from PUT/PATCH bodies
  • normalizeDiagnosticLoggerId() in resource-publisher: rebuild properties.loggerId of Diagnostic/ApiDiagnostic against the target service (honoring env-mapping affixes), same pattern as existing apiId/apiVersionSetId normalizations

2. SOAP WSDL re-import fails: "Unable to parse WSDL" / HTTP 422 Timeout

APIM's WSDL export inlines all XSD schemas in wsdl:types and preserves the original xs:import schemaLocation URLs from the initial import (private hosts unreachable from Azure). On re-import APIM tries to resolve them and fails or times out.

  • New normalizeWsdlXsdImportLocations() in wsdl-normalizer: drop the schemaLocation attribute only when the imported namespace is declared by an inline schema (per XML Schema spec, schemaLocation is just a hint). wsdl:import location=, no-namespace imports, and namespaces not present inline are left untouched
  • Applied on the publish path (fixes already-extracted artifacts) and the extract path (future extracts are clean)

Verification

  • Live repro: previously failing SOAP API (format=wsdl import, 32 external xs:imports) now publishes with 0 errors (37 creates/updates)
  • Unit tests: +9 new (2 apim-client, 3 resource-publisher, 4 wsdl-normalizer); full suite 1494 passed, lint clean (10 failures in tests/unit/cli/index.test.ts are a known 9p-mount environment issue, unrelated)

Related Issue(s)

Closes #284
Related: #270 (same WSDL round-trip area, different layer — XSD schema artifact re-PUTs)

Code Review

Code review per .squad/ceremonies.md requested — changes touch src/ and tests/.

…d:imports

Three publish fixes verified against a live Developer-tier instance:

- strip the top-level source ARM id from PUT/PATCH bodies; newer APIM
  api-versions reject cross-service resource references, breaking publish
  to any service other than the one extracted from
- normalize diagnostic loggerId (service and API scope) to the target
  service ARM path, honoring env-mapping affixes
- drop xsd:import schemaLocation attributes that reference external hosts
  when the imported namespace is declared inline in wsdl:types; APIM's
  importer otherwise fails ("Unable to parse WSDL") or times out trying
  to resolve unreachable source-service URLs. Applied on both the publish
  path (existing artifacts) and extract path (future extracts)

Closes Azure#284
Copilot AI balanced review requested due to automatic review settings September 14, 2026 16:50

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Workspace-scoped diagnostic logger references must include the deployed workspace path.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Fixes cross-service APIM publishing and SOAP WSDL re-import failures.

Changes:

  • Removes source ARM IDs and remaps diagnostic logger references.
  • Normalizes inline WSDL XSD imports on extract and publish.
  • Adds unit coverage for the new behavior.
  • Critical unresolved issue: workspace-scoped diagnostic logger references omit the workspace path.
File summaries
File Summary
tests/unit/services/resource-publisher.test.ts Tests diagnostic logger normalization.
tests/unit/lib/wsdl-normalizer.test.ts Tests WSDL import normalization.
tests/unit/clients/apim-client.test.ts Tests ARM ID stripping.
src/services/resource-publisher.ts Rebuilds diagnostic logger references; workspace paths remain unsupported.
src/services/api-publisher.ts Applies WSDL normalization during publishing.
src/lib/wsdl-normalizer.ts Removes unnecessary inline XSD import locations.
src/clients/apim-client.ts Strips top-level ARM IDs from write payloads.
Review details
  • Files reviewed: 7/7 changed files
  • Comments generated: 1
  • Review effort level: Lite (auto)

Note

Copilot is running an experiment and ran this review at Lite.


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/services/resource-publisher.ts Outdated
Review finding on Azure#285: workspace-scoped diagnostics reference workspace
loggers, but the rebuilt loggerId always pointed at the service level.
Pass descriptor.workspace through and emit
/workspaces/{ws}/loggers/{name} (with env-mapping affixes), mirroring
normalizeApiVersionSetId.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No unresolved blocking issues were identified.

Review details
  • Files reviewed: 7/7 changed files
  • Comments generated: 0 new
  • Review effort level: Lite (auto)

Note

Copilot is running an experiment and ran this review at Lite.

@azaslonov
Alexander Zaslonov (azaslonov) merged commit bd98282 into Azure:main Sep 21, 2026
6 checks passed
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.

Publish fails cross-service (ARM id in PUT body) and SOAP WSDL re-import fails on external xsd:import schemaLocations

3 participants