ecemepn
3 years agoFrequent Visitor
Dynamic type values in a hashmap
Hi support,
I have a valid json that contains dynamic data. The json has the following structure:
{
"authSubscriptions":{
"imsi-1":{
"ueIdList":[
{
"idType":"imsi",
"idValue":"1"
}
],
"a4KeyInd":"1",
"a4Ind":"2"
},
"imsi-2":{
"ueIdList":[
{
"idType":"imsi",
"idValue":"2"
}
],
"a4KeyInd":"1",
"a4Ind":"2"
},
"preferredSiteId":0
}
}
We tried this yaml as input for Swagger:
# Auth Subscription data
AuthSubscriptionsResponse:
description: Map of Auth subscriptions response for a user, ueId is used as key
type: object
properties:
preferredSiteId:
$ref: '#/components/schemas/PreferredSiteId'
additionalProperties:
$ref: '#/components/schemas/AuthSubscriptionResponse'
But it is generating an incorrect class:
public class AuthSubscriptionsResponse extends HashMap<String, AuthSubscriptionResponse> {
PreferredSiteId is an integer and not AuthSubscriptionResponse and it is failing at that point.
Do you have any solution in yaml for this dynamic values inside a hashmap?
Thxs in advance for your support/Esther.