|
1 | 1 | import fs from 'node:fs'; |
2 | 2 | import path from 'node:path'; |
3 | | -import { fileURLToPath, pathToFileURL } from 'node:url'; |
| 3 | +import { fileURLToPath } from 'node:url'; |
4 | 4 |
|
5 | 5 | import { createClient, type UserConfig } from '@hey-api/openapi-ts'; |
6 | 6 |
|
@@ -904,15 +904,6 @@ describe(`OpenAPI ${version}`, () => { |
904 | 904 | }), |
905 | 905 | description: 'transforms additionalProperties map values', |
906 | 906 | }, |
907 | | - { |
908 | | - config: createConfig({ |
909 | | - input: 'transformers-additional-properties-declared.json', |
910 | | - output: 'transformers-additional-properties-declared', |
911 | | - plugins: ['@hey-api/client-fetch', '@hey-api/transformers'], |
912 | | - }), |
913 | | - description: |
914 | | - 'transforms additionalProperties map values without touching declared properties', |
915 | | - }, |
916 | 907 | { |
917 | 908 | config: createConfig({ |
918 | 909 | input: 'transformers-recursive.json', |
@@ -1050,36 +1041,6 @@ describe(`OpenAPI ${version}`, () => { |
1050 | 1041 | }, |
1051 | 1042 | ]; |
1052 | 1043 |
|
1053 | | - it('does not apply additionalProperties transform to declared object keys', async () => { |
1054 | | - const config = createConfig({ |
1055 | | - input: 'transformers-additional-properties-declared.json', |
1056 | | - output: 'transformers-additional-properties-declared', |
1057 | | - plugins: ['@hey-api/client-fetch', '@hey-api/transformers'], |
1058 | | - }); |
1059 | | - |
1060 | | - await createClient(config); |
1061 | | - |
1062 | | - const transformersFilePath = path.join(config.output.path, 'transformers.gen.ts'); |
1063 | | - const transformersModule = await import( |
1064 | | - `${pathToFileURL(transformersFilePath).href}?t=${Date.now()}` |
1065 | | - ); |
1066 | | - |
1067 | | - const data = { |
1068 | | - items: { |
1069 | | - createdAt: '2026-01-01T00:00:00.000Z', |
1070 | | - meta: 'not-a-date', |
1071 | | - }, |
1072 | | - }; |
1073 | | - |
1074 | | - const transformed = await transformersModule.modelMapWithDeclaredResponseTransformer( |
1075 | | - structuredClone(data), |
1076 | | - ); |
1077 | | - |
1078 | | - expect(transformed.items.createdAt).toBeInstanceOf(Date); |
1079 | | - expect(typeof transformed.items.meta).toBe('string'); |
1080 | | - expect(transformed.items.meta).toBe('not-a-date'); |
1081 | | - }); |
1082 | | - |
1083 | 1044 | it.each(scenarios)('$description', async ({ config }) => { |
1084 | 1045 | await createClient(config); |
1085 | 1046 |
|
|
0 commit comments