Skip to content

Commit ed70178

Browse files
committed
Fix typos
Thank you guys for your help !
1 parent cf18bc1 commit ed70178

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

_posts/2013-02-12-swagger-jack.markdown

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,22 @@ tags: [swagger, api, validation, nodejs, express, descriptor]
55
author: feugy
66
---
77

8-
Perhaps did you already heard about [Swagger](http://developers.helloreverb.com/swagger/). And if not, I can only beg you to drop an eye on it.
8+
Perhaps did you already heard about [Swagger](http://developers.helloreverb.com/swagger/). And if not, I can only beg you to check it out.
99

1010
Swagger is a specification and complete framework implementation for describing, producing, consuming, and visualizing RESTful web services.
1111

1212
It provides:
13-
- specification: to write descriptors of your API
14-
- tools: based on this descriptors: friendly GUI for documentation, client libraries...
13+
- specification: how to write descriptors for your API
14+
- tools: based on these descriptors: friendly GUI for documentation, client libraries...
1515

16-
**Swagger-jack** is one of these tools: a couple of [Express](http://expressjs.com/) middelware (the famous [NodeJS](http://nodejs.org/) Web framework) to generate your own API, and take advantage of automated input validation.
16+
**Swagger-jack** is one of these tools: a couple of [Express](http://expressjs.com/) middelwares (the famous [NodeJS](http://nodejs.org/) Web framework) to generate your own API, and take advantage of automated input validation.
1717

1818
You'll find the source code on [github](https://github.com/feugy/swagger-jack), and the project was released on [NPM](https://npmjs.org/package/swagger-jack)
1919

2020
<br/>
2121
## What is swagger
2222

23-
Whether you're building huge information systems or providing a single (but powerfull) REST web service, describing your API will give a better knowledge and therefore usage of your service. And If you can benefit from a well-known standard and its tooling suite... It's icing on the cake.
23+
Whether you're building huge information systems or providing a single (but powerful) REST web service, describing your API will give a better knowledge and therefore usage of your service. And If you can benefit from a well-known standard and its tooling suite... It's icing on the cake.
2424

2525
![swagger-ui example](http://helloreverb.com/img/swagger-hero.png)
2626

@@ -92,7 +92,7 @@ For a given resource, a detailed descriptor will give a list of **api**.
9292
An api is simply a sub-path associated with a list of **operations**.
9393
An operation is an HTTP verb for this sub-path, a set of awaited parameters and an expected model for the response.
9494

95-
Last of all, the detailed descriptor will embed a list of **models**.
95+
At last, the detailed descriptor will embed a list of **models**.
9696
A model is a formal description of a complex object, that can be used in input parameters and output response body.
9797

9898
{% highlight json %}
@@ -131,16 +131,16 @@ To sum up, each urls of your REST web service will be grouped within operations
131131
<br/>
132132
## The swagger-jack library: why and how
133133

134-
We heavily use NodeJS in our project, and Express is the community most popular web framework.
135-
It's principle is quite simple: you declare your routes (an urls and an http method) and associate each of them to a function with specific arguments.
136-
Second concepts: middleware.
137-
A middleware is a function that behave like Java's filters: it's invoked for each incoming request and can process to it, enrich it and let other process it, or just ignore it.
134+
We heavily use NodeJS in our project, and Express is the most popular web framework in the community.
135+
It's principle is quite simple: you declare your routes (an URL and an http method) and associate each of them to a function with specific arguments.
136+
Second concept: middleware.
137+
A middleware is a function that behave like Java filters: it's invoked for each incoming request and can process it, enrich it and let other process it, or just ignore it.
138138

139139
We wanted to use swagger on existing web services, and enforce the input validation.
140-
We looked at swagger-node-express the official nodejs plugin provided, but it involved too many code changes, and it does not provide validation.
140+
We had a look to swagger-node-express the official nodejs plugin provided, but it involved too many code changes, and it does not provide validation.
141141
And that's how swagger-jack was born.
142142

143-
It provides three middleware, which you can enable or not.
143+
It provides three middlewares, which you can enable or not.
144144

145145
{% highlight json %}
146146
var express = require('express'),
@@ -191,7 +191,7 @@ It provides three middleware, which you can enable or not.
191191

192192
Generator takes a general descriptor path (which is totally not constraint: put whatever you need in it), and an array of "resources".
193193

194-
The middleware will automatically register to your express application the routes found inside the descriptor, and bound them to the provided controller (it uses the `nickname` attribute to reach your function). In this example, two routes are created:
194+
The middleware will automatically register in your Express application the routes found in the descriptor, and bind them to the provided controller (it uses the `nickname` attribute to reach your function). In this example, two routes are created:
195195

196196
1. `POST /api/user/` to create a user (controller method `create()`)
197197
2. `GET /api/user/` to list existing users (controller method `list()`)
@@ -203,8 +203,8 @@ You can still register routes and middleware within your application, but they w
203203
Validator will analyze the declared parameters of your descriptor, and validate the input.
204204
It will handle parameter casting, range validation and declared model compliance (thank to the excellent [json-gate](https://github.com/oferei/json-gate)).
205205

206-
All casted values (except body parameters) are available inside the controller methods with the `req.input` associative array.
207-
No matter if parameter is from path, query or header: it will be present inside `req.input`.
206+
All casted values (except body parameters) are available in the controller methods with the `req.input` associative array.
207+
No matter if a parameter is from path, query or header: it will be present inside `req.input`.
208208

209209
But you can still use the Express original function (beware: values are just strings).
210210

@@ -215,9 +215,9 @@ If you do not need validation, no problem: just remove the validator middleware.
215215
### Error middleware
216216

217217
Validation errors (and your custom business errors) are handled by the error middleware.
218-
It uses the express's error mecanism: invoke the next() method with an argument.
218+
It uses the Express's error management mechanism: invoke the next() method with an argument.
219219

220-
Weither it's a string or an object, it will be serialized into a json response with an http status (500 by default).
220+
Wether it's a string or an object, it will be serialized into a json response with an http status (500 by default).
221221

222222
For example:
223223

@@ -274,9 +274,9 @@ Use [js-yaml](http://nodeca.github.com/js-yaml/) to store your descriptor in a s
274274
<br/>
275275
## In conclusion
276276

277-
Swagger-jack enpowered your NodeJS application with Swagger compliant Api descriptor.
277+
Swagger-jack enpowered your NodeJS application with Swagger compliant API descriptor.
278278

279-
It brings you a better lisibility: first you describe things (even in a separate file thanks to js-yaml), then you implement them.
279+
It brings you better lisibility: first you describe things (even in a separate file thanks to js-yaml), then you implement them.
280280

281281
It respects your own code organization: whether to use a huge file or one file per url is your choice.
282282

@@ -292,4 +292,4 @@ So, have fun with swagger and swagger-jack !
292292
### Addendum: what's with that name ?
293293

294294
We looked for a fun and yet eloquent name. But swagger.js was already used.
295-
[Jack Swagger](http://www.wwe.com/superstars/jackswagger) is an american catch superstar, and we never heard about him before, but it perfectly fits your naming goals :)
295+
[Jack Swagger](http://www.wwe.com/superstars/jackswagger) is an american catch superstar, and we never heard about him before, but it perfectly fits our naming goals :)

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