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
If two different endpoints define the same variable for a type only one type is represented in the schema.
I know this was the secondary issue described here, but this is the issue giving me the runaround today.
Hypothetical example that follows the structure of what I'm trying to accomplish:
Upon further reading of the initial issue, the whole description is actually what I'm experiencing so I'll truncate my initial restating of the problem.
My thoughts on some potential solutions:
just roll a simple iterator when collision happens CollidingType_{n} for all collisions
feels like conceptually the wrong solution, more like a workaround that might result in bad side-effects
hash/obfuscate the resolved module path and prefix type with it
more closely aligns tsoa to how TS handles this sort of same name resolution
however, pretty complex approach
Ultimately I think if I had been presented with a warning or error that the collision occurred, just that would have been acceptable. Changing the variable name for the type was trivial, but it was trying to find out where the erasure of the second type was coming from that took time.
Any chance of a config option to opt into a 'strict no collisions' mode?
Sorting
I'm submitting a ...
I confirm that I
Expected Behavior
All types are generated separate from each other. No field collision
Current Behavior
Types are colliding and adding fields to other types or overriding types with the same variable name
Types written like:
results in a schema like:
ALSO
If two different endpoints define the same variable for a type only one type is represented in the schema.
Steps to Reproduce
I made a repository with similar settings as the one I'm working in to reproduce the bug.
git clone https://github.com/TrevorDMartin/tsoa-type-vs-interface/tree/main
generated/swagger.json
/complex-schema
have additional fields attachedController is located at
src/schema-test/SchemaTestController.ts
There are three seperate files, one for each endpoint, where the data and types are defined.
src/schema-test/CollisionTypes.ts
src/schema-test/ComplexTypes.ts
src/schema-test/SimpleTypes.ts
Context (Environment)
Version of NodeJS: 18.15.0
Version of Typescript: ^5.0.4
Current Workaround
Changing the parent type in
src/schema-test/ComplexTypes.ts
from an interface to a type results in no more extra fields:The text was updated successfully, but these errors were encountered: