Skip to content

Commit 6d37ea8

Browse files
committed
v0.0.9
1 parent 17a3f0e commit 6d37ea8

File tree

5 files changed

+58
-32
lines changed

5 files changed

+58
-32
lines changed

beacon-v2-validator-code/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!--
3-
Copyright (C) 2024 Spanish National Bioinformatics Institute (INB) and
3+
Copyright (C) 2025 Spanish National Bioinformatics Institute (INB) and
44
Barcelona Supercomputing Center
55
66
Modifications to the initial code base are copyright of their respective
@@ -27,7 +27,7 @@
2727
<parent>
2828
<groupId>es.bsc.inb.ga4gh</groupId>
2929
<artifactId>neat-beacon-v2-validator</artifactId>
30-
<version>0.0.8</version>
30+
<version>0.0.9</version>
3131
</parent>
3232

3333
<artifactId>beacon-v2-validator-code</artifactId>

beacon-v2-validator-code/src/main/java/es/bsc/inb/ga4gh/beacon/validator/BeaconEndpointValidator.java

Lines changed: 37 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@
3333
import es.bsc.inb.ga4gh.beacon.framework.model.v200.responses.AbstractBeaconResponse;
3434
import es.bsc.inb.ga4gh.beacon.framework.model.v200.responses.BeaconCollections;
3535
import es.bsc.inb.ga4gh.beacon.framework.model.v200.responses.BeaconCollectionsResponse;
36+
import es.bsc.inb.ga4gh.beacon.framework.model.v200.responses.BeaconInformationalResponse;
3637
import es.bsc.inb.ga4gh.beacon.framework.model.v200.responses.BeaconInformationalResponseMeta;
38+
import es.bsc.inb.ga4gh.beacon.framework.model.v200.responses.BeaconResponseMeta;
3739
import es.bsc.inb.ga4gh.beacon.framework.model.v200.responses.BeaconResultset;
3840
import es.bsc.inb.ga4gh.beacon.framework.model.v200.responses.BeaconResultsets;
3941
import es.bsc.inb.ga4gh.beacon.framework.model.v200.responses.BeaconResultsetsResponse;
@@ -211,18 +213,34 @@ private String resolveTemplateParameters(String template, JsonObject entry) {
211213
return single_entry_endpoint.toString();
212214
}
213215

