Skip to content

Commit 9c623d6

Browse files
authored
Merge pull request json-api#1311 from json-api/profile-registration-2
Profile registration
2 parents db8ac13 + 4ec0607 commit 9c623d6

21 files changed

+1150
-117
lines changed

_config.yml

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,21 @@ whitelist:
1313
- jekyll-sitemap
1414
- jekyll-feed
1515
- jekyll-seo-tag
16-
- jekyll-gist
1716
- jemoji
1817
incremental: false
1918
gist:
2019
noscript: false
20+
2121
# customize github pages
2222
quiet: false
2323
markdown: kramdown
2424
highlighter: rouge
2525
kramdown:
2626
input: GFM
2727
hard_wrap: false
28-
auto_ids: false
28+
auto_ids: true
29+
auto_id_prefix: auto-id-
30+
auto_id_stripping: true
2931
template: '' # cannot customize
3032
math_engine: mathjax # cannot customize
3133
syntax_highligher: rouge # cannot customize
@@ -48,6 +50,9 @@ port: 9876
4850
collections:
4951
format:
5052
output: true
53+
profiles:
54+
output: true
55+
permalink: /:collection/:path
5156

5257
defaults:
5358
- scope:
@@ -57,6 +62,20 @@ defaults:
5762
layout: page
5863
show_sidebar: true
5964
is_spec_page: true
65+
- scope:
66+
path: ""
67+
type: "profiles"
68+
values:
69+
layout: profile_error
70+
is_spec_page: false
71+
show_sidebar: false
72+
- scope:
73+
path: "*/*/*/index.md"
74+
type: "profiles"
75+
values:
76+
layout: profile
77+
is_spec_page: false
78+
show_sidebar: true
6079

6180
latest_version: 1.0
6281
excerpt_separator: ""
@@ -84,3 +103,12 @@ quicklinks:
84103
url: /format/
85104
- title: Contribute on GitHub
86105
url: https://github.com/json-api/json-api
106+
107+
profile_categories:
108+
- Pagination
109+
# these are some other potential categories.
110+
# Uncomment them if you're adding a profile in one of these categories.
111+
# - Filtering
112+
# - Actions/Hypermedia
113+
# - Data Modeling
114+
# - Deep Querying

_format/1.1/index.md

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ other and with `type` and `id`. In other words, a resource can not have an
234234
attribute and relationship with the same name, nor can it have an attribute
235235
or relationship named `type` or `id`.
236236

237-
#### <a href="#document-resource-object-attributes" id="document-resource-object-attributes" class="headerlink"></a> Attributes
237+
##### <a href="#document-resource-object-attributes" id="document-resource-object-attributes" class="headerlink"></a> Attributes
238238

239239
The value of the `attributes` key **MUST** be an object (an "attributes
240240
object"). Members of the attributes object ("attributes") represent information
@@ -253,7 +253,7 @@ alongside other information to be represented in a resource object, these keys
253253

254254
> Note: See [fields] and [member names] for more restrictions on this container.
255255
256-
#### <a href="#document-resource-object-relationships" id="document-resource-object-relationships" class="headerlink"></a> Relationships
256+
##### <a href="#document-resource-object-relationships" id="document-resource-object-relationships" class="headerlink"></a> Relationships
257257

258258
The value of the `relationships` key **MUST** be an object (a "relationships
259259
object"). Members of the relationships object ("relationships") represent
@@ -285,7 +285,7 @@ data, not the related resources.
285285

286286
> Note: See [fields] and [member names] for more restrictions on this container.
287287
288-
#### <a href="#document-resource-object-related-resource-links" id="document-resource-object-related-resource-links" class="headerlink"></a> Related Resource Links
288+
##### <a href="#document-resource-object-related-resource-links" id="document-resource-object-related-resource-links" class="headerlink"></a> Related Resource Links
289289

290290
A "related resource link" provides access to [resource objects][resource objects] [linked][links]
291291
in a [relationship][relationships]. When fetched, the related resource object(s)
@@ -300,7 +300,7 @@ relationship isn't currently associated with any target resources. Additionally,
300300
a related resource link **MUST NOT** change because its relationship's content
301301
changes.
302302

303-
#### <a href="#document-resource-object-linkage" id="document-resource-object-linkage" class="headerlink"></a> Resource Linkage
303+
##### <a href="#document-resource-object-linkage" id="document-resource-object-linkage" class="headerlink"></a> Resource Linkage
304304

305305
Resource linkage in a [compound document] allows a client to link together all
306306
of the included [resource objects] without having to `GET` any URLs via [links].
@@ -1920,10 +1920,10 @@ request is received, a server **SHOULD** attempt to apply the requested profiles
19201920
to its response.
19211921

19221922
For example, in the following request, the client asks that the server apply the
1923-
`http://jsonapi.org/extensions/last-modified` profile if it is able to.
1923+
`http://example.com/last-modified` profile if it is able to.
19241924

19251925
```http
1926-
Accept: application/vnd.api+json;profile="http://example.com/extensions/last-modified", application/vnd.api+json
1926+
Accept: application/vnd.api+json;profile="http://example.com/last-modified", application/vnd.api+json
19271927
```
19281928

19291929
> Note: The second instance of the JSON:API media type in the example above is
@@ -2257,6 +2257,11 @@ supported as well.
22572257
3. alter the JSON structure of any concept defined in this specification,
22582258
including to allow a superset of JSON structures.
22592259

2260+
2261+
> If you create your own profile, you are **strongly encouraged to [register](/extensions/#profile-registration)
2262+
> it** with the JSON API [profile registry](/extensions/), so that others can
2263+
> find and reuse it.
2264+
22602265
#### <a href="#profiles-updating" id="profiles-updating" class="headerlink"></a> Revising a Profile
22612266

22622267
Profiles **MAY** be revised over time, e.g., to add new capabilities. However,

_includes/global_head_assets.html

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<meta charset="utf-8">
2+
<meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
3+
<meta name="viewport" content="width=device-width, initial-scale=1">
4+
<link href="/stylesheets/normalize.css" rel="stylesheet" type="text/css" />
5+
<link href="/stylesheets/all.css" rel="stylesheet" type="text/css" />
6+
<link href="/stylesheets/print.css" media="print" rel="stylesheet" type="text/css" />
7+
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
8+
<script src="/javascripts/all.js" type="text/javascript"></script>
9+
<script src="/javascripts/highlight.pack.js"></script>
10+
<script>hljs.configure({classPrefix: ''}); hljs.initHighlightingOnLoad();</script>
11+
12+
<link rel="apple-touch-icon" sizes="57x57" href="/alt-favicons/apple-touch-icon-57x57.png">
13+
<link rel="apple-touch-icon" sizes="60x60" href="/alt-favicons/apple-touch-icon-60x60.png">
14+
<link rel="apple-touch-icon" sizes="72x72" href="/alt-favicons/apple-touch-icon-72x72.png">
15+
<link rel="apple-touch-icon" sizes="76x76" href="/alt-favicons/apple-touch-icon-76x76.png">
16+
<link rel="apple-touch-icon" sizes="114x114" href="/alt-favicons/apple-touch-icon-114x114.png">
17+
<link rel="apple-touch-icon" sizes="120x120" href="/alt-favicons/apple-touch-icon-120x120.png">
18+
<link rel="apple-touch-icon" sizes="144x144" href="/alt-favicons/apple-touch-icon-144x144.png">
19+
<link rel="apple-touch-icon" sizes="152x152" href="/alt-favicons/apple-touch-icon-152x152.png">
20+
<link rel="apple-touch-icon" sizes="180x180" href="/alt-favicons/apple-touch-icon-180x180.png">
21+
<link rel="icon" type="image/png" href="/alt-favicons/favicon-32x32.png" sizes="32x32">
22+
<link rel="icon" type="image/png" href="/alt-favicons/favicon-194x194.png" sizes="194x194">
23+
<link rel="icon" type="image/png" href="/alt-favicons/favicon-96x96.png" sizes="96x96">
24+
<link rel="icon" type="image/png" href="/alt-favicons/android-chrome-192x192.png" sizes="192x192">
25+
<link rel="icon" type="image/png" href="/alt-favicons/favicon-16x16.png" sizes="16x16">
26+
<link rel="manifest" href="/alt-favicons/manifest.json">
27+
<link rel="mask-icon" href="/alt-favicons/safari-pinned-tab.svg" color="#0b4e22">
28+
<link rel="shortcut icon" href="/favicon.ico">
29+
<meta name="msapplication-TileColor" content="#da532c">
30+
<meta name="msapplication-TileImage" content="/alt-favicons/mstile-144x144.png">
31+
<meta name="msapplication-config" content="/alt-favicons/browserconfig.xml">
32+
<meta name="theme-color" content="#0b4e22">

_includes/global_html_footer.html

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<footer>
2+
<div class="site-wrapper">
3+
<span>Built with <a href="https://jekyllrb.com/">Jekyll</a> and <a href="http://softwaremaniacs.org/soft/highlight/en/">Highlight.js</a></span>
4+
<span class="license">
5+
<a rel="license" href="https://creativecommons.org/publicdomain/zero/1.0/"><img src="https://licensebuttons.net/p/zero/1.0/88x31.png" style="border- style: none;" alt="CC0" /></a>
6+
</span>
7+
<span class="social-links">
8+
<a class="twitter" href="https://twitter.com/jsonapi"><i class="icon-twitter"></i><span>Twitter</span></a>
9+
<a class="github" href="https://github.com/json-api"><i class="icon-github"></i><span>GitHub</span></a>
10+
<a class="forum" href="https://discuss.jsonapi.org"><i class="icon-forum"></i><span>Discussion Forum</span></a>
11+
</span>
12+
</div>
13+
</footer>
14+
<script>
15+
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
16+
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
17+
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
18+
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
19+
20+
ga('create', 'UA-40609539-1', 'jsonapi.org');
21+
ga('send', 'pageview');
22+
23+
</script>

_includes/header_offset_2.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{% comment %}
2+
When we embed the markdown from a user-provided profile specification
3+
inside the profile layout, we need to increment each heading level by 2.
4+
Kramdown, our markdown parser, provides a `header_offset` option, but
5+
Jekyll only allows us to set that globally -- and setting it globally
6+
to two would break our other pages. So, this include lets us take arbitrary
7+
HTML (from rendered markdown) and does some liquid string replacements
8+
to offset its headings. This is pretty janky (even more so because liquid
9+
only allows us to do literal string replacement, not regex replacement),
10+
but I think it *should* work robustly, thanks to the fact that angle
11+
brackets (i.e., `<` and `>`) aren't supposed to appear in HTML unencoded,
12+
and I imagine Kramdown respects that.
13+
{% endcomment %}
14+
{{ include.content
15+
| replace: "<h5", "<h6x"
16+
| replace: "<h4", "<h6x"
17+
| replace: "<h3", "<h5x"
18+
| replace: "<h2", "<h4x"
19+
| replace: "<h1", "<h3x"
20+
| replace: "</h1>", "</h3x>"
21+
| replace: "</h2>", "</h4x>"
22+
| replace: "</h3>", "</h5x>"
23+
| replace: "</h4>", "</h6x>"
24+
| replace: "</h5>", "</h6x>"
25+
| replace: "<h3x", "<h3"
26+
| replace: "<h4x", "<h4"
27+
| replace: "<h5x", "<h5"
28+
| replace: "<h6x", "<h6"
29+
| replace: "</h3x>", "</h3>"
30+
| replace: "</h4x>", "</h4>"
31+
| replace: "</h5x>", "</h5>"
32+
| replace: "</h6x>", "</h6>"
33+
}}

_includes/profile_url.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{% comment %}
2+
Takes the page object for a JSON:API profile spec and returns its url.
3+
This file can't have whitespace outside this comment block or else the
4+
output will be corrupted.
5+
{% endcomment %}{{ include.page.url | absolute_url | split: "/" | where_exp: "item", "item != 'index'" | join: "/" }}/

_includes/site_navigation.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<nav class="site-nav">
2+
<div class="nav-inner">
3+
<ul>
4+
{% assign url = page.url|remove:'index.html' %}
5+
{% for link in site.navigation %}
6+
<li {% if url == link.url or url contains "/profiles/" and link.url contains "/extensions" %}class="active"{% endif %}><a href="{{link.url}}" title="{{link.title}}">{{link.title}}</a></li>
7+
{% endfor %}
8+
<li class="version">
9+
<a href="/format/#status" class="pill">v{{ site.latest_version }} <span class="stable">Stable</span></a>
10+
</li>
11+
</ul>
12+
</div>
13+
</nav>

_layouts/page.html

Lines changed: 9 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
<!doctype html>
22
<html>
33
<head>
4-
<meta charset="utf-8">
5-
<meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
6-
<meta name="viewport" content="width=device-width, initial-scale=1">
4+
{% include global_head_assets.html %}
75

86
{% comment %}
97
Below, we're either dealing with a generic page or a page from the
@@ -20,57 +18,15 @@
2018
{% else %}
2119
{% assign page_title = page.title %}
2220
{% endif %}
23-
<title>JSON:API &mdash; {{page_title|strip }}</title>
24-
25-
<link href="/stylesheets/normalize.css" rel="stylesheet" type="text/css" />
26-
<link href="/stylesheets/all.css" rel="stylesheet" type="text/css" />
27-
<link href="/stylesheets/print.css" media="print" rel="stylesheet" type="text/css" />
28-
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
29-
<script src="/javascripts/all.js" type="text/javascript"></script>
30-
<script src="/javascripts/highlight.pack.js"></script>
31-
<script>hljs.configure({classPrefix: ''}); hljs.initHighlightingOnLoad();</script>
32-
33-
<link rel="apple-touch-icon" sizes="57x57" href="/alt-favicons/apple-touch-icon-57x57.png">
34-
<link rel="apple-touch-icon" sizes="60x60" href="/alt-favicons/apple-touch-icon-60x60.png">
35-
<link rel="apple-touch-icon" sizes="72x72" href="/alt-favicons/apple-touch-icon-72x72.png">
36-
<link rel="apple-touch-icon" sizes="76x76" href="/alt-favicons/apple-touch-icon-76x76.png">
37-
<link rel="apple-touch-icon" sizes="114x114" href="/alt-favicons/apple-touch-icon-114x114.png">
38-
<link rel="apple-touch-icon" sizes="120x120" href="/alt-favicons/apple-touch-icon-120x120.png">
39-
<link rel="apple-touch-icon" sizes="144x144" href="/alt-favicons/apple-touch-icon-144x144.png">
40-
<link rel="apple-touch-icon" sizes="152x152" href="/alt-favicons/apple-touch-icon-152x152.png">
41-
<link rel="apple-touch-icon" sizes="180x180" href="/alt-favicons/apple-touch-icon-180x180.png">
42-
<link rel="icon" type="image/png" href="/alt-favicons/favicon-32x32.png" sizes="32x32">
43-
<link rel="icon" type="image/png" href="/alt-favicons/favicon-194x194.png" sizes="194x194">
44-
<link rel="icon" type="image/png" href="/alt-favicons/favicon-96x96.png" sizes="96x96">
45-
<link rel="icon" type="image/png" href="/alt-favicons/android-chrome-192x192.png" sizes="192x192">
46-
<link rel="icon" type="image/png" href="/alt-favicons/favicon-16x16.png" sizes="16x16">
47-
<link rel="manifest" href="/alt-favicons/manifest.json">
48-
<link rel="mask-icon" href="/alt-favicons/safari-pinned-tab.svg" color="#0b4e22">
49-
<link rel="shortcut icon" href="/favicon.ico">
50-
<meta name="msapplication-TileColor" content="#da532c">
51-
<meta name="msapplication-TileImage" content="/alt-favicons/mstile-144x144.png">
52-
<meta name="msapplication-config" content="/alt-favicons/browserconfig.xml">
53-
<meta name="theme-color" content="#0b4e22">
21+
<title>JSON:API &mdash; {{ page_title|strip }}</title>
5422
</head>
5523

5624
<body>
57-
<nav class="site-nav">
58-
<div class="nav-inner">
59-
<ul>
60-
{% assign url = page.url|remove:'index.html' %}
61-
{% for link in site.navigation %}
62-
<li {% if url == link.url %}class="active"{% endif %}><a href="{{link.url}}" title="{{link.title}}">{{link.title}}</a></li>
63-
{% endfor %}
64-
<li class="version">
65-
<a href="/format/#status" class="pill">v{{ site.latest_version }} <span class="stable">Stable</span></a>
66-
</li>
67-
</ul>
68-
</div>
69-
</nav>
25+
{% include site_navigation.html %}
7026
{% if page.show_masthead %}
7127
<header>
7228
<div class="content">
73-
<h1>JSON:API</h1>
29+
<h1 id="json-api">JSON:API</h1>
7430
<h2>A specification for building APIs in JSON</h2>
7531
<div class="quicklinks">
7632
{% for link in site.quicklinks %}
@@ -103,7 +59,8 @@ <h2>A specification for building APIs in JSON</h2>
10359
Upcoming Version (v{{ site.latest_version|plus:0.1 }})
10460
</option>
10561
<optgroup label="Old Versions/Permalinks">
106-
{% for spec_draft in site.format|sort:'version' %}
62+
{% assign sorted_formats = site.format|sort:'version' %}
63+
{% for spec_draft in sorted_formats %}
10764
{% if spec_draft.version and spec_draft.path contains 'index' %}
10865
<option value="/format/{{spec_draft.version}}"
10966
{% if page.version == spec_draft.version %}selected{% endif%}
@@ -121,7 +78,7 @@ <h1 class="sidebar-top">{{ page_title }}</h1>
12178
</nav>
12279
</div>
12380
{% endif %}
124-
<div class="content">
81+
<main class="content">
12582
{% unless page.show_masthead %}
12683
<h1>
12784
{{ page_title }}
@@ -136,31 +93,9 @@ <h1>
13693
{% endif %}
13794
{{ content }}
13895
</section>
139-
</div>
96+
</main>
14097
</div>
141-
<footer>
142-
<div class="site-wrapper">
143-
<span>Built with <a href="https://jekyllrb.com/">Jekyll</a> and <a href="http://softwaremaniacs.org/soft/highlight/en/">Highlight.js</a></span>
144-
<span class="license">
145-
<a rel="license" href="https://creativecommons.org/publicdomain/zero/1.0/"><img src="https://licensebuttons.net/p/zero/1.0/88x31.png" style="border- style: none;" alt="CC0" /></a>
146-
</span>
147-
<span class="social-links">
148-
<a class="twitter" href="https://twitter.com/jsonapi"><i class="icon-twitter"></i><span>Twitter</span></a>
149-
<a class="github" href="https://github.com/json-api"><i class="icon-github"></i><span>GitHub</span></a>
150-
<a class="forum" href="https://discuss.jsonapi.org"><i class="icon-forum"></i><span>Discussion Forum</span></a>
151-
</span>
152-
</div>
153-
</footer>
154-
<script>
155-
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
156-
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
157-
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
158-
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
159-
160-
ga('create', 'UA-40609539-1', 'jsonapi.org');
161-
ga('send', 'pageview');
162-
163-
</script>
98+
{% include global_html_footer.html %}
16499
</body>
165100

166101
</html>

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