diff --git a/pom.xml b/pom.xml
index eadf166..b57ab87 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
fr.insee.pogues
pogues-model
- 1.15.1
+ 1.15.2
jar
Pogues Model
diff --git a/src/main/resources/xsd/Questionnaire.xsd b/src/main/resources/xsd/Questionnaire.xsd
index c45efb9..1ffd9ab 100644
--- a/src/main/resources/xsd/Questionnaire.xsd
+++ b/src/main/resources/xsd/Questionnaire.xsd
@@ -224,7 +224,7 @@
References of variables used by pairwise
- questions to define the indivisuals.
+ questions to define the individuals.
@@ -360,6 +360,17 @@
+
+
+
+ Property defined on variables associated with a choice question, whose choices are
+ dynamically defined by the responses of another question.
+ The value of the 'VariableRerference' property is the identifier of the variable defining
+ these dynamic choices.
+ Therefore, it must only be used when the 'choiceType' in the associated question is 'VARIABLE'.
+
+
+
Variable representation type to characterize the variable (numeric,
diff --git a/src/test/java/fr/insee/pogues/test/JSONDeserializerTest.java b/src/test/java/fr/insee/pogues/test/JSONDeserializerTest.java
index 8c43e8f..a57275a 100644
--- a/src/test/java/fr/insee/pogues/test/JSONDeserializerTest.java
+++ b/src/test/java/fr/insee/pogues/test/JSONDeserializerTest.java
@@ -544,4 +544,34 @@ void testVariableResponsesFullConfiguration() throws JAXBException {
question.getResponse().getFirst().getVariableReference()
);
}
+
+ @Test
+ void testDeserializeVariableReferenceInExternalVariable() throws JAXBException {
+
+ String json = """
+ {
+ "Variables": {
+ "Variable": [
+ {
+ "id": "ext1",
+ "type": "ExternalVariableType",
+ "VariableReference": "id-variable-ref",
+ "Name": "NUMERO_MENAGE",
+ "Label": "Numéro du ménage"
+ }
+ ]
+ }
+ }
+ """;
+
+ JSONDeserializer deserializer = new JSONDeserializer();
+ Questionnaire questionnaire = deserializer.deserializeString(json);
+
+ ExternalVariableType variable =
+ (ExternalVariableType) questionnaire.getVariables()
+ .getVariable().getFirst();
+
+ assertNotNull(variable);
+ assertEquals("id-variable-ref", variable.getVariableReference());
+ }
}
diff --git a/src/test/java/fr/insee/pogues/test/JSONSerializerTest.java b/src/test/java/fr/insee/pogues/test/JSONSerializerTest.java
index e9266b8..e49ea9c 100644
--- a/src/test/java/fr/insee/pogues/test/JSONSerializerTest.java
+++ b/src/test/java/fr/insee/pogues/test/JSONSerializerTest.java
@@ -714,4 +714,40 @@ void testSerializeVariableResponsesFullConfiguration() throws Exception {
JSONAssert.assertEquals(expectedJson, json, JSONCompareMode.STRICT);
}
+
+ @Test
+ void testSerializeVariableReferenceInExternalVariable() throws Exception {
+
+ ExternalVariableType variable = new ExternalVariableType();
+ variable.setId("ext1");
+ variable.setName("NUMERO_MENAGE");
+ variable.setLabel("Numéro du ménage");
+ variable.setVariableReference("id-variable-ref");
+
+ Questionnaire questionnaire = new Questionnaire();
+ questionnaire.setVariables(new Questionnaire.Variables());
+
+ questionnaire.getVariables().getVariable().add(variable);
+
+ JSONSerializer serializer = new JSONSerializer(true);
+ String json = serializer.serialize(questionnaire);
+
+ String expectedJson = """
+ {
+ "Variables": {
+ "Variable": [
+ {
+ "id": "ext1",
+ "type": "ExternalVariableType",
+ "VariableReference": "id-variable-ref",
+ "Name": "NUMERO_MENAGE",
+ "Label": "Numéro du ménage"
+ }
+ ]
+ }
+ }
+ """;
+
+ JSONAssert.assertEquals(expectedJson, json, JSONCompareMode.STRICT);
+ }
}