MCPcopy Index your code
hub / github.com/oapi-codegen/oapi-codegen / newConfigFromOldConfig

Function newConfigFromOldConfig

cmd/oapi-codegen/oapi-codegen.go:554–587  ·  view source on GitHub ↗
(c oldConfiguration)

Source from the content-addressed store, hash-verified

552}
553
554func 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}

Callers 1

mainFunction · 0.85

Calls 3

updateOldConfigFromFlagsFunction · 0.85
generationTargetsFunction · 0.85
loadTemplateOverridesFunction · 0.85

Tested by

no test coverage detected