ApiProperty for unknown keys (dictionaries)
See original GitHub issueIs there an existing issue that is already proposing this?
- I have searched the existing issues
Is your feature request related to a problem? Please describe it
If my schema is contain dictionaries (properties with unknown key) I dont know how create schema descriptions for it like here https://swagger.io/docs/specification/data-models/dictionaries/
Example:
class ColorDto {
@ApiProperty()
hex: string;
@ApiProperty()
rgb: string;
}
class RainbowDto {
@ApiProperty()
name: string;
@???????
colors: { [key: string] : ColorDto }
}
Describe the solution you’d like
class ColorDto {
@ApiProperty()
hex: string;
@ApiProperty()
rgb: string;
}
class RainbowDto {
@ApiProperty()
name: string;
@ApiAdditionalProperty({
type: ColorDto
})
colors: { [key: string] : ColorDto }
}
Teachability, documentation, adoption, migration strategy
No response
What is the motivation / use case for changing the behavior?
This is super often problem, and I dont know how to solve this trouble for now…
Issue Analytics
- State:
- Created 2 years ago
- Reactions:8
- Comments:5
Top Results From Across the Web
Dictionaries, Hashmaps, Associative Arrays - Swagger
A dictionary (also known as a map, hashmap or associative array) is a set of key/value ... OpenAPI lets you define dictionaries where...
Read more >How to define swagger property that is an unknown name?
I need to define a swagger property that doesn't have a known name. { "type": "object", "properties": { "?????": ...
Read more >Fix Swagger Validator errors in Power Platform connectors
Check to see if the x-ms-editor is only set to dictionary when the schema is of type object and set to additional properties...
Read more >Types and Parameters - OpenAPI - Documentation | NestJS
import { ApiProperty } from '@nestjs/swagger'; export class CreateCatDto ... In order to explicitly set the type of the property, use the type...
Read more >Loading JSON data from Cloud Storage | BigQuery
If you want to ignore values in a row that are not present in the table's schema, then select Unknown values. For Encryption,...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Workaround
Any updates on this? Unfortunately, it seems decorators cannot be attached to index signatures. 😦