Skip to content

Commit e7387d0

Browse files
authored
Document logger credential token normalization
1 parent 4cb0fa3 commit e7387d0

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

src/services/resource-publisher.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,13 @@ function isAutoGeneratedProductSubscription(
530530
return scope.includes('/products/');
531531
}
532532

533+
/**
534+
* Normalize logger credential named value placeholders to canonical NamedValue names.
535+
*
536+
* APIM resolves logger credential references using {{namedValueName}} tokens.
537+
* If an override supplies a token with different casing, APIM may reject the PUT
538+
* with a validation error. This function rewrites tokens to match artifact names.
539+
*/
533540
async function normalizeLoggerCredentialNamedValueReferences(
534541
json: Record<string, unknown>,
535542
store: IArtifactStore,
@@ -555,6 +562,9 @@ async function normalizeLoggerCredentialNamedValueReferences(
555562
return json;
556563
}
557564

565+
// Traverse logger credentials recursively because APIM logger credential shapes
566+
// vary by logger type (strings, nested objects, and arrays). Normalize every
567+
// {{named-value-token}} to the canonical artifact name when found.
558568
const normalizeValue = (value: unknown): unknown => {
559569
if (typeof value === 'string') {
560570
return value.replace(/\{\{\s*([^}]+?)\s*\}\}/g, (match, tokenName: string) => {

0 commit comments

Comments
 (0)