Closed Silvanoc closed 9 months ago
Following invalid URIs or CURIEs which weren't catched by the previous validation are not allowed anymore:
Following invalid URIs which weren't catched by the previous validation are not allowed anymore:
Furthermore following valid URIs that were being rejected are allowed:
Uriorcurie
range.Uriorcurie
range they remain being interpreted as CURIEs.[^1]: Support for Safe-CURIEs, which might have '[' and ']' only surrounding the whole CURIE will be added on a later PR
Assuming the support for empty URIs (same-document reference) makes any difficulties, I don't think that deviating from the standard would harm much there.
@cthoyt the module providing validation functions here goes in the direction of what I was wishing to see in the curies
package. You might be interested on it or even review it.
It doesn't resolve the URI - CURIE ambiguity where both are accepted yet though.
Small hint for easy manual testing:
poetry run python -c 'from linkml_runtime.utils.uri_validator import validate_uri ; \
print(validate_uri("urn:namespace:resource"))'
will return a regex match object, since it succeeds.
I've added named groups for better unterstanding of how the validator is parsing the passed strings.
poetry run python -c 'from linkml_runtime.utils.uri_validator import validate_uri ; \
from pprint import pprint ; \
pprint(validate_uri("ldap://[2001:db8::7]/c=GB?objectClass?one").groupdict())'
returns
{'authority': '[2001:db8::7]',
'fragment': None,
'hier_part': '//[2001:db8::7]/c=GB',
'host': '[2001:db8::7]',
'port': None,
'query': 'objectClass?one',
'scheme': 'ldap',
'uri': 'ldap://[2001:db8::7]/c=GB?objectClass?one',
'userinfo': None}
All modified lines are covered by tests :white_check_mark:
Comparison is base (
f25abe8
) 61.81% compared to head (b86c1fa
) 62.11%. Report is 3 commits behind head on main.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
@sierra-moxon are you taking care of assigning the PR or are you expecting me to pick someone?
Thanks @Silvanoc! I reviewed and merged; this is terrific! please feel free to assign one of us as a reviewer if needed. :). I also upped your permissions on the repo so you should be able to branch instead of fork if that is easier.
feel free to assign one of us
I'm not sure I know exactly who do you mean by "us". I probably have a rough idea, but I cannot find any place stating something like "this is the LinkML" team or "these are the maintainers".
@Silvanoc I'm glad you found a place for this!
URIorCURIE validation function is wrongly identifying as CURIEs certain URIs. This patch first tries to validate if a URIorCURIE is a valid URI, otherwise it tries to validate if it's a valid CURIE.
Fixes linkml/linkml#1662