Skip to content

Commit 545dd65

Browse files
committed
Improve docs
1 parent d3f4024 commit 545dd65

File tree

9 files changed

+135
-16
lines changed

9 files changed

+135
-16
lines changed

docs/.vuepress/jsdoc.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,6 @@ function documentClasses (templateData) {
4848
return classNames
4949
}, [])
5050

51-
const classTemplate = loadTemplate('class')
52-
5351
const classIndexData = {
5452
classes: {}
5553
}
@@ -61,22 +59,24 @@ function documentClasses (templateData) {
6159
}
6260
}
6361

64-
console.log(classIndexData)
65-
62+
const classTemplate = loadTemplate('class')
6663
classes.forEach(className => {
6764
const fileName = `docs/code/classes/${className}.md`
6865
const classData = templateData
6966
.filter(jsdocBlock => jsdocBlock.memberof === className)
7067
.sort((a, b) => {
7168
return a.order < b.order ? -1 : 1
72-
}).forEach(classData => {
73-
if (classData.kind === 'class') {
74-
classIndexData.classes[className].description = classData.description
75-
}
7669
})
7770

71+
classData.forEach(classData => {
72+
if (classData.kind === 'class') {
73+
classIndexData.classes[className].description = classData.description
74+
}
75+
})
76+
7877
console.log(`rendering ${className} to ${fileName}`)
79-
fs.writeFileSync(fileName, classTemplate({ className, classData }))
78+
const context = { className, classData }
79+
fs.writeFileSync(fileName, classTemplate(context))
8080
})
8181

8282
console.log('rendering index for class documentation')

docs/.vuepress/templates/jsdoc/class.handlebars

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ activeHeaderLinks: true
99
{{ jsDocBlock }}
1010
{{/each}}
1111

12-
__This is an autogenerated class documentation for {{ className }} __
12+
_This is an autogenerated class documentation for {{ className }}_
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
### {{ name }}()
2+
3+
{{#if description}}
4+
{{ description }}
5+
{{/if}}

docs/code/classes/Builder.md

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,38 @@ activeHeaderLinks: true
55
---
66
# Class Builder
77

8+
JsonApi-based module builder for Vuex
89

9-
__This is an autogenerated class documentation for Builder __
10+
This module builder will create a vuex module based on the assumption of
11+
working with valid json api resources.
12+
13+
- the proposed json api 1.1 pagination style meta attributes
14+
(-&gt; https://jsonapi.org/format/1.1/#fetching-pagination)
15+
16+
## Builder()
17+
18+
Module Builder for Json:Api bound Vuex Modules
19+
20+
### build()
21+
22+
Build the module for this builder instance
23+
24+
### buildMutations()
25+
26+
Build the mutations
27+
28+
### build()
29+
30+
Returns a new functional resource object
31+
32+
Functional resource objects are structurally identical to
33+
normal JSON:API resource objects but are enhanced with
34+
methods to simplify access to relationships.
35+
36+
### strip()
37+
38+
Convenience method to get a spec-conforming version of
39+
a resource object
40+
41+
42+
_This is an autogenerated class documentation for Builder_

docs/code/classes/FosJsRoutingRouter.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,7 @@ activeHeaderLinks: true
55
---
66
# Class FosJsRoutingRouter
77

8+
Pluggable api router if you&#x27;re using Symfony and the FosJsRouting Bundle
89

9-
__This is an autogenerated class documentation for FosJsRoutingRouter __
10+
11+
_This is an autogenerated class documentation for FosJsRoutingRouter_

docs/code/classes/JsonApiRouter.md

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,44 @@ activeHeaderLinks: true
55
---
66
# Class JsonApiRouter
77

8+
A simple router implementation querying a json:api endpoint which delivers all
9+
necessary route information
810

9-
__This is an autogenerated class documentation for JsonApiRouter __
11+
The endpoint must return a list of Route objects:
12+
13+
&#x60;&#x60;&#x60;json
14+
{
15+
&quot;data&quot;: [
16+
{
17+
&quot;type&quot;: &quot;Route&quot;,
18+
&quot;id&quot;: &quot;api.route.list&quot;,
19+
&quot;attributes&quot;: {
20+
&quot;parameters&quot;: [],
21+
&quot;url&quot;: &quot;api/route&quot;,
22+
&quot;method&quot;: &quot;list&quot;
23+
}
24+
},
25+
{
26+
&quot;type&quot;: &quot;Route&quot;,
27+
&quot;id&quot;: &quot;api.route.get&quot;,
28+
&quot;attributes&quot;: {
29+
&quot;parameters&quot;: [
30+
&quot;id&quot;
31+
],
32+
&quot;url&quot;: &quot;api/route/{id}&quot;,
33+
&quot;method&quot;: &quot;get&quot;
34+
}
35+
}
36+
]
37+
}
38+
&#x60;&#x60;&#x60;
39+
40+
To initialize this router, simply &#x60;new&#x60; it with the desired fetch path,
41+
e.g. &#x60;new JsonApiRouter(&#x27;/api/route&#x27;)&#x60;.
42+
43+
### updateRoutes()
44+
45+
Update routes
46+
47+
48+
_This is an autogenerated class documentation for JsonApiRouter_

docs/code/classes/Route.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,14 @@ activeHeaderLinks: true
66
# Class Route
77

88

9-
__This is an autogenerated class documentation for Route __
9+
10+
### prepare()
11+
12+
Prepare an url, replacing provided parameters
13+
14+
### hasParameter()
15+
16+
Check if a parameter is allowed
17+
18+
19+
_This is an autogenerated class documentation for Route_

docs/code/classes/Router.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,23 @@ activeHeaderLinks: true
55
---
66
# Class Router
77

8+
Basic router implementation for the ResourcefulApi.
89

9-
__This is an autogenerated class documentation for Router __
10+
Automagically creating api bound modules builds on
11+
an understanding of the available routes. To
12+
easily instantiate a Store bound to an endpoint,
13+
route information for that endpoint must be provided.
14+
15+
Since every endpoint is implemented differently and
16+
the choice where this route information comes from
17+
should be left to the endpoint developer, this
18+
library only assumes that route loading is usually an
19+
asynchronous process which eventually returns and
20+
has a set of keyed-by-name &#x60;Route&#x60; objects in
21+
&#x60;this.routes&#x60;.
22+
23+
### addRoute()
24+
25+
26+
27+
_This is an autogenerated class documentation for Router_

docs/code/classes/StaticRouter.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,17 @@ activeHeaderLinks: true
55
---
66
# Class StaticRouter
77

8+
Static router
89

9-
__This is an autogenerated class documentation for StaticRouter __
10+
It may be desirable to not do an additional request
11+
for getting the api routes and instead bake them into
12+
the code. To this avail, the &#x60;StaticRouter&#x60; can be
13+
initialized with a POJO of { id, url, parameters }
14+
whereas parameters are parts of the url which can be replaced.
15+
16+
## StaticRouter()
17+
18+
19+
20+
21+
_This is an autogenerated class documentation for StaticRouter_

0 commit comments

Comments
 (0)