Swagger: Dictionary / additional properties support

Created on 23 Sep 2018  路  3Comments  路  Source: nestjs/swagger

I'm submitting a...


[ ] Regression 
[ ] Bug report
[ X ] Feature request
[ ? ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.

Current behavior

I'm not sure if this is a missing feature or just missing documentation, but I'd like to represent a key/value dictionary using ApiModelProperty decorators.

Expected behavior

I know this won't work, but this is an example of what I'm trying to achieve...

class SomeStuffDto {
  // ...
}

interface MyDict {
  @ApiModelProperty({
    type: SomeStuffDto,
  })
  [category: string]: SomeStuffDto;
}

class MyDto {
  @ApiModelProperty({
    type: MyDict,
  })
  categorizedStuff: MyDict
}

Is there a way to achieve this type of data structure currently?

Most helpful comment

@nartc is there any plan to migrate to openapiv3? Dictionary support would be nice

All 3 comments

Dictionary is not supported in OpenAPI 2.0 so @nestjs/swagger probably won't be able to have this supported for a while. (until we completely move over to OpenAPI 3.0)

@nartc is there any plan to migrate to openapiv3? Dictionary support would be nice

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings