Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge main #277

Merged
merged 7 commits into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions oarepo_model_builder/builtin_models/oaipmh.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"properties": {
"oai": {
"properties": {
"harvest": {
"properties": {
"identifier": {
"type": "keyword",
"required": true
},
"datestamp": {
"type": "keyword",
"required": true

}
}
}
}
}
},
"service-config": {
"extend:components": [
"{{oarepo_oaipmh_harvester.components.OaiSectionComponent}}"
]
}
}
3 changes: 2 additions & 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.92
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 Expand Up @@ -94,6 +94,7 @@ oarepo_model_builder.datatypes.components =
oarepo.models =
invenio = oarepo_model_builder.builtin_models:invenio.json
doi = oarepo_model_builder.builtin_models:doi.json
oaipmh = oarepo_model_builder.builtin_models:oaipmh.json

# outputs are generic, profile independent
oarepo_model_builder.outputs =
Expand Down
25 changes: 20 additions & 5 deletions tests/test_include_doi.py → 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"],
"properties": {"a": {"type": "keyword", "required": True}},
OAREPO_USE: ["invenio", "doi", "oaipmh"],
"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]" in re.sub(r"\s", "", data)
assert (
"components=[*PermissionsPresetsConfigMixin.components,*InvenioRecordServiceConfig.components,DoiComponent,OaiSectionComponent]"
in re.sub(r"\s", "", data)
)
Loading