OAI / oascomply

Apache License 2.0
21 stars 5 forks source link

Finalize URI/IRI resource id (RID?) library #35

Closed handrews closed 10 months ago

handrews commented 1 year ago

Adding oascomply.resourceid and its various URI/IRI-related classes dramatically simplified things. Some ideas for finalizing this module in M2 (see also #34 for context):

handrews commented 1 year ago

Note that furl also looks promising, but it does automatic encoding (including of IRIs down to URIs). It does, however, catch the double-port error unlike many libraries. Might be worth considering. It seems very full-featured and might do too much processing up front, though, given how heavily this will get used.

handrews commented 1 year ago

The furl authors also have an orderedmultidict package that looks worth using for x-www-form-urlencoded query strings whether furl is worth using for oascomply or not.

handrews commented 1 year ago

Further thoughts:

rfc3987.parse() already does the fundamental syntax validation. rid.global_config() would enable things like scheme-specific validations; the cost of checking the global config can by bypassed by just calling the constructors directly

Also, unless the global config mandates some level of pre-parsing, additional parsing is not done unless/until properties are accessed. So all classes might have a jsonptr property for JSON Pointer fragments, but it will only attempt to build a JsonPtr instance if accessed. Likewise, q_component and r_component properties will raise errors unless the scheme is urn (it's an open question as to how many properties to add for various URI schemes, but the general philosophy is "make them all available and assume the caller will use them correctly")

handrews commented 10 months ago

rfc3987 cannot be used due to GPL. For now, we will use jschon's URI class, which is backed by rfc3986, as it is adequate and will make things consistent. jschon has agreed to adopt a better URI/IRI class if/when one is available, which is something I will work on separately from this project. But will help this project when it is fixed upstream.

handrews commented 10 months ago

The rfc3987 library has been removed on the m2 branch