Skip to content

Commit

Permalink
chore: Add update documentation from LorianeE
Browse files Browse the repository at this point in the history
  • Loading branch information
Travis committed Apr 14, 2020
1 parent 3136ca7 commit 6366035
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion docs/docs/controllers.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ In order to avoid such side-effects, simply move `findAll()` method above `findO
## Request
### Input parameters

Getting parameters from Express Request can be down by using the following decorators:
Getting parameters from Express Request can be done by using the following decorators:

- @@BodyParams@@: `Express.request.body`
- @@PathParams@@: `Express.request.params`
Expand Down
18 changes: 9 additions & 9 deletions docs/docs/model.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# Model

The classes can be used as a model in your application.
Ts.ED use this models to convert JSON objects to theirs class equivalents.
Ts.ED uses these models to convert JSON objects to their class equivalents.

The classes models can be used in the following cases:

- Serialization and deserialisation of data ([Converters](/docs/converters.md)),
- Data serialization and deserialization ([Converters](/docs/converters.md)),
- Data validation with [AJV](/tutorials/ajv.md),
- Generating documentation with [Swagger](/tutorials/swagger.md).

To create a model, Ts.ED provides decorators who will store and generate a
To create a model, Ts.ED provides decorators which will store and generate a
standard [JsonSchema](http://json-schema.org/) model.

## Example
Expand All @@ -20,11 +20,11 @@ such as the description of the field.
<<< @/docs/docs/snippets/model/example.ts

::: tip
The Model will generate a JsonSchema which can be used by module supporting JsonSchema spec
The Model will generate a JsonSchema which can be used by modules supporting JsonSchema spec
:::

::: warning
The schema generated by Ts.ED list only properties decorated by at least one decorator. In the previous example,
The schema generated by Ts.ED lists only properties decorated by at least one decorator. In the previous example,
the `_id` won't be displayed in the JsonSchema. It's very important to understand that **TypeScript** only generates
metadata on properties with at least of theses decorators:

Expand All @@ -39,17 +39,17 @@ Ts.ED will use the model to convert the raw data to an instance of your model.

## Collections

Declaring property that use a collection is a bit different than declaring a simple property. TypeScript
store only the Array/Set/Map type when your declare the type of your property. The type used by the collection is lost.
Declaring a property that uses a collection is a bit different than declaring a simple property. TypeScript
stores only the Array/Set/Map type when you declare the type of your property. The type used by the collection is lost.

To tell Ts.ED (and other third party which use JsonSchema) that a property use a collection with a specific type, you must
To tell Ts.ED (and other third party which uses JsonSchema) that a property uses a collection with a specific type, you must
use @@PropertyType@@ decorator as following:

<<< @/docs/docs/snippets/model/collections.ts

## Use JsonSchema

In some cases, it may be useful to retrieve the JSON Schema from a Model for use with another library.
In some cases, it may be useful to retrieve the JSON Schema from a Model to use with another library.

Here is an example of use with the AJV library:

Expand Down

0 comments on commit 6366035

Please sign in to comment.