-2

Given a curi like [auth:password_reset_confirm], what do you call the part before the colon and what do you call the part after the colon?

I have a json payload with come CURIs that look like this:

...

"_links": {
    "curis": [
        {
            "name": "auth",
            "href": "http://<IP>/documentation/auth/{rel}",
            "templated": true
        },
    ],
    "self": {
        "href": "http://<IP>/resources/api/"
    },
    "auth:password_reset_confirm": {
        "href": "http://<IP>/frontend-auth/password/reset/confirm/"
    },

...
  

Now I want to make an endpoint that serves the schemas for all the other endpoints. So for example:

http://<IP>/schemas/auth/password_reset_confim

Would be the URL for the JSON schema for the endpoint [auth:password_reset_confirm]. To create a URL template for this schema endpoint I need something like this:

http://<IP>/schemas/{curi_part_before_colon}/{curi_part_after_colon}

this looks ridiculous. So I'd like to know what these are actually called.

Note that in this document it is referred to as "the part before the colon": https://www.w3.org/2001/sw/BestPractices/HTML/2005-10-27-CURIE

1

Your current example provides a possible partial answer:

        {
            "name": "auth",
            "href": "http://<IP>/documentation/auth/{rel}",
            "templated": true
        },

You have called "auth" the "name" of the CURI, so could standardise on that for the first part. You still need a name for the second part, though, and I'm not sure "name" is the best term.

Since the CURI proposal you linked explicitly lists XML namespace QNames as its inspiration, you could do worse than borrow the terminology from the XML Namespace standard:

PrefixedName ::= Prefix ':' LocalPart

An important point to note is that a "prefix" in this case is explicitly not a portable name; it is more like a local variable assigned in one part of one XML document. In your case, the prefix is more of a global variable across your service, but the terminology still fits.

So, in "auth:password_reset_confirm" you could call "auth" the "prefix", and "password_reset_confirm" the "local part".

You can then use this in your "links" section:

        {
            "prefix": "auth",
            "href": "http://<IP>/documentation/auth/{rel}",
            "templated": true
        },

And this for your resolving end-point:

http://<IP>/schemas/{prefix}/{local_part}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.