diff --git a/docs/endpoints/collection.rst b/docs/endpoints/collection.rst --- a/docs/endpoints/collection.rst +++ b/docs/endpoints/collection.rst @@ -51,11 +51,13 @@ - 10 - Sept. 26, 2017, 10:32 a.m. - None - deposited + xmlns:dcterms="http://purl.org/dc/terms/" + xmlns:swhdeposit="https://www.softwareheritage.org/schema/2018/deposit" + > + 10 + Sept. 26, 2017, 10:32 a.m. + None + deposited @@ -69,6 +71,11 @@ http://purl.org/net/sword/package/SimpleZip + Note: older versions of the deposit used the ``http://www.w3.org/2005/Atom`` + namespace instead of ``https://www.softwareheritage.org/schema/2018/deposit``. + Tags in the Atom namespace are still provided for backward compatibility, but + are deprecated. + :reqheader Authorization: Basic authentication token :reqheader Content-Type: accepted mimetype :reqheader Content-Length: tarball size diff --git a/docs/endpoints/content.rst b/docs/endpoints/content.rst --- a/docs/endpoints/content.rst +++ b/docs/endpoints/content.rst @@ -36,13 +36,20 @@ - 1 - done - The deposit has been successfully loaded into the Software Heritage archive - Oct. 28, 2020, 3:58 p.m. + xmlns:dcterms="http://purl.org/dc/terms/" + xmlns:swhdeposit="https://www.softwareheritage.org/schema/2018/deposit" + > + 1 + Oct. 28, 2020, 3:58 p.m. + done + The deposit has been successfully loaded into the Software Heritage archive + Note: older versions of the deposit used the ``http://www.w3.org/2005/Atom`` + namespace instead of ``https://www.softwareheritage.org/schema/2018/deposit``. + Tags in the Atom namespace are still provided for backward compatibility, but + are deprecated. + :reqheader Authorization: Basic authentication token :statuscode 200: no error diff --git a/docs/endpoints/status.rst b/docs/endpoints/status.rst --- a/docs/endpoints/status.rst +++ b/docs/endpoints/status.rst @@ -33,12 +33,14 @@ - 160 - done - The deposit has been successfully loaded into the Software Heritage archive - swh:1:dir:d83b7dda887dc790f7207608474650d4344b8df9 - swh:1:dir:d83b7dda887dc790f7207608474650d4344b8df9;origin=https://forge.softwareheritage.org/source/jesuisgpl/;visit=swh:1:snp:68c0d26104d47e278dd6be07ed61fafb561d0d20;anchor=swh:1:rev:e76ea49c9ffbb7f73611087ba6e999b19e5d71eb;path=/ + xmlns:dcterms="http://purl.org/dc/terms/" + xmlns:swhdeposit="https://www.softwareheritage.org/schema/2018/deposit" + > + 160 + done + The deposit has been successfully loaded into the Software Heritage archive + swh:1:dir:d83b7dda887dc790f7207608474650d4344b8df9 + swh:1:dir:d83b7dda887dc790f7207608474650d4344b8df9;origin=https://forge.softwareheritage.org/source/jesuisgpl/;visit=swh:1:snp:68c0d26104d47e278dd6be07ed61fafb561d0d20;anchor=swh:1:rev:e76ea49c9ffbb7f73611087ba6e999b19e5d71eb;path=/ **Example rejeced deposit response**: @@ -47,12 +49,18 @@ - 148 - rejected - - At least one url field must be compatible with the client's domain name (codemeta:url) + xmlns:dcterms="http://purl.org/dc/terms/" + xmlns:swhdeposit="https://www.softwareheritage.org/schema/2018/deposit" + > + 148 + rejected + - At least one url field must be compatible with the client's domain name (codemeta:url) + Note: older versions of the deposit used the ``http://www.w3.org/2005/Atom`` + namespace instead of ``https://www.softwareheritage.org/schema/2018/deposit``. + Tags in the Atom namespace are still provided for backward compatibility, but + are deprecated. :reqheader Authorization: Basic authentication token :statuscode 201: with the deposit's status diff --git a/swh/deposit/templates/deposit/content.xml b/swh/deposit/templates/deposit/content.xml --- a/swh/deposit/templates/deposit/content.xml +++ b/swh/deposit/templates/deposit/content.xml @@ -1,6 +1,15 @@ + xmlns:dcterms="http://purl.org/dc/terms/" + xmlns:sd="https://www.softwareheritage.org/schema/2018/deposit" + > + {{ deposit_id }} + {{ request.date }} + {{ status }} + {{ status_detail }} + + {{ deposit_id }} {{ request.date }} {{ status }} diff --git a/swh/deposit/templates/deposit/deposit_receipt.xml b/swh/deposit/templates/deposit/deposit_receipt.xml --- a/swh/deposit/templates/deposit/deposit_receipt.xml +++ b/swh/deposit/templates/deposit/deposit_receipt.xml @@ -1,6 +1,15 @@ + xmlns:dcterms="http://purl.org/dc/terms/" + xmlns:sd="https://www.softwareheritage.org/schema/2018/deposit" + > + {{ deposit_id }} + {{ deposit_date }} + {{ archive }} + {{ status }} + + {{ deposit_id }} {{ deposit_date }} {{ archive }} diff --git a/swh/deposit/templates/deposit/status.xml b/swh/deposit/templates/deposit/status.xml --- a/swh/deposit/templates/deposit/status.xml +++ b/swh/deposit/templates/deposit/status.xml @@ -1,9 +1,23 @@ + xmlns:dcterms="http://purl.org/dc/terms/" + xmlns:sd="https://www.softwareheritage.org/schema/2018/deposit" + > + {{ deposit_id }} + {{ status }} + {{ status_detail }} + + {% if swhid is not None %}{{ swhid }}{% endif %} + {% if swhid_context is not None %}{{ swhid_context }}{% endif %} + {% if external_id is not None %}{{ external_id }}{% endif %} + + + {{ deposit_id }} {{ status }} {{ status_detail }} + {% if swhid is not None %}{{ swhid }}{% endif %} {% if swhid_context is not None %}{{ swhid_context }}{% endif %} {% if external_id is not None %}{{ external_id }}{% endif %} diff --git a/swh/deposit/tests/api/test_collection.py b/swh/deposit/tests/api/test_collection.py --- a/swh/deposit/tests/api/test_collection.py +++ b/swh/deposit/tests/api/test_collection.py @@ -121,7 +121,7 @@ assert response.status_code == status.HTTP_201_CREATED response_content = parse_xml(BytesIO(response.content)) - deposit_id = response_content["deposit_id"] + deposit_id = response_content["swh:deposit_id"] assert deposit_id != deposit.id # new deposit @@ -151,7 +151,7 @@ assert response.status_code == status.HTTP_201_CREATED response_content = parse_xml(BytesIO(response.content)) - deposit_id = response_content["deposit_id"] + deposit_id = response_content["swh:deposit_id"] assert deposit_id != deposit.id @@ -182,7 +182,7 @@ assert response.status_code == status.HTTP_201_CREATED response_content = parse_xml(BytesIO(response.content)) - deposit_id = response_content["deposit_id"] + deposit_id = response_content["swh:deposit_id"] assert deposit_id != deposit.id diff --git a/swh/deposit/tests/api/test_collection_post_binary.py b/swh/deposit/tests/api/test_collection_post_binary.py --- a/swh/deposit/tests/api/test_collection_post_binary.py +++ b/swh/deposit/tests/api/test_collection_post_binary.py @@ -119,6 +119,12 @@ assert deposit_request.raw_metadata is None response_content = parse_xml(BytesIO(response.content)) + + assert response_content["swh:deposit_archive"] == sample_archive["name"] + assert int(response_content["swh:deposit_id"]) == deposit.id + assert response_content["swh:deposit_status"] == deposit.status + + # deprecated tags assert response_content["deposit_archive"] == sample_archive["name"] assert int(response_content["deposit_id"]) == deposit.id assert response_content["deposit_status"] == deposit.status diff --git a/swh/deposit/tests/api/test_deposit_private_check.py b/swh/deposit/tests/api/test_deposit_private_check.py --- a/swh/deposit/tests/api/test_deposit_private_check.py +++ b/swh/deposit/tests/api/test_deposit_private_check.py @@ -200,7 +200,7 @@ # then assert response.status_code == status.HTTP_201_CREATED response_content = parse_xml(response.content) - deposit_status = response_content["deposit_status"] + deposit_status = response_content["swh:deposit_status"] assert deposit_status == DEPOSIT_STATUS_DEPOSITED deposit_id = int(response_content["deposit_id"]) diff --git a/swh/deposit/tests/api/test_deposit_schedule.py b/swh/deposit/tests/api/test_deposit_schedule.py --- a/swh/deposit/tests/api/test_deposit_schedule.py +++ b/swh/deposit/tests/api/test_deposit_schedule.py @@ -57,7 +57,7 @@ assert response.status_code == status.HTTP_201_CREATED response_content = parse_xml(BytesIO(response.content)) - actual_state = response_content["deposit_status"] + actual_state = response_content["swh:deposit_status"] assert actual_state == DEPOSIT_STATUS_DEPOSITED deposit_id = response_content["deposit_id"] diff --git a/swh/deposit/tests/api/test_get_file.py b/swh/deposit/tests/api/test_get_file.py --- a/swh/deposit/tests/api/test_get_file.py +++ b/swh/deposit/tests/api/test_get_file.py @@ -31,8 +31,8 @@ response = client.get(url) assert response.status_code == status.HTTP_200_OK actual_deposit = dict(parse_xml(response.content)) - del actual_deposit["deposit_date"] - assert actual_deposit == expected_deposit + del actual_deposit["swh:deposit_date"] + assert set(actual_deposit.items()) >= set(expected_deposit.items()) def test_api_deposit_content_unknown(client, complete_deposit, deposit_collection): diff --git a/swh/deposit/tests/cli/test_client.py b/swh/deposit/tests/cli/test_client.py --- a/swh/deposit/tests/cli/test_client.py +++ b/swh/deposit/tests/cli/test_client.py @@ -601,13 +601,6 @@ """ api_url_basename = "deposit.test.updateswhid" deposit_id = 321 - deposit_status_xml_path = os.path.join( - datadir, f"https_{api_url_basename}", f"1_test_{deposit_id}_status" - ) - with open(deposit_status_xml_path, "r") as f: - deposit_status_xml = f.read() - expected_deposit_status = dict(parse_xml(deposit_status_xml)) - assert expected_deposit_status["deposit_status"] != "done" # fmt: off result = cli_runner.invoke( diff --git a/swh/deposit/tests/data/https_deposit.swh.test/1_test b/swh/deposit/tests/data/https_deposit.swh.test/1_test --- a/swh/deposit/tests/data/https_deposit.swh.test/1_test +++ b/swh/deposit/tests/data/https_deposit.swh.test/1_test @@ -1,6 +1,14 @@ + xmlns:dcterms="http://purl.org/dc/terms/" + xmlns:sd="https://www.softwareheritage.org/schema/2018/deposit" + > + 615 + Oct. 8, 2020, 4:57 p.m. + None + partial + + 615 Oct. 8, 2020, 4:57 p.m. None diff --git a/swh/deposit/tests/data/https_deposit.test.metadata/1_test b/swh/deposit/tests/data/https_deposit.test.metadata/1_test --- a/swh/deposit/tests/data/https_deposit.test.metadata/1_test +++ b/swh/deposit/tests/data/https_deposit.test.metadata/1_test @@ -1,6 +1,14 @@ + xmlns:dcterms="http://purl.org/dc/terms/" + xmlns:sd="https://www.softwareheritage.org/schema/2018/deposit" + > + 666 + Oct. 8, 2020, 4:57 p.m. + hardcoded_sample_archive_path + partial + + 666 Oct. 8, 2020, 4:57 p.m. hardcoded_sample_archive_path diff --git a/swh/deposit/tests/data/https_deposit.test.metadata/1_test_666_metadata b/swh/deposit/tests/data/https_deposit.test.metadata/1_test_666_metadata --- a/swh/deposit/tests/data/https_deposit.test.metadata/1_test_666_metadata +++ b/swh/deposit/tests/data/https_deposit.test.metadata/1_test_666_metadata @@ -1,6 +1,13 @@ + xmlns:dcterms="http://purl.org/dc/terms/" + xmlns:sd="https://www.softwareheritage.org/schema/2018/deposit"> + 666 + Oct. 9, 2020, 8:44 p.m. + something + deposited + + 666 Oct. 9, 2020, 8:44 p.m. something