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.

Merge pull request #2623 from hey-api/fix/config-parser-hooks

fix(config): correctly load user-defined hooks

authored by

Lubos and committed by
GitHub
0cb4db61 a82ba4d2

+23 -2
+5
.changeset/odd-fireants-lay.md
··· 1 + --- 2 + '@hey-api/openapi-ts': patch 3 + --- 4 + 5 + fix(config): correctly load user-defined hooks
+14 -2
packages/openapi-ts-tests/main/test/openapi-ts.config.ts
··· 36 36 '3.1.x', 37 37 // 'invalid', 38 38 // 'openai.yaml', 39 - // 'full.yaml', 39 + 'full.yaml', 40 40 // 'opencode.yaml', 41 - 'sdk-instance.yaml', 41 + // 'sdk-instance.yaml', 42 42 // 'validators-circular-ref-2.yaml', 43 43 // 'zoom-video-sdk.json', 44 44 ), ··· 98 98 }, 99 99 hooks: { 100 100 operations: { 101 + getKind() { 102 + // noop 103 + }, 104 + isMutation() { 105 + // noop 106 + }, 101 107 isQuery: (op) => { 102 108 if (op.method === 'post' && op.path === '/search') { 103 109 return true; ··· 226 232 return ['query']; 227 233 } 228 234 return undefined; 235 + }, 236 + isMutation() { 237 + // noop 238 + }, 239 + isQuery: () => { 240 + // noop 229 241 }, 230 242 }, 231 243 },
+4
packages/openapi-ts/src/config/parser.ts
··· 40 40 }; 41 41 42 42 if (userConfig.parser) { 43 + if (userConfig.parser.hooks) { 44 + parser.hooks = userConfig.parser.hooks; 45 + } 46 + 43 47 if (userConfig.parser.pagination?.keywords) { 44 48 parser.pagination.keywords = userConfig.parser.pagination.keywords; 45 49 }