diff --git a/rpc/build.gradle b/rpc/build.gradle index 9b0ba0aae..08db4dff7 100644 --- a/rpc/build.gradle +++ b/rpc/build.gradle @@ -10,7 +10,7 @@ dependencies { implementation "org.reflections:reflections:${versions.reflections}" implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:${versions.serialization}" implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:${versions.coroutines}" - implementation "com.networknt:json-schema-validator:1.0.67" + implementation "com.networknt:json-schema-validator:1.5.2" implementation "commons-io:commons-io:${versions.apacheCommons}" def generateForProjects = coreModules + commonModule diff --git a/rpc/schemas/common/devices/PrimaryDeviceConfiguration.json b/rpc/schemas/common/devices/PrimaryDeviceConfiguration.json index ef4de9950..34f116f14 100644 --- a/rpc/schemas/common/devices/PrimaryDeviceConfiguration.json +++ b/rpc/schemas/common/devices/PrimaryDeviceConfiguration.json @@ -12,11 +12,15 @@ } ], "$defs": { + "HACK-SEE-ISSUE-492": true, "PrimaryDeviceConfiguration": { "$anchor": "PrimaryDeviceConfiguration", "allOf": [ { "$ref": "DeviceConfiguration.json#DeviceConfiguration" } ], "properties": { - "isPrimaryDevice": { "const": true } + "isPrimaryDevice": { "const": true }, + + "roleName": { "$ref": "#/$defs/HACK-SEE-ISSUE-492" }, + "defaultSamplingConfiguration": { "$ref": "#/$defs/HACK-SEE-ISSUE-492" } }, "required": [ "isPrimaryDevice" ] } diff --git a/rpc/schemas/studies/users/ParticipantGroupStatus.json b/rpc/schemas/studies/users/ParticipantGroupStatus.json index 6b77ff620..63f8ee772 100644 --- a/rpc/schemas/studies/users/ParticipantGroupStatus.json +++ b/rpc/schemas/studies/users/ParticipantGroupStatus.json @@ -7,6 +7,7 @@ { "$ref": "#/$defs/Stopped" } ], "$defs": { + "HACK-SEE-ISSUE-492": true, "ParticipantGroupStatus": { "type": "object", "properties": { @@ -23,7 +24,10 @@ "allOf": [ { "$ref": "#/$defs/ParticipantGroupStatus" } ], "properties": { "invitedOn": { "type": "string", "format": "date-time" }, - "studyDeploymentStatus": { "$ref": "../../deployments/StudyDeploymentStatus.json" } + "studyDeploymentStatus": { "$ref": "../../deployments/StudyDeploymentStatus.json" }, + + "id": { "$ref": "#/$defs/HACK-SEE-ISSUE-492" }, + "participants": { "$ref": "#/$defs/HACK-SEE-ISSUE-492" } }, "required": [ "invitedOn", "studyDeploymentStatus" ] }, diff --git a/rpc/src/test/kotlin/dk/cachet/carp/rpc/JsonSchemasTest.kt b/rpc/src/test/kotlin/dk/cachet/carp/rpc/JsonSchemasTest.kt index 17b4c4947..a3dd470ed 100644 --- a/rpc/src/test/kotlin/dk/cachet/carp/rpc/JsonSchemasTest.kt +++ b/rpc/src/test/kotlin/dk/cachet/carp/rpc/JsonSchemasTest.kt @@ -35,20 +35,20 @@ class JsonSchemasTest val requestErrors = requestSchema.validate( requestJson ) check( requestErrors.isEmpty() ) { - "JSON schema \"${requestSchema.currentUri}\" " + + "JSON schema \"${requestSchema.schemaLocation}\" " + "doesn't match generated JSON example of \"${r.requestObject.klass}\": $requestErrors" } // Validate response. val requestObjectName = r.requestObject.klass.simpleName val responseSchemaNode = requestSchema.getRefSchemaNode( "#/\$defs/$requestObjectName/Response" ) - val responseSchema = schemaFactory.getSchema( requestSchema.currentUri, responseSchemaNode ) + val responseSchema = schemaFactory.getSchema( requestSchema.schemaLocation, responseSchemaNode ) val responseJson = mapper.readTree( r.response.json ) val responseErrors = responseSchema.validate( responseJson ) check( responseErrors.isEmpty() ) { - "JSON schema response defined in \"${requestSchema.currentUri}\" for \"$requestObjectName\" " + - "doesn't match generated JSON example of \"${r.response.klass}\": $responseErrors" + "JSON schema response defined in \"${requestSchema.schemaLocation}\" for \"$requestObjectName\" " + + "doesn't match generated JSON example of \"${r.response.klass.simpleName}\": $responseErrors" } } }