-
Notifications
You must be signed in to change notification settings - Fork 7
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
Codemeta v3.0 - generation #34
Conversation
* Expand jsonld from custom context * Resolves codemeta#29
* missing tests for v3.0 * missing import for v3.0 (and check session storage is working) * extra validation? (eg. end date > start date)
@moranegg @progval Should the generator now generate v3.0 by default (on value change)? If so, I'm also updating previous tests. |
Good question. I think we should wait for Codemeta parsers to support v3.0. There's |
Another question, should we add validation on cross terms, e.g. fix if (fieldName.startsWith("codemeta:") || fieldName.startsWith("schema:")) {
// Do not check fields from other versions FIXME ?
return true;
} ? |
The current version of the generator refuses unknown fields. Whether that's a good idea is debatable; but we shouldn't change this behavior in a PR that is about something else (adding support for Codemeta v3). Instead, validation should allow both v2 and v3 terms, and reject everything else. |
I'm not sure to understand what do you mean by
What should it allow, and what should it reject, in terms of cross version terms (e.g. |
It should allow both |
No, these two are semantically the same document (they both expand to the exact same document), and they are both valid, because it is valid to use both |
Ah ok, so for you it was ok to have this code without further validation? |
It's not, because |
Ah, I think I understand now. So, would it be ok/sufficient to have in validators: "contIntegration": validateUrls,
"continuousIntegration": validateUrls,
"codemeta:contIntegration": noValidation,
"codemeta:continuousIntegration": noValidation, |
When compacting with a v2 context, you would never get a
|
It would be less confusing if we expanded the document before validating (ie. #29), instead of compacting with the v2 context. In particular, it would break this asymmetry, and the validation simply becomes:
|
Do you mean that https://github.com/hjonin/codemeta-generator/blob/3c76b4b876df2de62e6f88eaeedc1bdfa0437a03/js/validation/index.js#L16
should take the expanded document for input (I did not get that at first for #29)? |
yes, exactly |
ok :) I'll do that in another PR indeed |
Excellent discussion and work! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, looks great
{ | ||
"type": "schema:Role", | ||
"schema:author": { | ||
"type": "Person", | ||
"givenName": "Jane" | ||
}, | ||
"schema:roleName": "Developer", | ||
"schema:startDate": "2024-03-04", | ||
"schema:endDate": "2024-04-03" | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This won't be readable by v2-only parsers.
I believe we should return both formats, ie.
"author": [
{
"type": "schema:Role",
"schema:author": {
"type": "Person",
"givenName": "Jane"
},
"schema:roleName": "Developer",
"schema:startDate": "2024-03-04",
"schema:endDate": "2024-04-03"
},
{
"type": "Person",
"givenName": "Jane"
}
or possibly only the latter in the v2 export.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've allowed the first solution in the last commit.
js/validation/things.js
Outdated
else if (fieldName.startsWith("codemeta:") || fieldName.startsWith("schema:")) { | ||
// Do not check fields from other versions FIXME ? | ||
return true; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you remind me why this is needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It could happen when validating of multi-version document, where, for instance, in this case:
{
"@context": "https://w3id.org/codemeta/3.0",
"type": "SoftwareSourceCode",
"name": "My Test Software",
"continuousIntegration": "https://test-ci.org/my-software",
"codemeta:contIntegration": {
"id": "https://test-ci.org/my-software"
}
}
continuousIntegration
could be validated but not codemeta:contIntegration
. But this hack is removed with hjonin#1.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right. But then the "Unknown field" is never triggered because this addition allows every unknown property in the codemeta and schema.org namespaces.
Could you make this hack more specific, by explicitly listing the few properties that were added/removed? (and then remove it in the future of course)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in the last commit.
Update test name Co-authored-by: Val Lorentz <[email protected]>
Update test name Co-authored-by: Val Lorentz <[email protected]>
Thanks! |
Relates to #23.
Allow codemeta.json v3.0 file generation.
Still TODO:
missing import for v3.0-> see Codemeta v3.0 - import #40missing tests for generation/import v3.0extra validation? (e.g. end date > start date)-> see Add extra validation #39@moranegg I'm attaching a screenshot so you can also validate the interface