214-
private String getSchemaURL(String entityType) {
215-
if (model.info != null) {
216-
final BeaconInformationalResponseMeta meta = model.info.getMeta();
217-
final List<SchemaPerEntity> returnedSchemas = meta.getReturnedSchemas();
218-
if (returnedSchemas != null) {
219-
for (SchemaPerEntity returnedSchema : returnedSchemas) {
220-
if (entityType.equals(returnedSchema.getEntityType())) {
221-
return returnedSchema.getSchema();
222-
}
216+
private String getSchemaURL(AbstractBeaconResponse response, String entityType) {
217+
final BeaconResponseMeta meta = response.getMeta();
218+
if (meta != null) {
219+
final String schemaURL = getSchemaURL(meta.getReturnedSchemas(), entityType);
220+
if (schemaURL != null) {
221+
return schemaURL;
222+
}
223+
}
224+
225+
return getSchemaURL(model.info, entityType);
226+
}
227+
228+
private String getSchemaURL(List<SchemaPerEntity> schemas, String entityType) {
229+
if (schemas != null) {
230+
for (SchemaPerEntity schema : schemas) {
231+
if (entityType.equals(schema.getEntityType())) {
232+
return schema.getSchema();
223233
}
224234
}
225235
}
236+
return null;
237+
}
238+
239+
private String getSchemaURL(BeaconInformationalResponse response, String entityType) {
240+
final BeaconInformationalResponseMeta meta = response.getMeta();
241+
if (meta != null) {
242+
return getSchemaURL(meta.getReturnedSchemas(), entityType);
243+
}
226244

227245
if (model.configuration != null) {
228246
final BeaconConfiguration configuration = model.configuration.getResponse();
@@ -239,7 +257,7 @@ private String getSchemaURL(String entityType) {
239257

240258
return null;
241259
}
242-
260+
243261
private AbstractBeaconResponse validateEntryEndpoint(String endpoint,
244262
ValidationObserver reporter) {
245263

@@ -285,10 +303,14 @@ private AbstractBeaconResponse validateEntryEndpoint(String endpoint,
285303
private JsonObject validateResponse(AbstractBeaconResponse response,
286304
String entryType, ValidationObserver reporter) {
287305

288-
JsonObject entry = null;
289-
290-
final String entryTypeSchema = (entryType == null) ? null : getSchemaURL(entryType);
291-
final JsonSchema schema = model.loadSchema(entryTypeSchema, entryType, reporter);
306+
final JsonSchema schema;
307+
if (entryType == null) {
308+
schema = null;
309+
} else {
310+
final String entryTypeSchema = getSchemaURL(response, entryType);
311+
schema = entryTypeSchema == null ? null :
312+
model.loadSchema(entryTypeSchema, entryType, reporter);
313+
}
292314

293315
final List<JsonObject> entries = new ArrayList();
294316
if (response instanceof BeaconCollectionsResponse res) {
@@ -308,6 +330,7 @@ private JsonObject validateResponse(AbstractBeaconResponse response,
308330
}
309331
}
310332

333+
JsonObject entry = null;
311334
if (schema != null) {
312335
final List<ValidationError> errors = new ArrayList();
313336
for (JsonObject obj : entries) {

beacon-v2-validator-code/src/main/java/es/bsc/inb/ga4gh/beacon/validator/BeaconMetadataModel.java

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -105,15 +105,18 @@ private void loadInfoSchemas(ValidationObserver reporter) {
105105
if (returnedSchemas != null) {
106106
for (int i = 0, n = returnedSchemas.size(); i < n; i++) {
107107
final SchemaPerEntity returnedSchema = returnedSchemas.get(i);
108-
final List<BeaconValidationMessage> err = new ArrayList();
109-
loadSchema(returnedSchema.getSchema(), returnedSchema.getEntityType(),
110-
new ValidationErrorsCollector(err));
111-
112-
// set up 'location'
113-
for (BeaconValidationMessage e : err) {
114-
reporter.error(new BeaconValidationMessage(
115-
e.type, e.code, String.format("/info/meta/returnedSchemas/%d/schema", i),
116-
e.path, e.message));
108+
final String schema = returnedSchema.getSchema();
109+
if (schema != null) {
110+
final List<BeaconValidationMessage> err = new ArrayList();
111+
loadSchema(schema, returnedSchema.getEntityType(),
112+
new ValidationErrorsCollector(err));
113+
114+
// set up 'location'
115+
for (BeaconValidationMessage e : err) {
116+
reporter.error(new BeaconValidationMessage(
117+
e.type, e.code, String.format("/info/meta/returnedSchemas/%d/schema", i),
118+
e.path, e.message));
119+
}
117120
}
118121
}
119122
}

beacon-v2-validator-tool/pom.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!--
3-
Copyright (C) 2024 Spanish National Bioinformatics Institute (INB) and
3+
Copyright (C) 2025 Spanish National Bioinformatics Institute (INB) and
44
Barcelona Supercomputing Center
55
66
Modifications to the initial code base are copyright of their respective
@@ -27,7 +27,7 @@
2727
<parent>
2828
<groupId>es.bsc.inb.ga4gh</groupId>
2929
<artifactId>neat-beacon-v2-validator</artifactId>
30-
<version>0.0.8</version>
30+
<version>0.0.9</version>
3131
</parent>
3232

3333
<artifactId>beacon-v2-validator-tool</artifactId>
@@ -56,14 +56,14 @@
5656
<maven.compiler.target>17</maven.compiler.target>
5757

5858
<org.eclipse.parsson.version>1.1.3</org.eclipse.parsson.version>
59-
<org.eclipse.yasson.version>3.0.4-SNAPSHOT</org.eclipse.yasson.version>
59+
<org.eclipse.yasson.version>3.0.4</org.eclipse.yasson.version>
6060
</properties>
6161

6262
<dependencies>
6363
<dependency>
6464
<groupId>es.bsc.inb.ga4gh</groupId>
6565
<artifactId>beacon-v2-validator-code</artifactId>
66-
<version>0.0.8</version>
66+
<version>0.0.9</version>
6767
</dependency>
6868

6969
<dependency>

pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!--
3-
Copyright (C) 2024 Spanish National Bioinformatics Institute (INB) and
3+
Copyright (C) 2025 Spanish National Bioinformatics Institute (INB) and
44
Barcelona Supercomputing Center
55
66
Modifications to the initial code base are copyright of their respective
@@ -25,7 +25,7 @@
2525
<modelVersion>4.0.0</modelVersion>
2626
<groupId>es.bsc.inb.ga4gh</groupId>
2727
<artifactId>neat-beacon-v2-validator</artifactId>
28-
<version>0.0.8</version>
28+
<version>0.0.9</version>
2929
<packaging>pom</packaging>
3030

3131
<description>
@@ -65,7 +65,7 @@
6565

6666
<jakarta.json.version>2.1.0</jakarta.json.version>
6767
<jakarta.json.bind.version>3.0.0</jakarta.json.bind.version>
68-
<jakarta.jaronuinga.version>0.5.3</jakarta.jaronuinga.version>
68+
<jakarta.jaronuinga.version>0.5.6</jakarta.jaronuinga.version>
6969
</properties>
7070

7171
<repositories>

0 commit comments

Comments
 (0)