diff --git a/invenio_vocabularies/contrib/affiliations/jsonschemas/affiliations/affiliation-v1.0.0.json b/invenio_vocabularies/contrib/affiliations/jsonschemas/affiliations/affiliation-v1.0.0.json index 07524656..6c4f52e3 100644 --- a/invenio_vocabularies/contrib/affiliations/jsonschemas/affiliations/affiliation-v1.0.0.json +++ b/invenio_vocabularies/contrib/affiliations/jsonschemas/affiliations/affiliation-v1.0.0.json @@ -7,13 +7,18 @@ "$schema": { "$ref": "local://definitions-v1.0.0.json#/$schema" }, + "tags": { + "$ref": "local://vocabularies/definitions-v1.0.0.json#/tags" + }, "acronym": { "type": "string" }, "identifiers": { "description": "Alternate identifiers for the record.", "type": "array", - "items": {"$ref": "local://definitions-v1.0.0.json#/identifiers_with_scheme"}, + "items": { + "$ref": "local://definitions-v1.0.0.json#/identifiers_with_scheme" + }, "uniqueItems": true }, "name": { diff --git a/invenio_vocabularies/contrib/affiliations/mappings/os-v1/affiliations/affiliation-v1.0.0.json b/invenio_vocabularies/contrib/affiliations/mappings/os-v1/affiliations/affiliation-v1.0.0.json index 07429f3b..ab2f4fd1 100644 --- a/invenio_vocabularies/contrib/affiliations/mappings/os-v1/affiliations/affiliation-v1.0.0.json +++ b/invenio_vocabularies/contrib/affiliations/mappings/os-v1/affiliations/affiliation-v1.0.0.json @@ -85,6 +85,9 @@ "title": { "type": "object", "dynamic": "true" + }, + "tags": { + "type": "keyword" } } } diff --git a/invenio_vocabularies/contrib/affiliations/mappings/os-v2/affiliations/affiliation-v1.0.0.json b/invenio_vocabularies/contrib/affiliations/mappings/os-v2/affiliations/affiliation-v1.0.0.json index 07429f3b..ab2f4fd1 100644 --- a/invenio_vocabularies/contrib/affiliations/mappings/os-v2/affiliations/affiliation-v1.0.0.json +++ b/invenio_vocabularies/contrib/affiliations/mappings/os-v2/affiliations/affiliation-v1.0.0.json @@ -85,6 +85,9 @@ "title": { "type": "object", "dynamic": "true" + }, + "tags": { + "type": "keyword" } } } diff --git a/invenio_vocabularies/contrib/affiliations/mappings/v7/affiliations/affiliation-v1.0.0.json b/invenio_vocabularies/contrib/affiliations/mappings/v7/affiliations/affiliation-v1.0.0.json index 07429f3b..ab2f4fd1 100644 --- a/invenio_vocabularies/contrib/affiliations/mappings/v7/affiliations/affiliation-v1.0.0.json +++ b/invenio_vocabularies/contrib/affiliations/mappings/v7/affiliations/affiliation-v1.0.0.json @@ -85,6 +85,9 @@ "title": { "type": "object", "dynamic": "true" + }, + "tags": { + "type": "keyword" } } } diff --git a/invenio_vocabularies/contrib/awards/jsonschemas/awards/award-v1.0.0.json b/invenio_vocabularies/contrib/awards/jsonschemas/awards/award-v1.0.0.json index 5870517c..bdc2cfa1 100644 --- a/invenio_vocabularies/contrib/awards/jsonschemas/awards/award-v1.0.0.json +++ b/invenio_vocabularies/contrib/awards/jsonschemas/awards/award-v1.0.0.json @@ -7,6 +7,9 @@ "$schema": { "$ref": "local://definitions-v1.0.0.json#/$schema" }, + "tags": { + "$ref": "local://vocabularies/definitions-v1.0.0.json#/tags" + }, "identifiers": { "description": "Alternate identifiers for the award.", "type": "array", diff --git a/invenio_vocabularies/contrib/awards/mappings/os-v1/awards/award-v1.0.0.json b/invenio_vocabularies/contrib/awards/mappings/os-v1/awards/award-v1.0.0.json index 8fcdc343..90ec8049 100644 --- a/invenio_vocabularies/contrib/awards/mappings/os-v1/awards/award-v1.0.0.json +++ b/invenio_vocabularies/contrib/awards/mappings/os-v1/awards/award-v1.0.0.json @@ -49,6 +49,9 @@ "type": "object", "dynamic": "true" }, + "tags": { + "type": "keyword" + }, "number": { "type": "keyword" }, diff --git a/invenio_vocabularies/contrib/awards/mappings/os-v2/awards/award-v1.0.0.json b/invenio_vocabularies/contrib/awards/mappings/os-v2/awards/award-v1.0.0.json index 8fcdc343..90ec8049 100644 --- a/invenio_vocabularies/contrib/awards/mappings/os-v2/awards/award-v1.0.0.json +++ b/invenio_vocabularies/contrib/awards/mappings/os-v2/awards/award-v1.0.0.json @@ -49,6 +49,9 @@ "type": "object", "dynamic": "true" }, + "tags": { + "type": "keyword" + }, "number": { "type": "keyword" }, diff --git a/invenio_vocabularies/contrib/awards/mappings/v7/awards/award-v1.0.0.json b/invenio_vocabularies/contrib/awards/mappings/v7/awards/award-v1.0.0.json index 8fcdc343..90ec8049 100644 --- a/invenio_vocabularies/contrib/awards/mappings/v7/awards/award-v1.0.0.json +++ b/invenio_vocabularies/contrib/awards/mappings/v7/awards/award-v1.0.0.json @@ -49,6 +49,9 @@ "type": "object", "dynamic": "true" }, + "tags": { + "type": "keyword" + }, "number": { "type": "keyword" }, diff --git a/invenio_vocabularies/contrib/funders/jsonschemas/funders/funder-v1.0.0.json b/invenio_vocabularies/contrib/funders/jsonschemas/funders/funder-v1.0.0.json index 8df70747..1863fbec 100644 --- a/invenio_vocabularies/contrib/funders/jsonschemas/funders/funder-v1.0.0.json +++ b/invenio_vocabularies/contrib/funders/jsonschemas/funders/funder-v1.0.0.json @@ -7,6 +7,9 @@ "$schema": { "$ref": "local://definitions-v1.0.0.json#/$schema" }, + "tags": { + "$ref": "local://vocabularies/definitions-v1.0.0.json#/tags" + }, "country": { "type": "string", "description": "Represents a funder's origin country as a country code." diff --git a/invenio_vocabularies/contrib/funders/mappings/os-v1/funders/funder-v1.0.0.json b/invenio_vocabularies/contrib/funders/mappings/os-v1/funders/funder-v1.0.0.json index 97c32ed1..907dead1 100644 --- a/invenio_vocabularies/contrib/funders/mappings/os-v1/funders/funder-v1.0.0.json +++ b/invenio_vocabularies/contrib/funders/mappings/os-v1/funders/funder-v1.0.0.json @@ -81,6 +81,9 @@ "title": { "type": "object", "dynamic": "true" + }, + "tags": { + "type": "keyword" } } } diff --git a/invenio_vocabularies/contrib/funders/mappings/os-v2/funders/funder-v1.0.0.json b/invenio_vocabularies/contrib/funders/mappings/os-v2/funders/funder-v1.0.0.json index 97c32ed1..907dead1 100644 --- a/invenio_vocabularies/contrib/funders/mappings/os-v2/funders/funder-v1.0.0.json +++ b/invenio_vocabularies/contrib/funders/mappings/os-v2/funders/funder-v1.0.0.json @@ -81,6 +81,9 @@ "title": { "type": "object", "dynamic": "true" + }, + "tags": { + "type": "keyword" } } } diff --git a/invenio_vocabularies/contrib/funders/mappings/v7/funders/funder-v1.0.0.json b/invenio_vocabularies/contrib/funders/mappings/v7/funders/funder-v1.0.0.json index 97c32ed1..907dead1 100644 --- a/invenio_vocabularies/contrib/funders/mappings/v7/funders/funder-v1.0.0.json +++ b/invenio_vocabularies/contrib/funders/mappings/v7/funders/funder-v1.0.0.json @@ -81,6 +81,9 @@ "title": { "type": "object", "dynamic": "true" + }, + "tags": { + "type": "keyword" } } } diff --git a/invenio_vocabularies/contrib/names/jsonschemas/names/name-v1.0.0.json b/invenio_vocabularies/contrib/names/jsonschemas/names/name-v1.0.0.json index e2d4d04e..78ae9dbe 100644 --- a/invenio_vocabularies/contrib/names/jsonschemas/names/name-v1.0.0.json +++ b/invenio_vocabularies/contrib/names/jsonschemas/names/name-v1.0.0.json @@ -8,6 +8,9 @@ "$schema": { "$ref": "local://definitions-v1.0.0.json#/$schema" }, + "tags": { + "$ref": "local://vocabularies/definitions-v1.0.0.json#/tags" + }, "scheme": { "description": "Identifier of the name scheme.", "$ref": "local://definitions-v1.0.0.json#/identifier" diff --git a/invenio_vocabularies/contrib/names/mappings/os-v1/names/name-v1.0.0.json b/invenio_vocabularies/contrib/names/mappings/os-v1/names/name-v1.0.0.json index 60b32b33..d99b8918 100644 --- a/invenio_vocabularies/contrib/names/mappings/os-v1/names/name-v1.0.0.json +++ b/invenio_vocabularies/contrib/names/mappings/os-v1/names/name-v1.0.0.json @@ -24,6 +24,9 @@ "id": { "type": "keyword" }, + "tags": { + "type": "keyword" + }, "name_sort": { "type": "keyword" }, diff --git a/invenio_vocabularies/contrib/names/mappings/os-v2/names/name-v1.0.0.json b/invenio_vocabularies/contrib/names/mappings/os-v2/names/name-v1.0.0.json index 60b32b33..d99b8918 100644 --- a/invenio_vocabularies/contrib/names/mappings/os-v2/names/name-v1.0.0.json +++ b/invenio_vocabularies/contrib/names/mappings/os-v2/names/name-v1.0.0.json @@ -24,6 +24,9 @@ "id": { "type": "keyword" }, + "tags": { + "type": "keyword" + }, "name_sort": { "type": "keyword" }, diff --git a/invenio_vocabularies/contrib/names/mappings/v7/names/name-v1.0.0.json b/invenio_vocabularies/contrib/names/mappings/v7/names/name-v1.0.0.json index 60b32b33..d99b8918 100644 --- a/invenio_vocabularies/contrib/names/mappings/v7/names/name-v1.0.0.json +++ b/invenio_vocabularies/contrib/names/mappings/v7/names/name-v1.0.0.json @@ -24,6 +24,9 @@ "id": { "type": "keyword" }, + "tags": { + "type": "keyword" + }, "name_sort": { "type": "keyword" }, diff --git a/invenio_vocabularies/contrib/subjects/jsonschemas/subjects/subject-v1.0.0.json b/invenio_vocabularies/contrib/subjects/jsonschemas/subjects/subject-v1.0.0.json index a51629d4..e0192786 100644 --- a/invenio_vocabularies/contrib/subjects/jsonschemas/subjects/subject-v1.0.0.json +++ b/invenio_vocabularies/contrib/subjects/jsonschemas/subjects/subject-v1.0.0.json @@ -8,6 +8,9 @@ "$schema": { "$ref": "local://definitions-v1.0.0.json#/$schema" }, + "tags": { + "$ref": "local://vocabularies/definitions-v1.0.0.json#/tags" + }, "id": { "description": "URI or classification code as identifier - globally unique among all subject schemes.", "$ref": "local://definitions-v1.0.0.json#/identifier" diff --git a/invenio_vocabularies/contrib/subjects/mappings/os-v1/subjects/subject-v1.0.0.json b/invenio_vocabularies/contrib/subjects/mappings/os-v1/subjects/subject-v1.0.0.json index 72e47bb6..0e635f39 100644 --- a/invenio_vocabularies/contrib/subjects/mappings/os-v1/subjects/subject-v1.0.0.json +++ b/invenio_vocabularies/contrib/subjects/mappings/os-v1/subjects/subject-v1.0.0.json @@ -55,6 +55,9 @@ "type": "keyword" } } + }, + "tags": { + "type": "keyword" } } } diff --git a/invenio_vocabularies/contrib/subjects/mappings/os-v2/subjects/subject-v1.0.0.json b/invenio_vocabularies/contrib/subjects/mappings/os-v2/subjects/subject-v1.0.0.json index 72e47bb6..0e635f39 100644 --- a/invenio_vocabularies/contrib/subjects/mappings/os-v2/subjects/subject-v1.0.0.json +++ b/invenio_vocabularies/contrib/subjects/mappings/os-v2/subjects/subject-v1.0.0.json @@ -55,6 +55,9 @@ "type": "keyword" } } + }, + "tags": { + "type": "keyword" } } } diff --git a/invenio_vocabularies/contrib/subjects/mappings/v7/subjects/subject-v1.0.0.json b/invenio_vocabularies/contrib/subjects/mappings/v7/subjects/subject-v1.0.0.json index 72e47bb6..0e635f39 100644 --- a/invenio_vocabularies/contrib/subjects/mappings/v7/subjects/subject-v1.0.0.json +++ b/invenio_vocabularies/contrib/subjects/mappings/v7/subjects/subject-v1.0.0.json @@ -55,6 +55,9 @@ "type": "keyword" } } + }, + "tags": { + "type": "keyword" } } } diff --git a/invenio_vocabularies/records/jsonschemas/vocabularies/definitions-v1.0.0.json b/invenio_vocabularies/records/jsonschemas/vocabularies/definitions-v1.0.0.json index 78318893..62a7362a 100644 --- a/invenio_vocabularies/records/jsonschemas/vocabularies/definitions-v1.0.0.json +++ b/invenio_vocabularies/records/jsonschemas/vocabularies/definitions-v1.0.0.json @@ -10,5 +10,12 @@ }, "icon": { "type": "string" + }, + "tags": { + "type": "array", + "description": "Tags for a vocabulary item.", + "items": { + "type": "string" + } } } diff --git a/invenio_vocabularies/records/jsonschemas/vocabularies/vocabulary-v1.0.0.json b/invenio_vocabularies/records/jsonschemas/vocabularies/vocabulary-v1.0.0.json index 62e98a37..3511a0c8 100644 --- a/invenio_vocabularies/records/jsonschemas/vocabularies/vocabulary-v1.0.0.json +++ b/invenio_vocabularies/records/jsonschemas/vocabularies/vocabulary-v1.0.0.json @@ -34,10 +34,7 @@ } }, "tags": { - "type": "array", - "items": { - "type": "string" - } + "$ref": "local://vocabularies/definitions-v1.0.0.json#/tags" }, "title": { "$ref": "local://vocabularies/definitions-v1.0.0.json#/title" diff --git a/invenio_vocabularies/services/schema.py b/invenio_vocabularies/services/schema.py index 83342572..60ca2c70 100644 --- a/invenio_vocabularies/services/schema.py +++ b/invenio_vocabularies/services/schema.py @@ -90,13 +90,13 @@ class BaseVocabularySchema(BaseRecordSchema): title = i18n_strings description = i18n_strings icon = fields.Str(allow_none=False) + tags = fields.List(SanitizedUnicode()) class VocabularySchema(BaseVocabularySchema): """Service schema for vocabulary records.""" props = fields.Dict(allow_none=False, keys=fields.Str(), values=fields.Str()) - tags = fields.List(SanitizedUnicode()) type = fields.Str(attribute="type.id", required=True) diff --git a/tests/mock_module/jsonschemas/records/record-v1.0.0.json b/tests/mock_module/jsonschemas/records/record-v1.0.0.json index ed4d4816..dfe984bc 100644 --- a/tests/mock_module/jsonschemas/records/record-v1.0.0.json +++ b/tests/mock_module/jsonschemas/records/record-v1.0.0.json @@ -9,6 +9,9 @@ "description": "JSONSchema declaration.", "type": "string" }, + "tags": { + "$ref": "local://vocabularies/definitions-v1.0.0.json#/tags" + }, "id": { "description": "Persistent record identifier (alphanumeric).", "type": "string"