Repository navigation
Updated all properties that are defined as Any to use OpenApiAny - #117
Conversation
| { | ||
| return new OpenApiDateTime(datetimeValue); | ||
| } | ||
| // TODO: add more codes to identify each primitive types |
There was a problem hiding this comment.
If we add the primitive types converting, can we remove this comments?
There was a problem hiding this comment.
Possibly. I'm still not sure that OpenApiDouble is the correct type here. JSON only has the notion of number, so picking double is somewhat arbitrary. Should it be decimal instead? Should we have an OpenApiNumber? Will this be relevant at all in the future when we have proper extension parsing and if examples get treated as strings, and link parameters can determine their type from the target operation parameters.... Many unknowns here.
| mediaTypeObject = new OpenApiMediaType(); | ||
| response.Content.Add(mediaType, mediaTypeObject); | ||
| } | ||
| mediaTypeObject.Example = exampleNode; |
There was a problem hiding this comment.
Is there a way to write LoadExamples/LoadExample that doesn't tie the Example object to the Response object?
There was a problem hiding this comment.
I could pass the map of media type objects from the response.Content into the method instead and update those. Or we could return a list of media type objects and then do a merge on any that already exist in the response object. The merging would be a bit ugly though.
There was a problem hiding this comment.
I understand. I think this is okay. Would it be okay if we leave some comments about the Example object only used in conjunction with Response (since this kinda breaks the pattern elsewhere where each object is deserialized independently without another object as a parameter)?
In reply to: 156219331 [](ancestors = 156219331)
There was a problem hiding this comment.
Actually, how about this? : The "Example" object of this form doesn't exist in V2. This is explained in the Example object model in the DOM itself. So technically, this "examples" field (and the V2 Example object, which doesn't exist in our model) can be treated as an integral part of the Response object itself. It makes sense to me to get rid of this file and move all of this logic to OpenApiResponseDeserializer to be consistent with the way we handle serialization.
In reply to: 156447751 [](ancestors = 156447751,156219331)
There was a problem hiding this comment.
Sounds perfect to me. I'll do that now.
Also added detection of integer, double and dateTime when parsing.