You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, when Orval generates code, it automatically exports everything from the generated index.ts file. There's no way to:
Filter out specific exports (e.g., schemas)
Append custom exports from other files
Control what gets exported from the generated index.ts
Use Case
In our project, we need to:
Exclude schema exports from the generated index.ts file to avoid polluting the public API
Append exports from our custom files to the generated index.ts
Have more granular control over what gets exported from the generated code
Current Behavior
The generated index.ts automatically exports everything:
export*from'./schemas';export*from'./endpoints';// ... other exports
Desired Behavior
Ability to configure exports in orval.config.js:
module.exports={myApi: {output: {// ... other configindexFiles(statements){// note that this is merely an idea, I guess it should be more "precise"constexports=statementes.filter((name)=>name!=="./schemas")exports.push("./custom-files")returnexports;}}}}
Benefits
Better control over the public API surface
Ability to keep schemas internal when needed
Easier integration with custom code
More flexible code organization
Additional Context
This would be particularly useful for larger projects especially when we generate multiple clients at once, we use package json exports to separate msw, axios, react, and zod client and I want to expose the schemas from one entry only (instead of all of them)
Further more I have custom zod schemas generated on top of orval's output (using the extraFiles feature) and would like to export them from the generated client (automatically)
Possible Implementation Approaches
Add an exports configuration option in the output config
Support glob patterns for include/exclude
Allow specifying additional files to export from
Would love to hear thoughts on the best approach to implement this!
The text was updated successfully, but these errors were encountered:
Description
Currently, when Orval generates code, it automatically exports everything from the generated index.ts file. There's no way to:
Use Case
In our project, we need to:
Current Behavior
The generated index.ts automatically exports everything:
Desired Behavior
Ability to configure exports in orval.config.js:
Benefits
Additional Context
This would be particularly useful for larger projects especially when we generate multiple clients at once, we use package json exports to separate msw, axios, react, and zod client and I want to expose the schemas from one entry only (instead of all of them)
Further more I have custom zod schemas generated on top of orval's output (using the extraFiles feature) and would like to export them from the generated client (automatically)
Possible Implementation Approaches
exports
configuration option in the output configWould love to hear thoughts on the best approach to implement this!
The text was updated successfully, but these errors were encountered: