cyclosproject / ng-openapi-gen

An OpenAPI 3.0 codegen for Angular
MIT License
397 stars 132 forks source link

need to add `undefined` to `additionalProperties` indexer when there are optional fields #78

Closed JeroMiya closed 4 years ago

JeroMiya commented 4 years ago

Looks like we're missing the undefined type from the type union that's now generated when an additionalProperties indexer is generated. See this issue:

https://github.com/cyclosproject/ng-openapi-gen/issues/68

When the model fields are marked as optional (e.g. fieldName?: string | null), undefined needs to be added to the type union in addition to null. At least when you have the more strict TypeScript configurations.