mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2026-03-17 16:19:24 +00:00
[TypeScript-Fetch] Generate oneOf schemas as type unions (#2617)
* Generate oneOf schemas as type unions for typescript-fetch * Adjust oneOf imports to only include refs of oneOf
This commit is contained in:
@@ -165,6 +165,16 @@ public class TypeScriptFetchClientCodegen extends AbstractTypeScriptClientCodege
|
||||
}
|
||||
}
|
||||
}
|
||||
if (cm.oneOf.size() > 0) {
|
||||
// For oneOfs only import $refs within the oneOf
|
||||
TreeSet<String> oneOfRefs = new TreeSet<String>();
|
||||
for (String im : cm.imports) {
|
||||
if (cm.oneOf.contains(im)) {
|
||||
oneOfRefs.add(im);
|
||||
}
|
||||
}
|
||||
cm.imports = oneOfRefs;
|
||||
}
|
||||
}
|
||||
|
||||
return objs;
|
||||
|
||||
Reference in New Issue
Block a user