Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

action expandVar is not working for objects non stringified #703

Closed
AlvaroVega opened this issue Jul 13, 2022 · 4 comments
Closed

action expandVar is not working for objects non stringified #703

AlvaroVega opened this issue Jul 13, 2022 · 4 comments
Labels

Comments

@AlvaroVega
Copy link
Member

When object is a part of a string to be expanded

i.e.:

"subject": "the id ${id} of type ${type} has location ${location}"

Related with: (that is a fix when value is just the object
#692

@fgalan
Copy link
Member

fgalan commented Jul 13, 2022

Do you mean it works only when the whole string is the macro? I mean:

"subject": "${id}"

@AlvaroVega
Copy link
Member Author

AlvaroVega commented Jul 14, 2022

No, it works when macro is composed of several string vars like:

"subject": "the id ${id} of type ${type}"

but not works when one of these vars is a json object:

"subject": "the id ${id} of type ${type} has location ${location}"

but works when macro is just one json object: (fixed in #692)

"subject":"$location"

No new case is not working from #692

@mrutid mrutid added the P1 label Jul 7, 2023
@AlvaroVega AlvaroVega added the P1 label Jul 7, 2023
@AlvaroVega
Copy link
Member Author

AlvaroVega commented Aug 24, 2023

For example this action has a json attribute locationCopy which is not expanded

"action":{
        "type":"update",
        "parameters":{
            "id":"${id}_mirror",
            "version": 2,
            "attributes": [
                {
                    "name":"abnormal",
                    "type":"Number",
                    "value": 7
                },
                {
                   "name": "locationCopy",
                   "type": "MyCustomTypo",
                   "value": {
                       "type":"Point",
                       "coordinates":["${Lat}","${Lon}"]
                   }
              }
            ]
        }
    }

And the workaround needed is use a json stringifed value:

"action":{
        "type":"update",
        "parameters":{
            "id":"${id}_mirror",
            "version": 2,
            "attributes": [
                {
                    "name":"abnormal",
                    "type":"Number",
                    "value": 7
                },
                {
                   "name": "locationCopy",
                   "type": "MyCustomTypo",
                   "value": "{\"type\":\"Point\",\"coordinates\":[${Lat},${Lon}]}"
              }
            ]
        }
    }

@AlvaroVega AlvaroVega changed the title action expandVar is not working for objects into strings action expandVar is not working for objects non stringified Sep 27, 2023
@fgalan
Copy link
Member

fgalan commented Sep 27, 2023

Fixed by PR #752

@fgalan fgalan closed this as completed Sep 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants