Skip to content

Commit cb97964

Browse files
committedDec 20, 2017
Documentation checks and updates
1 parent 74c9f7a commit cb97964

File tree

3 files changed

+42
-64
lines changed

3 files changed

+42
-64
lines changed
 

‎README.md

+3-4
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ in a project.
88
[![npm downloads](https://img.shields.io/npm/dm/hapi-swagger.svg?style=flat-square)](https://www.npmjs.com/package/hapi-swagger)
99
[![MIT license](http://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)](https://raw.github.com/glennjones/microformat-shic/master/license.txt)
1010

11+
Release Notes for Version 9.0.x which only supports hapi v17 and above.
12+
Note: For hapi versions below v17, you must use versions [v7.x.x](https://github.com/glennjones/hapi-swagger/tree/v7.x) of this module.
1113

1214
# Install
1315

@@ -111,7 +113,4 @@ Read the [contributing guidelines](https://github.com/glennjones/hapi-swagger/bl
111113

112114

113115
# Thanks
114-
I would like to thank all that have contributed to the project over the last couple of years. This is a hard project to maintain, getting HAPI to work with Swagger
115-
is like putting a round plug in a square hole. Without the help of others it would not be possible.
116-
117-
116+
I would like to thank all that have contributed to the project over the last couple of years. This is a hard project to maintain, getting HAPI to work with Swagger is like putting a round plug in a square hole. Without the help of others it would not be possible.

‎optionsreference.md

+27-39
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# 7.9.0 Options Reference
1+
# 9.0.0 Options Reference
22

33
## Plugin Options
44

@@ -77,43 +77,35 @@ The plugin level options are added as you register the `hapi-swagger` plugin.
7777

7878
```Javascript
7979
const options = {
80-
'info': {
81-
'title': 'Test API Documentation',
82-
'version': '5.14.3',
83-
'contact': {
84-
'name': 'Glenn Jones',
85-
'email': 'glenn@example.com'
86-
},
87-
'schemes': ['https'],
88-
'host': 'example.com'
89-
};
90-
91-
server.register([
92-
require('inert'),
93-
require('vision'),
80+
'info': {
81+
'title': 'Test API Documentation',
82+
'version': '5.14.3',
83+
'contact': {
84+
'name': 'Glenn Jones',
85+
'email': 'glenn@example.com'
86+
},
87+
'schemes': ['https'],
88+
'host': 'example.com'
89+
};
90+
91+
await server.register([
92+
Inert,
93+
Vision,
9494
{
95-
require('hapi-swagger'),
96-
options: options
97-
}],
98-
(err) => {
99-
100-
if (err) {
101-
console.log(err);
102-
}
103-
104-
server.route(Routes);
95+
'register': HapiSwagger,
96+
'options': options
97+
}
98+
]);
10599

106-
server.start((err) => {
107-
if (err) {
108-
console.log(err);
109-
} else {
110-
console.log('Server running at:', server.info.uri);
111-
}
112-
});
113-
});
100+
try {
101+
await server.start( (err) => {
102+
console.log('Server running at:', server.info.uri);
103+
} catch(err) {
104+
console.log(err);
105+
}
106+
server.route(Routes);
114107
```
115108
116-
117109
# Route options example
118110
The route level options are always placed within the `plugins.hapi-swagger` object under `config`. These options are
119111
only assigned to the route they are apply to.
@@ -141,8 +133,4 @@ only assigned to the route they are apply to.
141133
}
142134
}
143135
}
144-
```
145-
146-
147-
148-
136+
```

‎usageguide.md

+12-21
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# 7.9.0 Usage Guide
1+
# 9.0.0 Usage Guide
22

33
### Content
44
* [JSON body](#json-body)
@@ -309,17 +309,17 @@ config: {
309309
tags: ['api'],
310310
notes: ['Adds together two numbers and return the result'],
311311
plugins: {
312-
'hapi-swagger': {
313-
responses: {
314-
'200': {
315-
'description': 'Success',
316-
'schema': Joi.object({
317-
equals: Joi.number(),
318-
}).label('Result')
319-
},
320-
'400': {'description': 'Bad Request'}
321-
}
322-
},
312+
'hapi-swagger': {
313+
responses: {
314+
'200': {
315+
'description': 'Success',
316+
'schema': Joi.object({
317+
equals: Joi.number(),
318+
}).label('Result')
319+
},
320+
'400': {'description': 'Bad Request'}
321+
}
322+
},
323323
validate: {
324324
params: {
325325
a: Joi.number()
@@ -669,10 +669,6 @@ This will load all routes that have one or more of the given tags (`foo` or `bar
669669
?tags=mountains,+beach,-horses
670670
this will show routes WITH 'mountains' AND 'beach' AND NO 'horses'
671671
672-
673-
674-
675-
676672
# Example code in project
677673
There are a number of examples of different uses of `hapi-swagger` in the examples directory. These files contain a full HAPI node app:
678674
@@ -686,11 +682,6 @@ There are a number of examples of different uses of `hapi-swagger` in the exampl
686682
* [`upload-file.js`](examples/upload-file.js) - how create documenation for a file upload
687683
* [`versions.js`](examples/versions.js) - how to use the plug-in with `hapi-api-version` for versioning of an API
688684
689-
690-
691-
692-
693-
694685
# External example projects
695686
Both these example use a custom HTML page
696687
* [`be-more-hapi`](https://github.com/glennjones/be-more-hapi) - talk from Async.js on the October 2013 - old `hapi-swagger` example project, but keep update

0 commit comments

Comments
 (0)
Please sign in to comment.