Skip to content

JSON generated from TitleMap is Invalid #79

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

Closed
lbispham opened this issue Mar 12, 2018 · 1 comment
Closed

JSON generated from TitleMap is Invalid #79

lbispham opened this issue Mar 12, 2018 · 1 comment
Assignees
Labels
not_an_issue not_reproduced issue not reproduced

Comments

@lbispham
Copy link

lbispham commented Mar 12, 2018

Description

I am generating a RadioBox from a TitleMap. The form JSON is invalid.

Steps to Reproduce

public class UserValues implements ValuesContainer {

@Override
public Map<String, String> getValues() {
    ImmutableMap.Builder<String, String> builder = ImmutableMap.builder();
    builder.put("Custom", "Custom");
    builder.put("Standard", "Standard");
    return builder.build();
}

}

@Radiobox(title = "Choose a setting", titleMap = UserValues .class)
private String choose;

Expected behavior: [What you expect to happen]

I expect my JSON for the form to look like this:

{ "key": "choose", "readOnly": false, "type": "radios", "titleMap": [ { "name": "Custom", "value": "Custom" }, { "name": "Standard", "value": "Standard" } ] }

Actual behavior: [What actually happens]

Instead the JSON is invalid and looks like this (no quotation marks around the values in the titleMap):

{ "key": "choose", "readOnly": false, "type": "radios", "titleMap": [ { "name": "Custom", "value": Custom }, { "name": "Standard", "value": Standard } ] }

Versions

1.0.0

Additional Information

Any additional information, configuration or data that might be necessary to reproduce the issue.

@SaifJerbi SaifJerbi self-assigned this Mar 12, 2018
@SaifJerbi SaifJerbi added the bug label Mar 12, 2018
@SaifJerbi SaifJerbi added this to the 1.0.1 milestone Mar 12, 2018
@SaifJerbi
Copy link
Member

Hi @lbispham,

I can't reproduce the issue. I used the same implementation but the issue is not reproduced.

// My field
@RadioBox(title="Gender", titleMap=GenderTitleMap.class)
private String gender;
// My Map values
@Override
public Map<String, String> getValues() {
	ImmutableMap.Builder<String, String> builder = ImmutableMap.builder();
	builder.put("Male", "Male");
	builder.put("Female", "Female");
	return builder.build();
}

I got the json below:

// The result
[
  {
    "key": "gender",
    "readOnly": false,
    "type": "radios",
    "titleMap": [
      {
        "name": "Male",
        "value": "Male"
      },
      {
        "name": "Female",
        "value": "Female"
      }
    ]
  }
]

Can you please try to use the demo app and try to reproduce your issue or fill more details about your app environment

@SaifJerbi SaifJerbi removed this from the 1.0.1 milestone Mar 12, 2018
@SaifJerbi SaifJerbi added the not_reproduced issue not reproduced label Mar 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
not_an_issue not_reproduced issue not reproduced
Projects
None yet
Development

No branches or pull requests

2 participants