<commit_before>---
meta:
- name: description 
  content: Documentation over Models and decorators provided by Ts.ED framework. Use decorator to
  build your model and JsonSchema.
- name: keywords 
  content: class model decorators ts.ed express typescript node.js javascript jsonschema
---
# Model

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

The classes models can be used in the following cases:

- Data serialization and deserialization ([Json mapping](/docs/converters.md)),
- Data validation with [AJV](/tutorials/ajv.md) or any library compatible with [JsonSchema](https://json-schema.org/),
- Generating documentation with [Swagger](/tutorials/swagger.md).

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

::: warning Validation is only available when you import `@tsed/ajv` package in your server.

```typescript
import {Configuration} from "@tsed/common";
import "@tsed/ajv";

@Configuration()
class Server {<commit_msg>docs: fix model yaml configuration<commit_after>---
meta:
 - name: description 
   content: Documentation over Models and decorators provided by Ts.ED framework. Use decorator to build your model and JsonSchema.
 - name: keywords
   content: class model decorators ts.ed express typescript node.js javascript jsonschema
---
# Model

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

The classes models can be used in the following cases:

- Data serialization and deserialization ([Json mapping](/docs/converters.md)),
- Data validation with [AJV](/tutorials/ajv.md) or any library compatible with [JsonSchema](https://json-schema.org/),
- Generating documentation with [Swagger](/tutorials/swagger.md).

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

::: warning Validation is only available when you import `@tsed/ajv` package in your server.

```typescript
import {Configuration} from "@tsed/common";
import "@tsed/ajv";

@Configuration()
class Server {
{'fraction_non_alphanumeric': 0.09478885893980234, 'fraction_numerical': 0.0, 'mean_word_length': 4.623737373737374, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3992128', 'n_tokens_mistral': 624, 'n_tokens_neox': 603, 'n_words': 258}