Problem
Orval's current output.clean behavior can be surprising when users generate into prepared package folders.
Observed behavior:
- Default behavior: Orval merges into target/schema folders and preserves unrelated files.
- Stale generated files may remain if tag filters shrink or generated paths change.
- With
output.clean: true, Orval removes files in configured target/schema folders, including sentinel/package files.
This is risky when target or schemas points at a package entrypoint root containing files such as:
ng-package.json
package.json
public-api.ts
Documentation suggestion
Document clearly that users should not point target or schemas directly at a package entrypoint root if that root contains prepared files that should not be deleted.
The docs should explain that output.clean: true cleans the configured output folders, not only files generated by Orval.
Potential API improvement
Support generated-only cleanup:
output: {
clean: {
generatedOnly: true,
},
}
Alternative approach:
- Generate a manifest file containing files emitted by the previous run.
- On the next run, clean only files listed in the previous manifest.
- Write a new manifest after generation.
Expected behavior
With generated-only cleanup enabled:
- Stale generated files from previous Orval runs are removed.
- Non-generated files such as
package.json, ng-package.json, and public-api.ts are preserved.
- Users can safely generate into package-oriented folders without risking sentinel files.
Why this helps
- Avoids accidental deletion of package metadata.
- Reduces stale generated files when filters or tags change.
- Makes Orval safer for monorepos and package secondary entrypoints.
Problem
Orval's current
output.cleanbehavior can be surprising when users generate into prepared package folders.Observed behavior:
output.clean: true, Orval removes files in configured target/schema folders, including sentinel/package files.This is risky when
targetorschemaspoints at a package entrypoint root containing files such as:Documentation suggestion
Document clearly that users should not point
targetorschemasdirectly at a package entrypoint root if that root contains prepared files that should not be deleted.The docs should explain that
output.clean: truecleans the configured output folders, not only files generated by Orval.Potential API improvement
Support generated-only cleanup:
Alternative approach:
Expected behavior
With generated-only cleanup enabled:
package.json,ng-package.json, andpublic-api.tsare preserved.Why this helps