diff --git a/lib/modules/datasource/azure-bicep-resource/index.spec.ts b/lib/modules/datasource/azure-bicep-resource/index.spec.ts index 7b724443f29d86fb366b4cfaf2ccff15a2648858..4afbff7d53e9ee7d32a41e77f09fe78eb672bd7f 100644 --- a/lib/modules/datasource/azure-bicep-resource/index.spec.ts +++ b/lib/modules/datasource/azure-bicep-resource/index.spec.ts @@ -14,8 +14,8 @@ describe('modules/datasource/azure-bicep-resource/index', () => { 200, codeBlock` { - "Resources": {}, - "Functions": {} + "resources": {}, + "resourceFunctions": {} } `, ); @@ -36,19 +36,17 @@ describe('modules/datasource/azure-bicep-resource/index', () => { 200, codeBlock` { - "Resources": {}, - "Functions": { + "resources": {}, + "resourceFunctions": { "microsoft.billing/billingaccounts": { "2019-10-01-preview": [ { - "RelativePath": "billing/microsoft.billing/2019-10-01-preview/types.json", - "Index": 307 + "$ref": "billing/microsoft.billing/2019-10-01-preview/types.json#/304" } ], "2020-05-01": [ { - "RelativePath": "billing/microsoft.billing/2020-05-01/types.json", - "Index": 287 + "$ref": "billing/microsoft.billing/2020-05-01/types.json#/287" } ] } @@ -86,17 +84,15 @@ describe('modules/datasource/azure-bicep-resource/index', () => { 200, codeBlock` { - "Resources": { + "resources": { "Microsoft.Storage/storageAccounts@2015-05-01-preview": { - "RelativePath": "storage/microsoft.storage/2015-05-01-preview/types.json", - "Index": 31 + "$ref": "storage/microsoft.storage/2015-05-01-preview/types.json#/31" }, "Microsoft.Storage/storageAccounts@2018-02-01": { - "RelativePath": "storage/microsoft.storage/2018-02-01/types.json", - "Index": 85 + "$ref": "storage/microsoft.storage/2018-02-01/types.json#/85" } }, - "Functions": {} + "resourceFunctions": {} } `, ); diff --git a/lib/modules/datasource/azure-bicep-resource/schema.ts b/lib/modules/datasource/azure-bicep-resource/schema.ts index 9c0b94ed1b2726bc024de19054e9b6f7a80e7574..70dd2938f54f03fe65f7771817144eec52a6eaac 100644 --- a/lib/modules/datasource/azure-bicep-resource/schema.ts +++ b/lib/modules/datasource/azure-bicep-resource/schema.ts @@ -2,37 +2,20 @@ import { z } from 'zod'; export const BicepResourceVersionIndex = z .object({ - Resources: z.record( - z.string(), - z.object({ - RelativePath: z.string(), - Index: z.number(), - }), - ), - Functions: z.record( - z.string(), - z.record( - z.string(), - z.array( - z.object({ - RelativePath: z.string(), - Index: z.number(), - }), - ), - ), - ), + resources: z.record(z.string(), z.unknown()), + resourceFunctions: z.record(z.string(), z.record(z.string(), z.unknown())), }) - .transform(({ Resources, Functions }) => { + .transform(({ resources, resourceFunctions }) => { const releaseMap = new Map<string, string[]>(); - for (const resourceReference of Object.keys(Resources)) { + for (const resourceReference of Object.keys(resources)) { const [type, version] = resourceReference.toLowerCase().split('@', 2); const versions = releaseMap.get(type) ?? []; versions.push(version); releaseMap.set(type, versions); } - for (const [type, versionMap] of Object.entries(Functions)) { + for (const [type, versionMap] of Object.entries(resourceFunctions)) { const versions = Object.keys(versionMap); releaseMap.set(type, versions); }