Closed snebjorn closed 4 years ago
Perhaps an option to strip the namespace from the generated model could be added along with this fix.
So an option like excludeNamespaceInModels: boolean
. The default value isn't important as namespaces don't currently work, so either will do :)
On 2nd thought the filename currently includes the namespace so the default value should probably be false
and excludeNamespaceInModels
should impact the generated filename.
imho, the only correct handling, would be to translate namespaces to folders. so, that would roughly mean:
|-- MYNAMESPACE
|-- foobar.interface.ts
with then the code
export interface FooBar {}
an import would then look as follows:
import { FooBar } from '... /MYNAMESPACE/foobar.interface.ts'.
and if that ever comes down to a clash, of 2 interfaces having the same name:
import { FooBar as MyNamespaceFooBar } from '.../MYNAMESPACE/foobar.interface.ts'
import { FooBar as MyOtherFooBar } from '.../MYOTHER/foobar.interface.ts'
According to https://github.com/OAI/OpenAPI-Specification/issues/1362 namespaces are "supported" and tooling should handle them gracefully.
Given this schema with a namespace
Generates this TS model
.
is not an allowed character in an interface.https://github.com/openapitools/openapi-generator-cli handles this by just generating