Skip to content

fix: strip schemaId/typeName from operation PATCH during reconciliation#111

Open
EMaher wants to merge 4 commits into
mainfrom
emaher/fix-strip-schema-refs-in-operation-recon
Open

fix: strip schemaId/typeName from operation PATCH during reconciliation#111
EMaher wants to merge 4 commits into
mainfrom
emaher/fix-strip-schema-refs-in-operation-recon

Conversation

@EMaher
Copy link
Copy Markdown
Contributor

@EMaher EMaher commented Jun 5, 2026

Summary

Fixes the integration test failure in the "Round-Trip Phase 6 (Compare)" step where createItem operation on src-rest-openapi reports:

MISSING in target: properties.request.representations.schemaId
MISSING in target: properties.request.representations.typeName

Root Cause

After spec import, APIM assigns its own auto-generated schema IDs to operation request/response representations. The reconcileOperationsAfterSpecImport PATCH was sending the source instance's schema IDs (extracted from source APIM), which don't exist on the target instance. APIM silently drops schemaId/typeName when the referenced schema doesn't exist, resulting in the target having no schema references at all.

Fix

Strip schemaId and typeName from representation objects in request and responses before sending the reconciliation PATCH. This lets APIM retain the schema references it assigned during its own spec import. The compare script already normalizes auto-generated hex IDs to {{auto-id}}, so both source and target will match.

Related Issue(s)

Fixes workflow run: https://github.com/Azure/apiops-cli/actions/runs/27042790153/job/79822373426

After spec import, APIM assigns its own auto-generated schema IDs to
operation request/response representations. The reconciliation PATCH was
sending the source instance's schema IDs, which don't exist on the target.
APIM silently drops schemaId/typeName when the referenced schema doesn't
exist, causing the compare phase to report missing fields.

By stripping these fields from the PATCH body, APIM retains the schema
references it assigned during its own spec import. The compare script
already normalizes auto-generated hex IDs, so both sides match.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@EMaher
Copy link
Copy Markdown
Contributor Author

EMaher commented Jun 5, 2026

@copilot - Make comments in comments in the changes more terse. Safe the decision/information to necessary squad members.

Copy link
Copy Markdown
Contributor

Copilot AI commented Jun 5, 2026

@copilot - Make comments in comments in the changes more terse. Safe the decision/information to necessary squad members.

Updated in 37babf0 with terser comments in /tmp/workspace/Azure/apiops-cli/src/services/api-publisher.ts, while keeping the key rationale concise and maintainable.

Copilot finished work on behalf of EMaher June 5, 2026 23:15
@EMaher
Copy link
Copy Markdown
Contributor Author

EMaher commented Jun 5, 2026

@copilot - but you did not update any squad files!

Copy link
Copy Markdown
Contributor

Copilot AI commented Jun 5, 2026

@copilot - but you did not update any squad files!

Updated in 20c8eb9. Added the reconciliation decision to /tmp/workspace/Azure/apiops-cli/.squad/decisions.md.

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.

3 participants