> For the complete documentation index, see [llms.txt](https://docs.decentraland.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.decentraland.org/contributor/contributor-pt/tutoriais/how-to-create-new-entity-type.md).

# Como criar um novo tipo de Entity

#### Quando é necessário criar uma nova entity?

Primeiro, verifique se uma entity existente pode resolver o caso de uso necessário para evitar uma solução com sobrerengenharia. Se nenhum dos tipos de entity existentes definidos em <https://github.com/decentraland/common-schemas/blob/main/src/platform/entity.ts#L13> satisfizer os requisitos, então talvez seja necessário criar um novo tipo de entity.

#### Primeira resposta:

* A nova entity é uma NFT Collection?
* Como a propriedade será validada?
* Qual será o tamanho dela?
* Qual é a quantidade de entities que será criada?

#### Passos

Primeiro, crie uma ADR em <https://github.com/decentraland/adr> onde você definirá o schema e a data para começar a validar a nova entity.

**Repositórios**

**@dcl/schemas**

1. Crie o novo tipo de entity no enum: <https://github.com/decentraland/common-schemas/blob/main/src/platform/entity.ts#L19>
2. Crie a pasta e os arquivos em <https://github.com/decentraland/common-schemas/tree/main/src/platform> gerando o type e o JSON schema, por exemplo: <https://github.com/decentraland/common-schemas/blob/main/src/platform/profile/profile.ts#L20>

**@dcl/content-validator**

Implemente as validações definidas na ADR, levando em conta a data dessa ADR em <https://github.com/decentraland/content-validator/blob/main/src/validations/timestamps.ts>. Por exemplo: <https://github.com/decentraland/content-validator/blob/main/src/validations/items/emotes.ts#L8>

1. Adicione o código para verificar a propriedade do novo tipo de entity em <https://github.com/decentraland/content-validator/tree/main/src/validations/access-checker>
2. Implemente o validationForType para o novo tipo, por exemplo: <https://github.com/decentraland/content-validator/blob/main/src/validations/profile.ts#L112>
3. Aqui você precisará definir o tamanho máximo por entity em <https://github.com/decentraland/content-validator/blob/main/src/validations/ADR51.ts>.

**@dcl/urn-resolver**

1. Se a nova entity corresponder a uma Collection, então nada precisa ser adicionado.
2. Se não, então crie um novo urn correspondente à nova entity e defina-o em <https://github.com/decentraland/urn-resolver> adicionando um resolver em <https://github.com/decentraland/urn-resolver/blob/main/src/resolvers.ts#L23>

**Catalyst: Content Server**

1. Nenhuma alteração no banco de dados é necessária.
2. Atualize todas as bibliotecas modificadas detalhadas acima.

**Catalyst: Lambdas Server**

1. Atualize todas as bibliotecas modificadas detalhadas acima.
2. Verifique se a sanitização do profile precisa ser atualizada (`/lambdas/profiles` endpoint)
3. Verifique se o endpoint de ERC collections precisa ser atualizado (`/lambdas/collections` endpoint)
4. Crie um endpoint para mostrar essa entity, por exemplo `/lambdas/wearables-by-owner`


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.decentraland.org/contributor/contributor-pt/tutoriais/how-to-create-new-entity-type.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
