I am generating C# classes from Swagger exposed model. For now, I am using the provided petstore example
http://petstore.swagger.wordnik.com/api/api-docs/pet
The Json from this url contains the following:
"category": {
"$ref": "Category"
},
I tried to read this with Json.net by
[JsonProperty("$ref")]
public string Ref { get; set; }
My purpose is to instanciate Swagger Object model thanks to Json.net, then to use it to generate the swagger-described model.
It does not work and the object that holds this property remains null
with no further exception (Also tries to set IsReference = true
). It works when there is no $ref
.
What would be the best practice to handle this cleanly?