Repository navigation
fix: strip source-service tagId from ApiTagDescription PUT payloads - #313
Merged
Alexander Zaslonov (azaslonov) merged 2 commits intoOct 10, 2026
Conversation
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The tests do not verify that publishResource applies the transformation to the outgoing payload.
Review effort: Balanced
Findings: 1
Open (1)
What changed in this PR
Strips source-service tagId values from API tag-description PUT payloads.
Changes:
- Adds and wires
stripTagDescriptionTagId. - Adds unit tests for transformation behavior.
| File | Description |
|---|---|
src/services/resource-publisher.ts |
Removes properties.tagId before publishing tag descriptions. |
tests/unit/services/resource-publisher.test.ts |
Tests the new payload helper. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Extracted tagDescriptionInformation.json carries properties.tagId with the full ARM path of the SOURCE service's tag. Newer APIM api-versions validate ARM references in PUT bodies and reject cross-service publishes with "Cross-service resource references are not allowed". tagId is response-only per the ARM contract (the tag is identified by the request URL), so drop it before PUT. Same bug family as the top-level id / diagnostic loggerId fixes. Closes Azure#312
Aleksey Zheltov (Alexey-Zheltov)
force-pushed
the
fix/tagdescription-strip-tagid
branch
from
October 5, 2026 12:38
e1205d5 to
2a40bc2
Compare
Aleksey Zheltov (Alexey-Zheltov)
added a commit
to Alexey-Zheltov/apiops-cli
that referenced
this pull request
Oct 9, 2026
Addresses review feedback on Azure#313: the helper-level tests alone would not catch a broken or mistyped dispatch condition in publishResource. The new test drives publishResource with an ApiTagDescription descriptor and asserts the payload handed to client.putResource carries no properties.tagId. Fix verified against a live APIM instance: cross-service publish of an API with three tag descriptions succeeded and APIM re-derived tagId against the target service.
Addresses review feedback on Azure#313: the helper-level tests alone would not catch a broken or mistyped dispatch condition in publishResource. The new test drives publishResource with an ApiTagDescription descriptor and asserts the payload handed to client.putResource carries no properties.tagId. Fix verified against a live APIM instance: cross-service publish of an API with three tag descriptions succeeded and APIM re-derived tagId against the target service.
Aleksey Zheltov (Alexey-Zheltov)
force-pushed
the
fix/tagdescription-strip-tagid
branch
from
October 9, 2026 18:46
a28034c to
c45c0f5
Compare
Tuan Nguyen (atuannguyen1101)
approved these changes
Oct 9, 2026
Tuan Nguyen (atuannguyen1101)
approved these changes
Oct 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Summary
Cross-service publish fails on every
ApiTagDescriptionwith HTTP 400ValidationError: Cross-service resource references are not allowed. ExtractedtagDescriptionInformation.jsoncarriesproperties.tagIdwith the full ARM path of the source service's tag, and the publisher sent the body verbatim; newer APIM api-versions validate ARM references in PUT bodies.Per the ARM contract (
TagDescriptionCreateParameters),tagIdis response-only — the tag is identified by the request URL (.../apis/{apiId}/tagDescriptions/{tagDescriptionId}) — so this PR strips it from the PUT payload. Same bug family as #285 (top-levelid, diagnosticloggerId), which missed this field.Changes
src/services/resource-publisher.ts: newstripTagDescriptionTagId()droppingproperties.tagId; wired intopublishResourceforResourceType.ApiTagDescriptiontests/unit/services/resource-publisher.test.ts: 3 unit tests (strips source-service tagId while keeping other properties; no-op when tagId or properties absent)Related Issue(s)
Closes #312
Testing
npx vitest run tests/unit/services/resource-publisher.test.ts— 84/84 passedapitagdescriptionPUTs were the only remaining cross-service failuresCode Review
Code review requested per repository ceremony (changes under
src/andtests/).