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

Model fails when a nested attributes has a key unfriendly string keys #686

Open
1 of 3 tasks
neumerance opened this issue Sep 2, 2020 · 0 comments
Open
1 of 3 tasks

Comments

@neumerance
Copy link

Note: for support questions, please use stackoverflow. This repository's issues are reserved for feature requests and bug reports.

  • I'm submitting a ...

    • bug report
    • feature request
    • support request => Please do not submit support request here, see note at the top of this template.
  • What is the current behavior?
    I have a nested attributes model.

I have the field schema below

        {
          "type": "input",
          "inputType": "text",
          "inputName": "promotion[promotion_documents_attributes][][translation_attributes][zh-hk][url]",
          "model": "documents[0][translations][zh-hk][url]",
          "label": "Document url zh-hk",
          "validator": ["url"]
       }
  • What is the expected behavior?
    I expected the model to be like below when you type something in the field
{
  ...,
 "documents": [
    {
      "translations": {
          "zh-hk": {
             "url": "whatever i type here"
          }
       }
    }
  ]
}

I get this instead

{
  ...,
  documents: [
    {
      "translations[zh-hk]": {
         "url": "whatever i type here"
       }
    }
  ]
}

This cause the validation not work and the model object not to what we expect.

Do you see any work around how we can handle unfriendly json keys like zh-hk

@neumerance neumerance changed the title Model fails when a nested attributes has a key Model fails when a nested attributes has a key unfriendly string keys Sep 2, 2020
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

No branches or pull requests

1 participant