Skip to content

Commit

Permalink
creating discriminator for different granularitiesin resultsets response
Browse files Browse the repository at this point in the history
  • Loading branch information
costero-e committed Jun 28, 2024
1 parent 5335e76 commit 989b5d5
Show file tree
Hide file tree
Showing 2 changed files with 86 additions and 16 deletions.
16 changes: 2 additions & 14 deletions framework/json/responses/beaconResultsetsResponse.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,8 @@
"description": "Information about the response that could be relevant for the Beacon client in order to interpret the results."
},
"response": {
"oneOf": [
{
"$ref": "./sections/beaconResultsets.json",
"description": "Response for queries that recovers any result."
},
{
"$ref": "./sections/beaconCountResultsets.json",
"description": "Response for queries that recovers any result."
},
{
"$ref": "./sections/beaconBooleanResultsets.json",
"description": "Response for queries that recovers any result."
}
]
"$ref": "./sections/beaconResultsets.json",
"description": "Response for queries that recovers any result."
},
"responseSummary": {
"$ref": "./sections/beaconSummaryResponseSection.json",
Expand Down
86 changes: 84 additions & 2 deletions framework/json/responses/sections/beaconResultsets.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"ResultsetInstance": {
"additionalProperties": true,
"properties": {
"returnedGranularity": { "const": "record" },
"exists": {
"type": "boolean"
},
Expand Down Expand Up @@ -45,6 +46,77 @@
"resultsCount",
"results"
]
},
"CountResultsetInstance": {
"additionalProperties": true,
"properties": {
"returnedGranularity": { "const": "count" },
"exists": {
"type": "boolean"
},
"id": {
"description": "id of the CountResultset",
"example": "datasetA",
"type": "string"
},
"info": {
"description": "Additional details that could be of interest about the CountResultset. Provided to clearly enclose any attribute that is not part of the Beacon specification.",
"type": "object"
},
"resultsCount": {
"description": "Number of results in this CountResultset.",
"type": "integer"
},
"resultsHandovers": {
"$ref": "../../common/beaconCommonComponents.json#/definitions/ListOfHandovers",
"description": "List of handovers that apply to this CountResultset, not to the whole Beacon or to a result in particular."
},
"setType": {
"default": "dataset",
"description": "Entry type of CountResultset. It SHOULD MATCH an entry type declared as collection in the Beacon configuration.",
"type": "string"
}
},
"required": [
"returnedGranularity",
"id",
"setType",
"exists",
"resultsCount"
]
},
"BooleanResultsetInstance": {
"additionalProperties": true,
"properties": {
"returnedGranularity": { "const": "boolean" },
"exists": {
"type": "boolean"
},
"id": {
"description": "id of the BooleanResultset",
"example": "datasetA",
"type": "string"
},
"info": {
"description": "Additional details that could be of interest about the BooleanResultset. Provided to clearly enclose any attribute that is not part of the Beacon specification.",
"type": "object"
},
"resultsHandovers": {
"$ref": "../../common/beaconCommonComponents.json#/definitions/ListOfHandovers",
"description": "List of handovers that apply to this BooleanResultset, not to the whole Beacon or to a result in particular."
},
"setType": {
"default": "dataset",
"description": "Entry type of BooleanResultset. It SHOULD MATCH an entry type declared as collection in the Beacon configuration.",
"type": "string"
}
},
"required": [
"returnedGranularity",
"id",
"setType",
"exists"
]
}
},
"description": "Sets of results to be returned as query response.",
Expand All @@ -54,12 +126,22 @@
},
"resultSets": {
"items": {
"$ref": "#/definitions/ResultsetInstance"
"oneOf": [
{
"$ref": "#/definitions/ResultsetInstance"
},
{
"$ref": "#/definitions/CountResultsetInstance"
},
{
"$ref": "#/definitions/BooleanResultsetInstance"
}
]
},
"minItems": 0,
"type": "array"
}
},
},
"required": [
"resultSets"
],
Expand Down

0 comments on commit 989b5d5

Please sign in to comment.