Skip to content

Commit dd7d0fd

Browse files
committed
Revert "Remove profile aliasing"
This reverts commit 9d36434.
1 parent b7c984b commit dd7d0fd

File tree

1 file changed

+54
-9
lines changed

1 file changed

+54
-9
lines changed

_format/1.1/index.md

Lines changed: 54 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -565,15 +565,22 @@ related resource collection:
565565
#### <a href="#profile-links" id="profile-links" class="headerlink"></a> Profile Links
566566

567567
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].
569570

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]:
571573

572574
```json
573575
"links": {
574576
"profile": [
575577
"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+
}
577584
]
578585
}
579586
```
@@ -1973,18 +1980,19 @@ profile.
19731980
> server's response.
19741981
19751982

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
19771984

19781985
A profile **SHOULD** explicitly declare "keywords" for any elements that it
19791986
introduces to the document structure. If a profile does not explicitly declare a
19801987
keyword for an element, then the name of the element itself (i.e., its key in
19811988
the document) is considered to be its keyword. All profile keywords **MUST**
19821989
meet this specification's requirements for [member names].
19831990

1991+
For the purposes of aliasing, a profile's elements are defined shallowly.
19841992
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.
19881996

19891997
The following example profile defines a single keyword, `version`:
19901998

@@ -2032,6 +2040,42 @@ This profile might be applied as follows:
20322040
}
20332041
```
20342042

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+
```
20352079

20362080
### <a href="#profiles-processing" id="profiles-processing" class="headerlink"></a> Processing Profiled Documents/Requests
20372081

@@ -2195,7 +2239,8 @@ that "The elements... specified by a profile... **MUST NOT** change over time."
21952239

21962240
> The practical issue with adding a sibling element is that another profile
21972241
> 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.
21992244
22002245
However, the timestamps profile could evolve to allow other optional members,
22012246
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.
23442389
[link object]: #document-links-link-object
23452390
[profiles]: #profiles
23462391
[timestamps profile]: #profiles-timestamp-profile
2347-
[profile keywords]: #profile-keywords
2392+
[profile aliases]: #profile-keywords-and-aliases
23482393
[error details]: #errors
23492394
[error object]: #error-objects
23502395
[error objects]: #errror-objects

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy