[Dump Schemas] changed the schema of the dumped result according to the modifications in the bestAccessRight type

This commit is contained in:
Miriam Baglioni 2021-11-12 11:45:38 +01:00
parent 43cae4ad88
commit 6595135a1a
2 changed files with 41 additions and 58 deletions

View File

@ -1,33 +1,6 @@
{ {
"$schema": "http://json-schema.org/draft-07/schema#", "$schema": "http://json-schema.org/draft-07/schema#",
"definitions": { "definitions": {
"AccessRight":{
"type":"object",
"properties":{
"code": {
"type": "string",
"description": "COAR access mode code: http://vocabularies.coar-repositories.org/documentation/access_rights/"
},
"label": {
"type": "string",
"description": "Label for the access mode"
},
"openAccessRoute":{
"type":"string",
"enum":[
"gold",
"green",
"hybrid",
"bronze"
],
"description":"The type of OpenAccess applied to the result"
},
"scheme": {
"type": "string",
"description": "Scheme of reference for access right code. Always set to COAR access rights vocabulary: http://vocabularies.coar-repositories.org/documentation/access_rights/"
}
}
},
"ControlledField": { "ControlledField": {
"type": "object", "type": "object",
"properties": { "properties": {
@ -94,14 +67,21 @@
} }
}, },
"bestaccessright":{ "bestaccessright":{
"allOf":[ "type":"object",
{ "properties":{
"$ref":"#/definitions/AccessRight" "code": {
"type": "string",
"description": "COAR access mode code: http://vocabularies.coar-repositories.org/documentation/access_rights/"
}, },
{ "label": {
"description":"The openest access right associated to the manifestations of this research results" "type": "string",
"description": "Label for the access mode"
},
"scheme": {
"type": "string",
"description": "Scheme of reference for access right code. Always set to COAR access rights vocabulary: http://vocabularies.coar-repositories.org/documentation/access_rights/"
}
} }
]
}, },
"codeRepositoryUrl": { "codeRepositoryUrl": {
"type": "string", "type": "string",
@ -255,27 +235,30 @@
"type":"object", "type":"object",
"properties":{ "properties":{
"accessright":{ "accessright":{
"allOf":[ "type":"object",
{ "properties":{
"$ref":"#/definitions/AccessRight" "code": {
"type": "string",
"description": "COAR access mode code: http://vocabularies.coar-repositories.org/documentation/access_rights/"
}, },
{ "label": {
"description":"The accessright of this instance. One result may have multiple instances, each with a different accessright" "type": "string",
"description": "Label for the access mode"
},
"openAccessRoute":{
"type":"string",
"enum":[
"gold",
"green",
"hybrid",
"bronze"
],
"description":"The type of OpenAccess applied to the result"
},
"scheme": {
"type": "string",
"description": "Scheme of reference for access right code. Always set to COAR access rights vocabulary: http://vocabularies.coar-repositories.org/documentation/access_rights/"
} }
]
},
"alternateIdentifier":{
"description":"All the identifiers associated to the result other than the authoritative ones",
"type":"array",
"items":{
"allOf":[
{
"$ref":"#/definitions/ControlledField"
},
{
"description":"Description of alternateIdentifier"
}
]
} }
}, },
"articleprocessingcharge":{ "articleprocessingcharge":{

View File

@ -9,7 +9,7 @@ import com.github.victools.jsonschema.generator.*;
import eu.dnetlib.dhp.schema.dump.oaf.graph.*; import eu.dnetlib.dhp.schema.dump.oaf.graph.*;
@Disabled //@Disabled
class GenerateJsonSchema { class GenerateJsonSchema {
@Test @Test
@ -21,7 +21,7 @@ class GenerateJsonSchema {
configBuilder.forFields().withDescriptionResolver(field -> "Description of " + field.getDeclaredName()); configBuilder.forFields().withDescriptionResolver(field -> "Description of " + field.getDeclaredName());
SchemaGeneratorConfig config = configBuilder.build(); SchemaGeneratorConfig config = configBuilder.build();
SchemaGenerator generator = new SchemaGenerator(config); SchemaGenerator generator = new SchemaGenerator(config);
JsonNode jsonSchema = generator.generateSchema(Relation.class); JsonNode jsonSchema = generator.generateSchema(GraphResult.class);
System.out.println(jsonSchema.toString()); System.out.println(jsonSchema.toString());
} }