During implementation of yaml to json converter for swagger schema I was faced with the problem: default setup of deserialization builder
var deserializer = new DeserializerBuilder().Build()
cannot recognize 'integer', 'boolean' types. The deserializer converts those types to strings. For ex: i have yaml:
EntityId:
type: integer
example: 1245
EntityIds:
type: array
items:
$ref: EntityId
example: [152, 6542, 23]
The result of conversion is:
"EntityId":{
"type":"integer",
"example":"1245"
},
"EntityIds":{
"type":"array",
"items":{
"$ref":"EntityId"
},
"example":[ "152","6542","23"]
}
but if I put input yaml to any of the online converters I get correct json result:
"EntityId": {
"type": "integer",
"example": 1245
},
"EntityIds": {
"type": "array",
"items": {
"$ref": "EntityId"
},
"example": [
152,
6542,
23
]
}
also behavior for Boolean types.
The question is how to set up the deserializer for proper conversion.