[asterisk-bugs] [JIRA] (ASTERISK-21885) Asterisk REST API - modify JSON events to include an event type field; update swagger and code generation to use a discriminated union
Matt Jordan (JIRA)
noreply at issues.asterisk.org
Fri Jun 7 13:47:03 CDT 2013
[ https://issues.asterisk.org/jira/browse/ASTERISK-21885?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Matt Jordan updated ASTERISK-21885:
-----------------------------------
Status: Open (was: Triage)
> Asterisk REST API - modify JSON events to include an event type field; update swagger and code generation to use a discriminated union
> --------------------------------------------------------------------------------------------------------------------------------------
>
> Key: ASTERISK-21885
> URL: https://issues.asterisk.org/jira/browse/ASTERISK-21885
> Project: Asterisk
> Issue Type: Improvement
> Components: Core/Stasis, Resources/res_stasis_http
> Reporter: Matt Jordan
> Labels: Asterisk12
>
> Currently, JSON events returned from the websocket are typed based on the key:
> {noformat}
> { 'type1': { 'foo': 'bar' } }
> { 'type2': { 'bar': 'yackity' } }
> {noformat}
> This can make parsers a bit more difficult, as they have to determine object types based on keys which may or may not be present in the event.
> This approach was initially chosen due to the use of Swagger, which provides (among other things) the ability to generate static language bindings for the REST API. The static language bindings obviously require strongly typed objects, which is determined by the key. Having a nomenclature of:
> {noformat}
> { 'type:' 'type1',
> 'data:' { 'foo': 'bar' } }
> {noformat}
> however is ideal, as it does make it easier to parse for consumers of the API. Unfortunately, by default, this will make a mockery of static language bindings.
> Instead, behind the scenes, we'll treat the object described by the 'data' field as a discriminated union. This will allow the object to be returned with the event type specified, but will keep Swagger useful.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.asterisk.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the asterisk-bugs
mailing list