Skip to content

Fix/wsdl xsd schemas and dryrun label - #272

Merged
Alexander Zaslonov (azaslonov) merged 4 commits into
Azure:mainfrom
Alexey-Zheltov:fix/wsdl-xsd-schemas-and-dryrun-label
Sep 12, 2026
Merged

Alexander Zaslonov (azaslonov) merged 4 commits into
Azure:mainfrom
Alexey-Zheltov:fix/wsdl-xsd-schemas-and-dryrun-label

Conversation

@Alexey-Zheltov

Copy link
Copy Markdown
Collaborator

Summary

Fixes two publish bugs found while round-tripping a real-world APIM export containing SOAP (WSDL) APIs and gateway API associations:

  1. Dry-run fatal crash on gateway API associationsbuildResourceLabel() formatted log labels from armPathSuffix (gateways/{0}/apis/{1}), which throws for parent-level association descriptors that carry only the gateway name. The throw escaped from the dry-run loop and aborted the whole publish. Now falls back to the artifactDirectory template when the descriptor has fewer name-parts than the ARM template requires.

  2. ValidationError on every WSDL-importer-generated XSD schema — the WSDL importer names XSD schemas with GUIDs, but isAutoGeneratedId() only matches 24-char hex IDs, so the CLI re-published these schemas after spec import and APIM rejected each PUT. Now schemas with contentType: application/vnd.ms-azure-apim.xsd+xml are excluded from childPuts when the specification is imported.

Related Issue(s)

Closes #270
Closes #269

Verification

  • npx vitest run — 1464 passed (the only failing file, tests/unit/cli/index.test.ts, is a known 9p-mount environment issue, unrelated)
  • End-to-end publish of a real export (10 APIs, 7 SOAP): before — fatal dry-run crash / 25 schema errors; after — dry-run exits 0, publish completes with 0 errors and target schema counts match the source
  • tsc --noEmit clean

Notes for Reviewers

Code review required per repo policy for src/ changes (.squad/ceremonies.md).
Content-type filtering was chosen over widening the auto-generated ID regex to GUIDs because user-defined schemas may legitimately use GUID names.

buildResourceLabel() always formatted labels from armPathSuffix, which has
more placeholders than a parent-level association descriptor (e.g. GatewayApi
discovered from gateways/{gateway}/apis.json with one name-part) can fill.
The resulting throw escaped from logger.info inside the dry-run loop and
aborted the entire publish with a fatal error.

Fall back to the artifactDirectory template when the descriptor has fewer
name-parts than armPathSuffix placeholders.
APIM recreates XSD schemas itself when a WSDL spec is imported, but the
isAutoGeneratedId() filter only matches 24-char hex IDs while the WSDL
importer names XSD schemas with GUIDs. The CLI therefore re-published them
as explicit schemas and APIM rejected every PUT with ValidationError
(25 errors across 7 SOAP APIs in a real-world export).

Exclude schemas whose contentType is application/vnd.ms-azure-apim.xsd+xml
from childPuts when the specification is being imported. Content-type
filtering is safer than widening the auto-generated ID pattern to GUIDs,
since user-defined schemas may legitimately use GUID names.
Copilot AI balanced review requested due to automatic review settings September 8, 2026 11:34

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

XSD filtering currently removes explicitly managed schemas from non-WSDL API imports.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Fixes WSDL schema publishing failures and dry-run crashes for gateway API associations.

Changes:

  • Filters generated XSD schemas after specification imports.
  • Adds fallback labels for incomplete association descriptors.
File summaries
File Description
src/services/api-publisher.ts Filters XSD schemas, but must limit exclusion to WSDL imports and add regression coverage.
src/lib/resource-uri.ts Prevents incomplete association labels from crashing; direct fallback-path coverage is recommended.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 2
  • Review effort level: Balanced

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

Comment thread src/services/api-publisher.ts Outdated
Comment thread src/lib/resource-uri.ts
…ted tests

Address PR review feedback:
- Only exclude XSD-content-type schemas when the imported spec format is
  wsdl; other importers (OpenAPI, Swagger, WADL) do not recreate them, so
  explicitly managed XSD schemas are retained there.
- Add regression tests: GatewayApi label fallback for one-part descriptors
  (gateways/my-gateway) and two-part expansion; XSD/GUID schema skipped on
  WSDL import but retained on OpenAPI import.
Copilot AI review requested due to automatic review settings September 8, 2026 11:45

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

All reviewed changes are covered by regression tests, with no unresolved issues.

Review details
  • Files reviewed: 4/4 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

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

The targeted fixes match issues #269 and #270 and include appropriate regression coverage.

Review details
  • Files reviewed: 4/4 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

Copilot AI review requested due to automatic review settings September 12, 2026 00:46

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

The focused fixes match the reported failures and include appropriate regression coverage.

Review details
  • Files reviewed: 4/4 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

@azaslonov
Alexander Zaslonov (azaslonov) merged commit 03612c6 into Azure:main Sep 12, 2026
6 checks passed
@Alexey-Zheltov
Aleksey Zheltov (Alexey-Zheltov) deleted the fix/wsdl-xsd-schemas-and-dryrun-label branch September 14, 2026 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

4 participants