@@ -565,15 +565,22 @@ related resource collection:
565
565
#### <a href =" #profile-links " id =" profile-links " class =" headerlink " ></a > Profile Links
566
566
567
567
Like all [ links] [ link ] , a link in an array of ` profile ` links can be represented
568
- with a [ link object] .
568
+ with a [ link object] . In that case, the link object ** MAY** contain an ` aliases `
569
+ member listing any [ profile aliases] .
569
570
570
- Here, the ` profile ` key specifies an array of ` profile ` links:
571
+ Here, the ` profile ` key specifies an array of ` profile ` links, including one
572
+ that includes a [ profile alias] [ profile aliases ] :
571
573
572
574
``` json
573
575
"links" : {
574
576
"profile" : [
575
577
" http://example.com/profiles/flexible-pagination" ,
576
- " http://example.com/profiles/resource-versioning"
578
+ {
579
+ "href" : " http://example.com/profiles/resource-versioning" ,
580
+ "aliases" : {
581
+ "version" : " v"
582
+ }
583
+ }
577
584
]
578
585
}
579
586
```
@@ -1973,18 +1980,19 @@ profile.
1973
1980
> server's response.
1974
1981
1975
1982
1976
- ### <a href =" #profile-keywords " id =" profile-keywords " class =" headerlink " ></a > Profile Keywords
1983
+ ### <a href =" #profile-keywords-and-aliases " id =" profile-keywords-and-aliases " class =" headerlink " ></a > Profile Keywords and Aliases
1977
1984
1978
1985
A profile ** SHOULD** explicitly declare "keywords" for any elements that it
1979
1986
introduces to the document structure. If a profile does not explicitly declare a
1980
1987
keyword for an element, then the name of the element itself (i.e., its key in
1981
1988
the document) is considered to be its keyword. All profile keywords ** MUST**
1982
1989
meet this specification's requirements for [ member names] .
1983
1990
1991
+ For the purposes of aliasing, a profile's elements are defined shallowly.
1984
1992
In other words, if a profile introduces an object-valued document member, that
1985
- member is an element, but any keys in it are not themselves elements. Likewise,
1986
- if the profile defines an array-valued element, the keys in nested objects
1987
- within that array are not elements.
1993
+ member is an element (and so subject to aliasing) , but any keys in it are not
1994
+ themselves elements. Likewise, if the profile defines an array-valued element,
1995
+ the keys in nested objects within that array are not elements.
1988
1996
1989
1997
The following example profile defines a single keyword, ` version ` :
1990
1998
@@ -2032,6 +2040,42 @@ This profile might be applied as follows:
2032
2040
}
2033
2041
```
2034
2042
2043
+ Documents that apply a particular profile ** MAY** represent each keyword with an
2044
+ alternatively named member, or "alias". An alias fully assumes any meaning
2045
+ specified for a keyword, which no longer retains that meaning. Any aliases
2046
+ associated with a profile ** MUST** be represented in the profile's corresponding
2047
+ ` aliases ` object within its [ link object] [ links ] . The key of each alias ** MUST**
2048
+ be a keyword from the profile, and the value ** MUST** be an alias that applies
2049
+ to this particular representation. This aliasing mechanism allows profiles to be
2050
+ applied in a way that is both consistent with the rest of the representation and
2051
+ does not conflict with other profiles.
2052
+
2053
+ For instance, the following document provides an alias for ` version ` : ` v ` .
2054
+ Interpreters of this representation should treat the key ` v ` as if it were the
2055
+ key ` version ` described in the profile:
2056
+
2057
+ ``` json
2058
+ {
2059
+ "data" : {
2060
+ "type" : " contacts" ,
2061
+ "id" : " 345" ,
2062
+ "meta" : {
2063
+ "v" : " 2018-04-14-879976658"
2064
+ },
2065
+ "attributes" : {
2066
+ "name" : " Ethan"
2067
+ }
2068
+ },
2069
+ "links" : {
2070
+ "profile" : [{
2071
+ "href" : " http://example.com/profiles/resource-versioning" ,
2072
+ "aliases" : {
2073
+ "version" : " v"
2074
+ }
2075
+ }]
2076
+ }
2077
+ }
2078
+ ```
2035
2079
2036
2080
### <a href =" #profiles-processing " id =" profiles-processing " class =" headerlink " ></a > Processing Profiled Documents/Requests
2037
2081
@@ -2195,7 +2239,8 @@ that "The elements... specified by a profile... **MUST NOT** change over time."
2195
2239
2196
2240
> The practical issue with adding a sibling element is that another profile
2197
2241
> in use on the document might already define a sibling element of the same
2198
- > name.
2242
+ > name, and existing documents would not have any aliases defined to resolve
2243
+ > this conflict.
2199
2244
2200
2245
However, the timestamps profile could evolve to allow other optional members,
2201
2246
such as ` deleted ` , in the ` timestamps ` object. This is possible because the
@@ -2344,7 +2389,7 @@ request as equivalent to one in which the square brackets were percent-encoded.
2344
2389
[ link object ] : #document-links-link-object
2345
2390
[ profiles ] : #profiles
2346
2391
[ timestamps profile ] : #profiles-timestamp-profile
2347
- [ profile keywords ] : #profile-keywords
2392
+ [ profile aliases ] : #profile-keywords-and-aliases
2348
2393
[ error details ] : #errors
2349
2394
[ error object ] : #error-objects
2350
2395
[ error objects ] : #errror-objects
0 commit comments