You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@isis.apache.org by "Dan Haywood (JIRA)" <ji...@apache.org> on 2018/02/01 15:58:02 UTC

[jira] [Commented] (ISIS-1850) Rename 'default' in JSON Response

    [ https://issues.apache.org/jira/browse/ISIS-1850?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16348798#comment-16348798 ] 

Dan Haywood commented on ISIS-1850:
-----------------------------------

I'm not sure about this... this is as specified in the RO specification, so making this change would mean a breaking change in that spec.

Can't you work around this in the client-side code somehow, eg:

{code}

for (var prop:String in obj) {

    var key = prop == 'default' ? 'defaultChoice' : key;
    this[key = obj[prop];
 }

{code}

> Rename 'default' in JSON Response
> ---------------------------------
>
>                 Key: ISIS-1850
>                 URL: https://issues.apache.org/jira/browse/ISIS-1850
>             Project: Isis
>          Issue Type: Improvement
>          Components: Core: Viewer: RestfulObjects
>    Affects Versions: 1.16.0
>            Reporter: Jörg Rade
>            Priority: Major
>             Fix For: 1.16.1
>
>
> Invoking
> {code:java}
> http://localhost:8080/restful/services/isisApplib.FixtureScriptsDefault/actions/runFixtureScript{code}
> answers:
> {code}
>         "parameters": {
>             "script": {
>                 "num": 0,
>                 "id": "script",
>                 "name": "Script",
>                 "description": "",
>                 "choices": [
>                     {
>                         "rel": "urn:org.restfulobjects:rels/value",
>                         "href": "http://localhost:8080/restful/objects/domainapp.application.fixture.scenarios.DomainAppDemo/PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPG1lbWVudG8-PHBhdGg-PC9wYXRoPjwvbWVtZW50bz4=",
>                         "method": "GET",
>                         "type": "application/json;profile=\"urn:org.restfulobjects:repr-types/object\"",
>                         "title": "Domain App Demo"
>                     }
>                 ],
>                 "default": {
>                     "rel": "urn:org.restfulobjects:rels/value",
>                     "href": "http://localhost:8080/restful/objects/domainapp.application.fixture.scenarios.DomainAppDemo/PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPG1lbWVudG8-PHBhdGg-PC9wYXRoPjwvbWVtZW50bz4=",
>                     "method": "GET",
>                     "type": "application/json;profile=\"urn:org.restfulobjects:repr-types/object\"",
>                     "title": "Domain App Demo"
>                 }
>             },
> {code}
> default is a keyword in ActionScript and converting JSON to AS like in https://github.com/joerg-rade/roViz/blob/master/src/main/flex/org/ro/to/AbstractTransferObject.as#L10
> is not possible since 'public var default:Object' is illegal.
> Please rename 'default' into eg. defaultChoice



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)