We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Bug
When adding a property that uses choices the options are added as possible values to the schema. However, SurveyJS supports 2 formats for choices:
choices
// Format 1 let choices = [ "a", "b", "c" ]; // Format 2 let choices = [ {value: "a", text: "Value A"} ];
When using the second format, the whole object is added as a possible value.
The value in the value key should be used for the JSON schema.
See the demo page i created
Tested page URL: https://codesandbox.io/s/json-schema-bug-demo-zdy6gx?file=/src/index.js
Test code
import "survey-core/survey.i18n.js"; import "survey-creator-core/survey-creator-core.i18n.js"; import { Serializer } from "survey-core"; import "survey-core/defaultV2.css"; import "survey-creator-core/survey-creator-core.css"; import "./index.css"; // Add a property to the Survey class Serializer.addProperty("survey", { name: "customSurveyProperty", category: "general", visibleIndex: 0, choices: ["a", "b"] }); Serializer.addProperty("survey", { name: "customSurveyProperty2", category: "general", visibleIndex: 0, choices: [{ text: "a", value: "Value A" }, "b"] }); const schema = Serializer.generateSchema(); const element = document.getElementById("surveyCreatorContainer"); element.style.whiteSpace = "pre"; element.innerHTML = JSON.stringify( { customSurveyProperty: schema.properties.customSurveyProperty, customSurveyProperty2: schema.properties.customSurveyProperty2 }, null, 2 );
N/a
The text was updated successfully, but these errors were encountered:
Incorrect JSON Schema for property with choices fixed #7167
1cc52f9
eaebc6b
andrewtelnov
No branches or pull requests
Are you requesting a feature, reporting a bug or asking a question?
Bug
What is the current behavior?
When adding a property that uses
choices
the options are added as possible values to the schema.However, SurveyJS supports 2 formats for choices:
When using the second format, the whole object is added as a possible value.
What is the expected behavior?
The value in the value key should be used for the JSON schema.
How would you reproduce the current behavior (if this is a bug)?
See the demo page i created
Provide the test code and the tested page URL (if applicable)
Tested page URL: https://codesandbox.io/s/json-schema-bug-demo-zdy6gx?file=/src/index.js
Test code
Specify your
N/a
The text was updated successfully, but these errors were encountered: