fork of hey-api/openapi-ts because I need some additional things
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

test: add schema name transform test spec and integration test

Co-authored-by: mrlubos <12529395+mrlubos@users.noreply.github.com>

+94 -1
-1
.github/workflows/pullfrog.yml
··· 43 43 GROQ_API_KEY: ${{ secrets.GROQ_API_KEY }} 44 44 DEEPSEEK_API_KEY: ${{ secrets.DEEPSEEK_API_KEY }} 45 45 OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }} 46 -
+24
packages/openapi-ts-tests/main/test/3.0.x.test.ts
··· 592 592 }, 593 593 { 594 594 config: createConfig({ 595 + input: 'transforms-schemas-name.yaml', 596 + output: 'transforms-schemas-name', 597 + parser: { 598 + transforms: { 599 + schemas: { 600 + name: (name: string) => { 601 + // Strip version markers: User_v1_0_0_User → User 602 + let clean = name.replace(/([A-Za-z\d]+)_v\d+_\d+_\d+_([A-Za-z\d]*)/g, (_, p1, p2) => 603 + p2.startsWith(p1) ? p2 : p1 + p2, 604 + ); 605 + // Deduplicate prefixes: Foo_Foo → Foo 606 + const m = clean.match(/^([A-Za-z\d]+)_\1([A-Za-z\d]*)$/); 607 + if (m) clean = m[1] + m[2]; 608 + return clean; 609 + }, 610 + }, 611 + }, 612 + }, 613 + plugins: ['@hey-api/typescript'], 614 + }), 615 + description: 'handles schema name transforms', 616 + }, 617 + { 618 + config: createConfig({ 595 619 input: 'security-api-key.yaml', 596 620 output: 'security-api-key', 597 621 plugins: [
+70
specs/3.0.x/transforms-schemas-name.yaml
··· 1 + openapi: 3.0.3 2 + info: 3 + title: Schema Name Transform Test 4 + version: 1.0.0 5 + paths: 6 + /users: 7 + get: 8 + summary: Get users 9 + responses: 10 + '200': 11 + description: Success 12 + content: 13 + application/json: 14 + schema: 15 + $ref: '#/components/schemas/User_v1_0_0_User' 16 + /posts: 17 + post: 18 + summary: Create post 19 + requestBody: 20 + content: 21 + application/json: 22 + schema: 23 + $ref: '#/components/schemas/Post_v2_1_3_Post' 24 + responses: 25 + '201': 26 + description: Created 27 + content: 28 + application/json: 29 + schema: 30 + $ref: '#/components/schemas/Post_v2_1_3_Post' 31 + components: 32 + schemas: 33 + User_v1_0_0_User: 34 + type: object 35 + properties: 36 + id: 37 + type: string 38 + name: 39 + type: string 40 + profile: 41 + $ref: '#/components/schemas/UserProfile_v1_0_0_UserProfile' 42 + UserProfile_v1_0_0_UserProfile: 43 + type: object 44 + properties: 45 + bio: 46 + type: string 47 + avatar: 48 + type: string 49 + Post_v2_1_3_Post: 50 + type: object 51 + properties: 52 + id: 53 + type: string 54 + title: 55 + type: string 56 + author: 57 + $ref: '#/components/schemas/User_v1_0_0_User' 58 + comments: 59 + type: array 60 + items: 61 + $ref: '#/components/schemas/Comment_v1_5_2_Comment' 62 + Comment_v1_5_2_Comment: 63 + type: object 64 + properties: 65 + id: 66 + type: string 67 + text: 68 + type: string 69 + author: 70 + $ref: '#/components/schemas/User_v1_0_0_User'