fizz icon indicating copy to clipboard operation
fizz copied to clipboard

Duplicated types error handling

Open lukap3 opened this issue 3 years ago • 3 comments

Defining N>1 different types with the same name and generating a schema using them results in the last type "overriding" the rest without any error/warning.

There is a simple solution: using UseFullSchemaNames(true) adds the package name as a prefix which should resolve the conflict (except in cases where the package name is also the same)

However, the issue remains: there is no error for these conflicts and it can result in incorrect schemas being generated without the user's knowledge.

This PR adds an error to the generator for cases when multiple types defined with the same name (even when using full schema names)

lukap3 avatar Oct 06 '22 11:10 lukap3

Codecov Report

Merging #91 (1ea0568) into master (fe54d35) will increase coverage by 0.02%. The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master      #91      +/-   ##
==========================================
+ Coverage   94.37%   94.40%   +0.02%     
==========================================
  Files           7        7              
  Lines         978      983       +5     
==========================================
+ Hits          923      928       +5     
  Misses         39       39              
  Partials       16       16              
Impacted Files Coverage Δ
openapi/generator.go 93.98% <100.00%> (+0.04%) :arrow_up:

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

codecov[bot] avatar Oct 07 '22 07:10 codecov[bot]

@lukap3 Need a rebase.

wI2L avatar Oct 12 '22 15:10 wI2L

@wI2L done! thanks

lukap3 avatar Oct 12 '22 15:10 lukap3