openapi-generator
openapi-generator copied to clipboard
[BUG][typescript-angular] PropertyNames on dictionaries are ignored
Description
If an object has a property that specifies additionalProperties and propertyNames then propertyNames is not taken into account when generating the interface.
openapi-generator version
7.8.0
OpenAPI declaration file content or url
components:
schema:
SomeDTO:
map:
type: object
additionalProperties:
type: array
items:
$ref: '#/components/schemas/OtherDTO'
propertyNames:
type: string
enum:
- FOO
- BAR
Generation Details
Generated using: openapi-generator-maven-plugin
Configuration:
<typeMappings>
<typeMapping>DateTime=string</typeMapping>
</typeMappings>
<configOptions>
<ngVersion>17.3.11</ngVersion>
</configOptions>
Steps to reproduce
Run the generation and check the generated interface
expected output:
interface SomeDTO {
map: {
foo: Array<OtherDTO>;
bar: Array<OtherDTO>;
[key: string]: Array<OtherDTO>;
}
}
actual output:
interface SomeDTO {
map: { [key: string]: Array<OtherDTO>; }
}
Looking at it, I miss-labeled it, since it'd make more sense to see this as an enhancement. Also I'll be working on a PR for this feature :)