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
feat: add response flattening feature to OpenAPI transformation
- Introduced a new flag to enable flattening of oneOf/anyOf/allOf schemas after pagination processing.
- Implemented the struct and struct to manage flattening configurations and results.
- Added and functions to handle the flattening logic across multiple files.
- Enhanced the function to support dry-run mode for pagination and flattening.
- Updated the configuration struct to include and modified the root command to accept the new flag.
- Added detailed logging for flattening results, including processed files and flattened references.
- Created unit tests to validate the flattening functionality for various scenarios, including single and multiple references.
**Note:** In dry-run mode, transformations (pagination and response flattening) are previewed independently based on the original file. In actual execution, they are applied sequentially, so later steps may show different results. Use `--interactive` mode to see the exact cumulative effects of all transformations.
129
+
123
130
### Example: Interactive Review (TUI)
124
131
125
132
```sh
@@ -277,6 +284,7 @@ When pagination priority is configured, OpenMorph:
277
284
This project uses automated release management with package managers support. See the [Auto-Release Guide](AUTO_RELEASE_GUIDE.md) for complete setup instructions.
rootCmd.PersistentFlags().BoolVar(&dryRun, "dry-run", false, "Show what would change without writing files")
428
+
rootCmd.PersistentFlags().BoolVar(&dryRun, "dry-run", false, "Show what would change without writing files (Note: multi-step transformations shown independently, use --interactive for cumulative preview)")
303
429
rootCmd.PersistentFlags().BoolVar(&backup, "backup", false, "Save a .bak copy before overwriting")
304
430
rootCmd.PersistentFlags().StringArrayVar(&exclude, "exclude", nil, "Keys to exclude from transformation (repeatable)")
305
431
rootCmd.PersistentFlags().BoolVar(&validate, "validate", false, "Run swagger-cli validate after transforming")
306
432
rootCmd.PersistentFlags().BoolVar(&interactive, "interactive", false, "Launch a TUI for interactive preview and approval")
307
433
rootCmd.PersistentFlags().BoolVar(&noConfig, "no-config", false, "Ignore all config files and use only CLI flags")
308
434
rootCmd.PersistentFlags().StringVar(&paginationPriorityStr, "pagination-priority", "", "Pagination strategy priority order (e.g., checkpoint,offset,page,cursor,none)")
435
+
rootCmd.PersistentFlags().BoolVar(&flattenResponses, "flatten-responses", false, "Flatten oneOf/anyOf/allOf with single $ref after pagination processing")
0 commit comments