(c oldConfiguration)
| 552 | } |
| 553 | |
| 554 | func newConfigFromOldConfig(c oldConfiguration) (configuration, error) { |
| 555 | // Take flags into account. |
| 556 | cfg := updateOldConfigFromFlags(c) |
| 557 | |
| 558 | // Now, copy over field by field, translating flags and old values as |
| 559 | // necessary. |
| 560 | opts := codegen.Configuration{ |
| 561 | PackageName: cfg.PackageName, |
| 562 | } |
| 563 | opts.OutputOptions.ResponseTypeSuffix = flagResponseTypeSuffix |
| 564 | |
| 565 | if err := generationTargets(&opts, cfg.GenerateTargets); err != nil { |
| 566 | return configuration{}, fmt.Errorf("generation targets: %w", err) |
| 567 | } |
| 568 | |
| 569 | opts.OutputOptions.IncludeTags = cfg.IncludeTags |
| 570 | opts.OutputOptions.ExcludeTags = cfg.ExcludeTags |
| 571 | opts.OutputOptions.ExcludeSchemas = cfg.ExcludeSchemas |
| 572 | |
| 573 | templates, err := loadTemplateOverrides(cfg.TemplatesDir) |
| 574 | if err != nil { |
| 575 | return configuration{}, fmt.Errorf("loading template overrides: %w", err) |
| 576 | } |
| 577 | opts.OutputOptions.UserTemplates = templates |
| 578 | |
| 579 | opts.ImportMapping = cfg.ImportMapping |
| 580 | |
| 581 | opts.Compatibility = cfg.Compatibility |
| 582 | |
| 583 | return configuration{ |
| 584 | Configuration: opts, |
| 585 | OutputFile: cfg.OutputFile, |
| 586 | }, nil |
| 587 | } |
no test coverage detected