help wanted
Metriche repository
- Star
- (6272 stelle)
- Metriche merge PR
- (Metriche PR in attesa)
Descrizione
Description
I think we should improve performance. Config like this:
import { defineConfig } from 'orval';
import { execSync } from 'child_process';
const header = ({ title, description, version }) => [
'Generated by orval 🍺',
'Do not edit manually.',
...(title ? [title] : []),
...(description ? [description] : []),
...(version ? [`OpenAPI spec version: ${version}`] : []),
];
export default defineConfig({
main: {
input: 'https://.../schema/openapi.json',
output: {
schemas: 'projects/api/src/lib/main/schemas',
target: 'projects/api/src/lib/main/target',
client: 'angular-query',
httpClient: 'angular',
mode: 'tags',
clean: true,
override: {
header,
useTypeOverInterfaces: false,
},
},
hooks: {
afterAllFilesWrite: (paths) => {
console.log('Running lint fix and patching generated files...');
execSync(`bun scripts/fix-orval-params.ts ${paths.join(' ')}`);
execSync(`bun run prettier --write ${paths.join(' ')}`);
execSync(`bun run eslint --fix ${paths.join(' ')}`);
},
},
},
allauth1: {
input: 'https://.../api/openapi.json',
output: {
schemas: 'projects/api/src/lib/allauth1/schemas',
target: 'projects/api/src/lib/allauth1/target',
client: 'angular-query',
httpClient: 'angular',
mode: 'tags',
clean: true,
override: {
header,
useTypeOverInterfaces: false,
},
},
hooks: {
afterAllFilesWrite: (paths) => {
console.log('Running lint fix and patching generated files...');
execSync(`bun scripts/fix-orval-params.ts ${paths.join(' ')}`);
execSync(`bun run prettier --write ${paths.join(' ')}`);
execSync(`bun run eslint --fix ${paths.join(' ')}`);
},
},
},
allauth2: {
input: 'https://.../api/v2/openapi.json',
output: {
schemas: 'projects/api/src/lib/allauth2/schemas',
target: 'projects/api/src/lib/allauth2/target',
client: 'angular-query',
httpClient: 'angular',
mode: 'tags',
clean: true,
override: {
header,
useTypeOverInterfaces: false,
},
},
hooks: {
afterAllFilesWrite: (paths) => {
console.log('Running lint fix and patching generated files...');
execSync(`bun scripts/fix-orval-params.ts ${paths.join(' ')}`);
execSync(`bun run prettier --write ${paths.join(' ')}`);
execSync(`bun run eslint --fix ${paths.join(' ')}`);
},
},
},
});
usually takes omething like 20 seconds. I expect something like 500ms in those cases. Shemas are not that big to take so much time ...
I double checked it with ai and there is a slow part in codegen ...
Current behavior
Generation usually takes around 20 seconds which seems to me too much. My schemas are not that large...
Proposed behavior
I expect time in milliseconds not in seconds ...
Proposed solution
Focus on bottlenecks in the codebase asn measure it and add performance becnhmarks in readme etc...