8000 Review of codegen imports and package name mangling by fredbi · Pull Request #2181 · go-swagger/go-swagger · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Review of codegen imports and package name mangling #2181

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 26, 2020

Conversation

fredbi
Copy link
Contributor
@fredbi fredbi commented Jan 16, 2020

NOTE: Lean on previous preliminary refactoring work from PRs #2177 and #2173

  • removed redundant code generation code regarding imports (and let goimport sort it out)

  • refactored imports in templates: imports are maps, codegen uses a language-specific funcmap

  • mangle tag-based package names to safe names and use package aliasing

  • introduced CLI option to disable tag-based package generation for operations

  • introduced CLI option to override main server package location

  • introduced x-go-operation-tag to alter tag-based package generation

  • made global tag definition honor the x-go-name tag to alter tag-based package generation

  • propagated changes to stratoscale contrib templates

Issues fixes:

TODO: name aliasing and mangling for imported models remains to be done

Signed-off-by: Frederic BIDON fredbi@yahoo.com

@codecov
Copy link
codecov bot commented Jan 16, 2020

Codecov Report

Merging #2181 into master will increase coverage by 0.13%.
The diff coverage is 92.88%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2181      +/-   ##
==========================================
+ Coverage   81.13%   81.27%   +0.13%     
==========================================
  Files          50       50              
  Lines        8326     8388      +62     
==========================================
+ Hits         6755     6817      +62     
- Misses       1074     1076       +2     
+ Partials      497      495       -2
Impacted Files Coverage Δ
generator/template_repo.go 93.95% <ø> (+0.6%) ⬆️
generator/types.go 91.56% <ø> (ø) ⬆️
generator/structs.go 77.67% <ø> (ø) ⬆️
cmd/swagger/commands/generate/server.go 100% <100%> (ø) ⬆️
generator/model.go 84.6% <100%> (ø) ⬆️
generator/operation.go 93.49% <100%> (+0.43%) ⬆️
cmd/swagger/commands/generate/operation.go 100% <100%> (ø) ⬆️
generator/client.go 79.31% <40%> (ø) ⬆️
generator/language.go 83.71% <82.75%> (-0.32%) ⬇️
generator/shared.go 88.52% <90.69%> (+0.16%) ⬆️
... and 3 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 68f0951...bbca7c7. Read the comment docs.

@fredbi fredbi changed the title Fix 2111 Review of codegen imports and package name mangling Jan 26, 2020
@fredbi fredbi marked this pull request as ready for review January 26, 2020 19:03
Signed-off-by: Frederic BIDON <fredbi@yahoo.com>
* removed redundant code generation code regarding imports (and  let goimport sort it out)
* refactored imports in templates: imports are maps, codegen uses a language-specific funcmap

* mangle tag-based package names to safe names and use package aliasing

* introduced CLI option to disable tag-based package generation for operations
* introduced CLI option to override main server package location

* introduced x-go-operation-tag to alter tag-based package generation
* made global tag definition honor the x-go-name tag to alter tag-based package generation

* propagated changes to stratoscale contrib templates

Issues fixes:
* fixes go-swagger#1049 (tag override)
* fixes go-swagger#2111 (tag mangling)
* fixes go-swagger#2057 (tag mangling)
* fixes go-swagger#1291 (tag mangling)
* fixes go-swagger#1971 (main package mangling & main target override)

TODO: name aliasing and mangling for imported models remains to be done

Signed-off-by: Frederic BIDON <fredbi@yahoo.com>
Signed-off-by: Frederic BIDON <fredbi@yahoo.com>
@fredbi fredbi merged commit b999673 into go-swagger:master Jan 26, 2020
@fredbi fredbi deleted the fix-2111 branch January 26, 2020 21:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants
0