Skip to content

Commit

Permalink
Merge pull request #32 from oarepo/scoped_schemas
Browse files Browse the repository at this point in the history
Scope field names in data model
  • Loading branch information
mirekys authored Aug 30, 2021
2 parents 21c959f + 01c2c96 commit 004e693
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 1 deletion.
17 changes: 17 additions & 0 deletions oarepo_communities/datamodels/communities-v2.0.0.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"definitions": {
"oarepo:secondaryCommunities": {
"type": "array",
"items": {
"type": "string",
},
"description": "List of secondary community IDs where the record is also available",
"minItems": 1,
"uniqueItems": true
},
"oarepo:primaryCommunity": {
"type": "string",
"description": "Primary community ID of the record"
}
}
}
12 changes: 12 additions & 0 deletions oarepo_communities/included_mappings/v7/communities-v2.0.0.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"Communities": {
"properties": {
"oarepo:secondaryCommunities": {
"type": "keyword"
},
"oarepo:primaryCommunity": {
"type": "keyword"
}
}
}
}
24 changes: 24 additions & 0 deletions oarepo_communities/jsonschemas/communities-v2.0.0.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"definitions": {
"Communities": {
"title": "OARepo Communities fields v1.0.0",
"type": "object",
"properties": {
"oarepo:primaryCommunity": {
"type": "string",
"description": "Primary community ID of the record"
},
"oarepo:secondaryCommunities": {
"type": "array",
"items": {
"type": "string",
"description": "List of secondary community IDs where the record is also published"
}
}
},
"required": [
"oarepo:primaryCommunity"
]
}
}
}
9 changes: 9 additions & 0 deletions oarepo_communities/marshmallow/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,12 @@
class OARepoCommunitiesMixin(Schema):
_primary_community = SanitizedUnicode(required=True)
_communities = List(SanitizedUnicode, default=list)


class OARepoCommunitiesMixinV2(Schema):
_primary_community = SanitizedUnicode(required=True,
data_key='oarepo:primaryCommunity',
attribute='oarepo:primaryCommunity')
_secondary_communities = List(SanitizedUnicode, default=list,
data_key='oarepo:secondaryCommunities',
attribute='oarepo:secondaryCommunities')
2 changes: 1 addition & 1 deletion oarepo_communities/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@
and parsed by ``setup.py``.
"""

__version__ = '2.3.1'
__version__ = '2.4.0'

0 comments on commit 004e693

Please sign in to comment.