Skip to content

Updated all properties that are defined as Any to use OpenApiAny - #117

Merged
Darrel (darrelmiller) merged 8 commits into
masterfrom
dm/OpenApiAny
Dec 12, 2017
Merged

Darrel (darrelmiller) merged 8 commits into
masterfrom
dm/OpenApiAny

Conversation

@darrelmiller

Copy link
Copy Markdown
Member

Also added detection of integer, double and dateTime when parsing.

{
return new OpenApiDateTime(datetimeValue);
}
// TODO: add more codes to identify each primitive types

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we add the primitive types converting, can we remove this comments?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way to write LoadExamples/LoadExample that doesn't tie the Example object to the Response object?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds perfect to me. I'll do that now.

@PerthCharern PerthCharern left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🕐

@PerthCharern PerthCharern left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants