Skip to content

Commit

Permalink
Specifically marking nullable ApiClientAnswer(Set) properties as such
Browse files Browse the repository at this point in the history
  • Loading branch information
sauterl committed May 28, 2024
1 parent 4890883 commit 38e9566
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import dev.dres.data.model.media.MediaItemId
import dev.dres.data.model.submissions.DbAnswer
import dev.dres.data.model.submissions.DbAnswerType
import io.javalin.openapi.OpenApiIgnore
import io.javalin.openapi.OpenApiNullable
import kotlinx.dnq.query.filter
import kotlinx.dnq.query.singleOrNull
import kotlinx.serialization.Serializable
Expand All @@ -21,6 +22,7 @@ import kotlinx.serialization.Serializable
@Serializable
data class ApiClientAnswer( //TODO add optional relevance score field
/** The text that is part of this [ApiClientAnswer]. */
@get:OpenApiNullable
val text: String? = null,

/** The [MediaItemId] associated with the [ApiClientAnswer]. Is usually added as contextual information by the receiving endpoint. */
Expand All @@ -29,15 +31,19 @@ data class ApiClientAnswer( //TODO add optional relevance score field
val mediaItemId: MediaItemId? = null,

/** The name of the media item that is part of the answer. */
@get:OpenApiNullable
val mediaItemName: String? = null,

/** The name of the collection the media item belongs to. */
@get:OpenApiNullable
val mediaItemCollectionName: String? = null,

/** For temporal [ApiClientAnswer]s: Start of the segment in question in milliseconds. */
@get:OpenApiNullable
val start: Long? = null,

/** For temporal [ApiClientAnswer]s: End of the segment in question in milliseconds. */
@get:OpenApiNullable
val end: Long? = null,
) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import dev.dres.data.model.submissions.AnswerSetId
import dev.dres.data.model.submissions.DbAnswerSet
import dev.dres.data.model.submissions.DbVerdictStatus
import io.javalin.openapi.OpenApiIgnore
import io.javalin.openapi.OpenApiNullable
import kotlinx.dnq.query.addAll
import kotlinx.dnq.query.filter
import kotlinx.dnq.query.first
Expand All @@ -21,7 +22,12 @@ import java.util.*
* @version 1.0.0
*/
@Serializable
data class ApiClientAnswerSet(var taskId: String? = null, val taskName: String? = null, val answers: List<ApiClientAnswer>) {
data class ApiClientAnswerSet(
@get:OpenApiNullable
var taskId: String? = null,
@get:OpenApiNullable
val taskName: String? = null,
val answers: List<ApiClientAnswer>) {

/** The [AnswerSetId] of this [ApiClientAnswerSet]. Typically generated by the receiving endpoint. */
@JsonIgnore
Expand Down
25 changes: 16 additions & 9 deletions doc/oas-client.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"openapi" : "3.0.3",
"info" : {
"title" : "DRES Client API",
"version" : "2.0.2",
"description" : "Client API for DRES (Distributed Retrieval Evaluation Server), Version 2.0.2"
"version" : "2.0.3-SNAPSHOT",
"description" : "Client API for DRES (Distributed Retrieval Evaluation Server), Version 2.0.3-SNAPSHOT"
},
"paths" : {
"/api/v2/client/evaluation/currentTask/{evaluationId}" : {
Expand Down Expand Up @@ -1605,21 +1605,26 @@
"additionalProperties" : false,
"properties" : {
"text" : {
"type" : "string"
"type" : "string",
"nullable" : true
},
"mediaItemName" : {
"type" : "string"
"type" : "string",
"nullable" : true
},
"mediaItemCollectionName" : {
"type" : "string"
"type" : "string",
"nullable" : true
},
"start" : {
"type" : "integer",
"format" : "int64"
"format" : "int64",
"nullable" : true
},
"end" : {
"type" : "integer",
"format" : "int64"
"format" : "int64",
"nullable" : true
}
}
},
Expand All @@ -1628,10 +1633,12 @@
"additionalProperties" : false,
"properties" : {
"taskId" : {
"type" : "string"
"type" : "string",
"nullable" : true
},
"taskName" : {
"type" : "string"
"type" : "string",
"nullable" : true
},
"answers" : {
"type" : "array",
Expand Down
25 changes: 16 additions & 9 deletions doc/oas.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"openapi" : "3.0.3",
"info" : {
"title" : "DRES API",
"version" : "2.0.2",
"description" : "API for DRES (Distributed Retrieval Evaluation Server), Version 2.0.2",
"version" : "2.0.3-SNAPSHOT",
"description" : "API for DRES (Distributed Retrieval Evaluation Server), Version 2.0.3-SNAPSHOT",
"contact" : {
"name" : "The DRES Dev Team",
"url" : "https://dres.dev"
Expand Down Expand Up @@ -6019,21 +6019,26 @@
"additionalProperties" : false,
"properties" : {
"text" : {
"type" : "string"
"type" : "string",
"nullable" : true
},
"mediaItemName" : {
"type" : "string"
"type" : "string",
"nullable" : true
},
"mediaItemCollectionName" : {
"type" : "string"
"type" : "string",
"nullable" : true
},
"start" : {
"type" : "integer",
"format" : "int64"
"format" : "int64",
"nullable" : true
},
"end" : {
"type" : "integer",
"format" : "int64"
"format" : "int64",
"nullable" : true
}
}
},
Expand All @@ -6042,10 +6047,12 @@
"additionalProperties" : false,
"properties" : {
"taskId" : {
"type" : "string"
"type" : "string",
"nullable" : true
},
"taskName" : {
"type" : "string"
"type" : "string",
"nullable" : true
},
"answers" : {
"type" : "array",
Expand Down

0 comments on commit 38e9566

Please sign in to comment.