diff --git a/oarepo_model_builder/builtin_models/oaipmh.json b/oarepo_model_builder/builtin_models/oaipmh.json new file mode 100644 index 0000000..ff6ca79 --- /dev/null +++ b/oarepo_model_builder/builtin_models/oaipmh.json @@ -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}}" + ] + } +} \ No newline at end of file diff --git a/setup.cfg b/setup.cfg index e1fc583..e353fcd 100644 --- a/setup.cfg +++ b/setup.cfg @@ -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 , Miroslav Simek readme = README.md @@ -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 = diff --git a/tests/test_include_doi.py b/tests/test_include_components.py similarity index 50% rename from tests/test_include_doi.py rename to tests/test_include_components.py index 62e4e1e..b740165 100644 --- a/tests/test_include_doi.py +++ b/tests/test_include_components.py @@ -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, @@ -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) \ No newline at end of file + assert ( + "components=[*PermissionsPresetsConfigMixin.components,*InvenioRecordServiceConfig.components,DoiComponent,OaiSectionComponent]" + in re.sub(r"\s", "", data) + )