Skip to content

Commit

Permalink
Merge pull request #276 from oarepo/trappl/be-514-include-oai-object-…
Browse files Browse the repository at this point in the history
…to-model-builder

Trappl/be 514 include oai object to model builder
  • Loading branch information
jurajtrappl authored Oct 31, 2024
2 parents dda850d + 815719d commit 26e953c
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 11 deletions.
29 changes: 23 additions & 6 deletions oarepo_model_builder/builtin_models/oaipmh.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,26 @@
{
"service-config": {
"extend:components": [
"{{oarepo_oaipmh_harvester.components.OaiSectionComponent}}"
]
"properties": {
"oai": {
"properties": {
"harvest": {
"properties": {
"identifier": {
"type": "keyword",
"required": true
},
"datestamp": {
"type": "keyword",
"required": true

}
}
}
}
}
},
"service-config": {
"extend:components": [
"{{oarepo_oaipmh_harvester.components.OaiSectionComponent}}"
]
}


}
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = oarepo-model-builder
version = 4.0.93
version = 4.0.94
description = A utility library that generates OARepo required data model files from a JSON specification file
authors = Miroslav Bauer <[email protected]>, Miroslav Simek <[email protected]>
readme = README.md
Expand Down
23 changes: 19 additions & 4 deletions tests/test_include_components.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,29 @@
OAREPO_USE = "use"



def test_include_invenio():
schema = load_model(
"test.yaml", # NOSONAR
model_content={
"version": "1.0.0",

"record": {
"module": {"qualified": "test"},
OAREPO_USE: ["invenio", "doi", "oaipmh"],
"properties": {"a": {"type": "keyword", "required": True}},
"properties": {
"a": {"type": "keyword", "required": True},
"harvest": {
"properties": {
"identifier": {
"type": "keyword",
"required": True
},
"datestamp": {
"type": "keyword",
"required": True
},
}
},
},
},
},
isort=False,
Expand All @@ -36,4 +48,7 @@ def test_include_invenio():
os.path.join("test", "services", "records", "config.py")
).read()
data = str(data)
assert "components=[*PermissionsPresetsConfigMixin.components,*InvenioRecordServiceConfig.components,DoiComponent,OaiSectionComponent]" in re.sub(r"\s", "", data)
assert (
"components=[*PermissionsPresetsConfigMixin.components,*InvenioRecordServiceConfig.components,DoiComponent,OaiSectionComponent]"
in re.sub(r"\s", "", data)
)

0 comments on commit 26e953c

Please sign in to comment.