Skip to content

Commit 21c42e2

Browse files
committed
Remove context validation on import
We don't need it since 858cc4e
1 parent 858cc4e commit 21c42e2

File tree

2 files changed

+0
-57
lines changed

2 files changed

+0
-57
lines changed

cypress/integration/basics.js

-42
Original file line numberDiff line numberDiff line change
@@ -216,46 +216,4 @@ describe('JSON Import', function() {
216216
cy.get('#name').should('have.value', 'My Test Software');
217217
});
218218

219-
it('errors on invalid context URL', function() {
220-
cy.get('#codemetaText').then((elem) =>
221-
elem.text(JSON.stringify({
222-
"@context": "https://doi.org/10.5063/schema/codemeta-100000",
223-
"@type": "SoftwareSourceCode",
224-
"name": "My Test Software",
225-
}))
226-
);
227-
cy.get('#importCodemeta').click();
228-
229-
cy.get('#errorMessage').should('have.text', '@context must be "https://doi.org/10.5063/schema/codemeta-2.0", not "https://doi.org/10.5063/schema/codemeta-100000"');
230-
});
231-
232-
it('errors on invalid context URL in array', function() {
233-
cy.get('#codemetaText').then((elem) =>
234-
elem.text(JSON.stringify({
235-
"@context": ["https://doi.org/10.5063/schema/codemeta-100000"],
236-
"@type": "SoftwareSourceCode",
237-
"name": "My Test Software",
238-
}))
239-
);
240-
cy.get('#importCodemeta').click();
241-
242-
cy.get('#errorMessage').should('have.text', '@context must be "https://doi.org/10.5063/schema/codemeta-2.0", not ["https://doi.org/10.5063/schema/codemeta-100000"]');
243-
});
244-
245-
it('errors nicely when there are other contexts', function() {
246-
cy.get('#codemetaText').then((elem) =>
247-
elem.text(JSON.stringify({
248-
"@context": [
249-
"https://doi.org/10.5063/schema/codemeta-2.0",
250-
"https://schema.org/",
251-
],
252-
"@type": "SoftwareSourceCode",
253-
"name": "My Test Software",
254-
}))
255-
);
256-
cy.get('#importCodemeta').click();
257-
258-
cy.get('#errorMessage').should('have.text', 'Multiple values in @context are not supported (@context should be "https://doi.org/10.5063/schema/codemeta-2.0", not ["https://doi.org/10.5063/schema/codemeta-2.0","https://schema.org/"])');
259-
});
260-
261219
});

js/validation/index.js

-15
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,6 @@ function validateDocument(doc) {
2020
}
2121
// TODO: validate id/@id
2222

23-
context = doc["@context"];
24-
if (context == "https://doi.org/10.5063/schema/codemeta-2.0") {
25-
// Correct
26-
}
27-
else if (Array.isArray(context) && context.includes("https://doi.org/10.5063/schema/codemeta-2.0")) {
28-
if (context.length !== 1) {
29-
setError(`Multiple values in @context are not supported (@context should be "https://doi.org/10.5063/schema/codemeta-2.0", not ${JSON.stringify(context)})`);
30-
return false;
31-
}
32-
}
33-
else {
34-
setError(`@context must be "https://doi.org/10.5063/schema/codemeta-2.0", not ${JSON.stringify(context)}`);
35-
return false;
36-
}
37-
3823
// TODO: check there is either type or @type but not both
3924
var type = getDocumentType(doc);
4025
if (type === undefined) {

0 commit comments

Comments
 (0)