diff --git a/lib/modules/datasource/custom/index.spec.ts b/lib/modules/datasource/custom/index.spec.ts index 5b997fa68990d4..2d997c6b30eaab 100644 --- a/lib/modules/datasource/custom/index.spec.ts +++ b/lib/modules/datasource/custom/index.spec.ts @@ -119,6 +119,49 @@ describe('modules/datasource/custom/index', () => { expect(result).toEqual(expected); }); + it('return releases with tags and other optional fields for api directly exposing in renovate format', async () => { + const expected = { + releases: [ + { + version: 'v1.0.0', + }, + ], + tags: { + latest: 'v1.0.0', + }, + sourceUrl: 'https://example.com/foo.git', + sourceDirectory: '/', + changelogUrl: 'https://example.com/foo/blob/main/CHANGELOG.md', + homepage: 'https://example.com/foo', + }; + const content = { + releases: [ + { + version: 'v1.0.0', + }, + ], + tags: { + latest: 'v1.0.0', + }, + sourceUrl: 'https://example.com/foo.git', + sourceDirectory: '/', + changelogUrl: 'https://example.com/foo/blob/main/CHANGELOG.md', + homepage: 'https://example.com/foo', + unknown: {}, + }; + httpMock.scope('https://example.com').get('/v1').reply(200, content); + const result = await getPkgReleases({ + datasource: `${CustomDatasource.id}.foo`, + packageName: 'myPackage', + customDatasources: { + foo: { + defaultRegistryUrlTemplate: 'https://example.com/v1', + }, + }, + }); + expect(result).toEqual(expected); + }); + it('return releases for plain text API directly exposing in Renovate format', async () => { const expected = { releases: [ diff --git a/lib/modules/datasource/custom/schema.ts b/lib/modules/datasource/custom/schema.ts index 532d44b5a18b4b..58a1df4f0ec30e 100644 --- a/lib/modules/datasource/custom/schema.ts +++ b/lib/modules/datasource/custom/schema.ts @@ -20,6 +20,7 @@ export const ReleaseResultZodSchema = z.object({ }; }), ), + tags: z.record(z.string(), z.string()).optional(), sourceUrl: z.string().optional(), sourceDirectory: z.string().optional(), changelogUrl: z.string().optional(),