Validate a survey description
limesurvey_validate_specCheck a survey description (spec) and report every problem at once. kind says what the spec is: survey ({ survey, groups }), group (one group with its questions) or question (one question).
Instructions
Check a survey description (spec) and report every problem at once. kind says what the spec is: survey ({ survey, groups }), group (one group with its questions) or question (one question). Returns { valid, kind, errors [{ path, message, fix }], errors_total, warnings [{ path, message }], warnings_total, truncated, summary, checked_against_survey, skipped_checks }. errors and warnings show at most 200 entries and are cut further to stay within LIMESURVEY_MAX_RESPONSE_CHARS; errors_total and warnings_total hold the full numbers and truncated says whether a list was cut. Paths are 0-based, for example groups[1].questions[3].answers[0].code; for kind group and question they are relative to the checked object (for example code). The check covers keys, question codes (pattern, length, reserved words, duplicates), question types and the subquestions and answers each type needs, answer and subquestion codes, attribute names, attributes that some question theme defines but the theme of the question does not (plugin attributes and unknown themes are not checked), a question_theme_name of another question type, language codes (each once, none equal to the base language), survey.format, survey.expires (a real date and time), XML-forbidden characters and embedded data URIs. A text is one string (for every language) or a map per language; the map must name exactly the languages of the survey (a default value may name fewer); an empty question, subquestion or answer text is a warning. An attribute takes a map when it is stored per language (prefix, suffix, ...) or when no question theme lists it (a plugin attribute), not when it is known to be language independent. default is refused on questions with subquestions and on types R and |. An entry of a Ranking question may have a code of up to 20 characters and a relevance only on LimeSurvey 7: without survey_id this is a warning, with survey_id and kind group or question the version of the instance decides. Without survey_id nothing is sent to LimeSurvey and skipped_checks lists the checks that need the survey (for kind survey the languages come from the spec itself); with survey_id the tool reads the survey (read methods only) and also reports question codes that already exist in it and holds language maps to its languages. The types with a second scale are checked with their scale_id: type 1 needs subquestions (scale 0) and answers on scale 0 and 1, the types : and ; need subquestions on scale 0 (rows) and 1 (columns) and take no answers; codes are unique per scale; scale_id 1 elsewhere and default values on these three types are errors. The tool does not create or change anything; limesurvey_create_survey_from_spec creates a survey from a valid survey spec and limesurvey_get_survey_spec reads a survey, group or question as a spec.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| kind | No | What the spec describes: survey (default), group or question. | survey |
| spec | Yes | The survey description. Its fields depend on kind; unknown fields are reported by the check, not rejected. | |
| survey_id | No | Optional ID of an existing survey; for kind group and question its existing question codes are checked as well. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes | ||
| workflow | Yes |