MENDELU/fix: unvalid openaire4 OAI-PMH endpoint#1286
Merged
milanmajchrak merged 1 commit intocustomer/mendelufrom Mar 19, 2026
Merged
MENDELU/fix: unvalid openaire4 OAI-PMH endpoint#1286milanmajchrak merged 1 commit intocustomer/mendelufrom
milanmajchrak merged 1 commit intocustomer/mendelufrom
Conversation
…1438) DateUtils.format(Instant) produced timestamps with fractional seconds (e.g. 2025-10-09T18:53:58.376565922Z) which violates the OAI-PMH spec requiring YYYY-MM-DDThh:mm:ssZ format, causing validation failures at Open Archives. Also add oai_dc metadata format to the openaire4 context in xoai.xml, as oai_dc is required by the OAI-PMH specification for every endpoint.
There was a problem hiding this comment.
Pull request overview
Fixes OAI-PMH compliance issues in the DSpace OAI provider by ensuring responseDate values match the required YYYY-MM-DDThh:mm:ssZ format (no fractional seconds) and by ensuring the openaire4 endpoint exposes the required oai_dc metadata format.
Changes:
- Truncate
Instantvalues to seconds before formatting OAI-PMH dates. - Add
oaidcformat to theopenaire4XOAI context.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
dspace-oai/src/main/java/org/dspace/xoai/util/DateUtils.java |
Ensures formatted OAI-PMH timestamps never include fractional seconds. |
dspace/config/crosswalks/oai/xoai.xml |
Adds the required oai_dc metadata format to the openaire4 context. |
You can also share your feedback on Copilot code review. Take the survey.
Comment on lines
37
to
40
| public static String format(Instant date) { | ||
| // NOTE: OAI-PMH REQUIRES that all dates be expressed in UTC format | ||
| // as YYYY-MM-DDThh:mm:ssZ For more details, see | ||
| // http://www.openarchives.org/OAI/openarchivesprotocol.html#DatestampsResponses | ||
|
|
||
| // toString returns the correct format | ||
| return date.toString(); | ||
| Instant truncated = date.truncatedTo(ChronoUnit.SECONDS); | ||
| return DateTimeFormatter.ISO_INSTANT.format(truncated); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem description
DSpace 9.1 fails OAI-PMH validation at Open Archives (openarchives.org) with:
Root cause:
DateUtils.format(Instant)callsInstant.toString()which includes nanoseconds when they are non-zero. The OAI-PMH spec requiresYYYY-MM-DDThh:mm:ssZwithout fractional seconds.Additionally, the
openaire4context inxoai.xmlis missing theoai_dcmetadata format, which is the only format required by the OAI-PMH spec for every endpoint.Changes
DateUtils.format(Instant)— truncate to seconds and format viaDateTimeFormatter.ISO_INSTANTinstead ofInstant.toString()(port of DSpace#11438)DateUtilsTest— unit test verifying nanoseconds are strippedxoai.xml— add<Format ref="oaidc"/>to theopenaire4contextAnalysis
(Write here, if there is needed describe some specific problem. Erase it, when it is not needed.)
Problems
(Write here, if some unexpected problems occur during solving issues. Erase it, when it is not needed.)
Manual Testing (if applicable)
Copilot review