nsj-rest-lib2 0.0.15__tar.gz → 0.0.16__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {nsj_rest_lib2-0.0.15 → nsj_rest_lib2-0.0.16}/PKG-INFO +5 -2
- {nsj_rest_lib2-0.0.15 → nsj_rest_lib2-0.0.16}/README.md +5 -2
- {nsj_rest_lib2-0.0.15 → nsj_rest_lib2-0.0.16}/nsj_rest_lib2/compiler/compiler.py +80 -33
- {nsj_rest_lib2-0.0.15 → nsj_rest_lib2-0.0.16}/nsj_rest_lib2/compiler/edl_model/entity_model.py +2 -2
- {nsj_rest_lib2-0.0.15 → nsj_rest_lib2-0.0.16}/nsj_rest_lib2/compiler/edl_model/entity_model_base.py +7 -4
- nsj_rest_lib2-0.0.15/nsj_rest_lib2/compiler/edl_model/entity_model_mixin.py → nsj_rest_lib2-0.0.16/nsj_rest_lib2/compiler/edl_model/entity_model_root.py +1 -1
- {nsj_rest_lib2-0.0.15 → nsj_rest_lib2-0.0.16}/nsj_rest_lib2/compiler/edl_model/property_meta_model.py +1 -2
- {nsj_rest_lib2-0.0.15 → nsj_rest_lib2-0.0.16}/nsj_rest_lib2/compiler/entity_compiler.py +12 -3
- {nsj_rest_lib2-0.0.15 → nsj_rest_lib2-0.0.16}/nsj_rest_lib2/compiler/property_compiler.py +11 -1
- {nsj_rest_lib2-0.0.15 → nsj_rest_lib2-0.0.16}/nsj_rest_lib2.egg-info/PKG-INFO +5 -2
- {nsj_rest_lib2-0.0.15 → nsj_rest_lib2-0.0.16}/nsj_rest_lib2.egg-info/SOURCES.txt +2 -2
- {nsj_rest_lib2-0.0.15 → nsj_rest_lib2-0.0.16}/setup.cfg +1 -1
- {nsj_rest_lib2-0.0.15 → nsj_rest_lib2-0.0.16}/nsj_rest_lib2/__init__.py +0 -0
- {nsj_rest_lib2-0.0.15 → nsj_rest_lib2-0.0.16}/nsj_rest_lib2/compiler/__init__.py +0 -0
- {nsj_rest_lib2-0.0.15 → nsj_rest_lib2-0.0.16}/nsj_rest_lib2/compiler/ai_compiler.py +0 -0
- {nsj_rest_lib2-0.0.15 → nsj_rest_lib2-0.0.16}/nsj_rest_lib2/compiler/compiler_structures.py +0 -0
- {nsj_rest_lib2-0.0.15 → nsj_rest_lib2-0.0.16}/nsj_rest_lib2/compiler/dto_compiler.py +0 -0
- {nsj_rest_lib2-0.0.15 → nsj_rest_lib2-0.0.16}/nsj_rest_lib2/compiler/edl_model/__init__.py +0 -0
- {nsj_rest_lib2-0.0.15 → nsj_rest_lib2-0.0.16}/nsj_rest_lib2/compiler/edl_model/ai_entity_edl.py +0 -0
- {nsj_rest_lib2-0.0.15 → nsj_rest_lib2-0.0.16}/nsj_rest_lib2/compiler/edl_model/api_model.py +0 -0
- {nsj_rest_lib2-0.0.15 → nsj_rest_lib2-0.0.16}/nsj_rest_lib2/compiler/edl_model/column_meta_model.py +0 -0
- {nsj_rest_lib2-0.0.15 → nsj_rest_lib2-0.0.16}/nsj_rest_lib2/compiler/edl_model/index_model.py +0 -0
- {nsj_rest_lib2-0.0.15 → nsj_rest_lib2-0.0.16}/nsj_rest_lib2/compiler/edl_model/primitives.py +0 -0
- {nsj_rest_lib2-0.0.15 → nsj_rest_lib2-0.0.16}/nsj_rest_lib2/compiler/edl_model/repository_model.py +0 -0
- {nsj_rest_lib2-0.0.15 → nsj_rest_lib2-0.0.16}/nsj_rest_lib2/compiler/edl_model/trait_property_meta_model.py +0 -0
- {nsj_rest_lib2-0.0.15 → nsj_rest_lib2-0.0.16}/nsj_rest_lib2/compiler/model.py +0 -0
- {nsj_rest_lib2-0.0.15 → nsj_rest_lib2-0.0.16}/nsj_rest_lib2/compiler/util/__init__.py +0 -0
- {nsj_rest_lib2-0.0.15 → nsj_rest_lib2-0.0.16}/nsj_rest_lib2/compiler/util/str_util.py +0 -0
- {nsj_rest_lib2-0.0.15 → nsj_rest_lib2-0.0.16}/nsj_rest_lib2/compiler/util/type_naming_util.py +0 -0
- {nsj_rest_lib2-0.0.15 → nsj_rest_lib2-0.0.16}/nsj_rest_lib2/compiler/util/type_util.py +0 -0
- {nsj_rest_lib2-0.0.15 → nsj_rest_lib2-0.0.16}/nsj_rest_lib2/controller/__init__.py +0 -0
- {nsj_rest_lib2-0.0.15 → nsj_rest_lib2-0.0.16}/nsj_rest_lib2/controller/dynamic_controller.py +0 -0
- {nsj_rest_lib2-0.0.15 → nsj_rest_lib2-0.0.16}/nsj_rest_lib2/exception.py +0 -0
- {nsj_rest_lib2-0.0.15 → nsj_rest_lib2-0.0.16}/nsj_rest_lib2/redis_config.py +0 -0
- {nsj_rest_lib2-0.0.15 → nsj_rest_lib2-0.0.16}/nsj_rest_lib2/service/__init__.py +0 -0
- {nsj_rest_lib2-0.0.15 → nsj_rest_lib2-0.0.16}/nsj_rest_lib2/service/entity_loader.py +0 -0
- {nsj_rest_lib2-0.0.15 → nsj_rest_lib2-0.0.16}/nsj_rest_lib2/settings.py +0 -0
- {nsj_rest_lib2-0.0.15 → nsj_rest_lib2-0.0.16}/nsj_rest_lib2.egg-info/dependency_links.txt +0 -0
- {nsj_rest_lib2-0.0.15 → nsj_rest_lib2-0.0.16}/nsj_rest_lib2.egg-info/requires.txt +0 -0
- {nsj_rest_lib2-0.0.15 → nsj_rest_lib2-0.0.16}/nsj_rest_lib2.egg-info/top_level.txt +0 -0
- {nsj_rest_lib2-0.0.15 → nsj_rest_lib2-0.0.16}/pyproject.toml +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: nsj_rest_lib2
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.16
|
|
4
4
|
Summary: Biblioteca para permitir a distribuição de rotas dinâmicas numa API, configuradas por meio de EDLs declarativos (em formato JSON).
|
|
5
5
|
Home-page: https://github.com/Nasajon/nsj_rest_lib2
|
|
6
6
|
Author: Nasajon Sistemas
|
|
@@ -23,8 +23,11 @@ Requires-Dist: pyyaml<7.0.0,>=6.0.3
|
|
|
23
23
|
|
|
24
24
|
Biblioteca para permitir a distribuição de rotas dinâmicas numa API, configuradas por meio de EDLs declarativos (em formato JSON).
|
|
25
25
|
|
|
26
|
+
[ESPECIFICAÇÃO DO MODELO DE ENTIDADES](docs/especificacao.md)
|
|
27
|
+
|
|
26
28
|
## TODO
|
|
27
|
-
* Colocar tempo para recarregamento das entidades (para checar, no redis, se mudou o hash.)
|
|
28
29
|
* Unificar o arquivo redis_config.py
|
|
29
30
|
* Usar pydantic, ou similar, para transformar a configuração das entidades, no redis, num objeto
|
|
30
31
|
* Rever modo de usar o InjectFactory (talvez dando ciência, ao RestLib, do padrão multibanco)
|
|
32
|
+
* Implementar e documentar campos join
|
|
33
|
+
* Implementar e documentar conjuntos
|
|
@@ -2,8 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
Biblioteca para permitir a distribuição de rotas dinâmicas numa API, configuradas por meio de EDLs declarativos (em formato JSON).
|
|
4
4
|
|
|
5
|
+
[ESPECIFICAÇÃO DO MODELO DE ENTIDADES](docs/especificacao.md)
|
|
6
|
+
|
|
5
7
|
## TODO
|
|
6
|
-
* Colocar tempo para recarregamento das entidades (para checar, no redis, se mudou o hash.)
|
|
7
8
|
* Unificar o arquivo redis_config.py
|
|
8
9
|
* Usar pydantic, ou similar, para transformar a configuração das entidades, no redis, num objeto
|
|
9
|
-
* Rever modo de usar o InjectFactory (talvez dando ciência, ao RestLib, do padrão multibanco)
|
|
10
|
+
* Rever modo de usar o InjectFactory (talvez dando ciência, ao RestLib, do padrão multibanco)
|
|
11
|
+
* Implementar e documentar campos join
|
|
12
|
+
* Implementar e documentar conjuntos
|
|
@@ -9,7 +9,7 @@ from nsj_rest_lib2.compiler.compiler_structures import (
|
|
|
9
9
|
)
|
|
10
10
|
from nsj_rest_lib2.compiler.dto_compiler import DTOCompiler
|
|
11
11
|
from nsj_rest_lib2.compiler.edl_model.entity_model_base import EntityModelBase
|
|
12
|
-
from nsj_rest_lib2.compiler.edl_model.
|
|
12
|
+
from nsj_rest_lib2.compiler.edl_model.entity_model_root import EntityModelRoot
|
|
13
13
|
from nsj_rest_lib2.compiler.edl_model.primitives import REGEX_EXTERNAL_REF
|
|
14
14
|
from nsj_rest_lib2.compiler.entity_compiler import EntityCompiler
|
|
15
15
|
from nsj_rest_lib2.compiler.model import CompilerResult
|
|
@@ -19,6 +19,7 @@ from nsj_rest_lib2.compiler.edl_model.entity_model import EntityModel
|
|
|
19
19
|
|
|
20
20
|
from nsj_rest_lib2.settings import get_logger
|
|
21
21
|
|
|
22
|
+
# TODO GET e POST de relacionamentos 1X1
|
|
22
23
|
# TODO Revisar compilação de valores default (sensível a tipos)
|
|
23
24
|
# TODO Implementar suporte a conjuntos
|
|
24
25
|
# TODO Autenticação nas rotas
|
|
@@ -60,7 +61,7 @@ class EDLCompiler:
|
|
|
60
61
|
entity_models = []
|
|
61
62
|
for dependency_edl in dependencies_edls:
|
|
62
63
|
if "mixin" in dependency_edl and dependency_edl["mixin"]:
|
|
63
|
-
dependency_entity_model =
|
|
64
|
+
dependency_entity_model = EntityModelRoot(**dependency_edl)
|
|
64
65
|
else:
|
|
65
66
|
dependency_entity_model = EntityModel(**dependency_edl)
|
|
66
67
|
entity_models.append(dependency_entity_model)
|
|
@@ -220,6 +221,16 @@ class EDLCompiler:
|
|
|
220
221
|
if not entity_model:
|
|
221
222
|
return
|
|
222
223
|
|
|
224
|
+
# Populando com os components da superclasse (extends)
|
|
225
|
+
if entity_model.extends:
|
|
226
|
+
super_model = entity_models[entity_model.extends]
|
|
227
|
+
|
|
228
|
+
self._make_components_structures(
|
|
229
|
+
components_structure,
|
|
230
|
+
super_model,
|
|
231
|
+
entity_models,
|
|
232
|
+
)
|
|
233
|
+
|
|
223
234
|
# Populando com os components do trait
|
|
224
235
|
if entity_model.trait_from:
|
|
225
236
|
trait_model = entity_models[entity_model.trait_from]
|
|
@@ -243,6 +254,29 @@ class EDLCompiler:
|
|
|
243
254
|
if not entity_model:
|
|
244
255
|
return
|
|
245
256
|
|
|
257
|
+
# Populando com as propriedades dos mixins
|
|
258
|
+
if entity_model.mixins:
|
|
259
|
+
for mixin_id in entity_model.mixins:
|
|
260
|
+
if mixin_id not in entity_models:
|
|
261
|
+
raise Exception(f"Mixin '{mixin_id}' não encontrado.")
|
|
262
|
+
|
|
263
|
+
mixin_model = entity_models[mixin_id]
|
|
264
|
+
self._make_properties_structures(
|
|
265
|
+
properties_structure,
|
|
266
|
+
mixin_model,
|
|
267
|
+
entity_models,
|
|
268
|
+
)
|
|
269
|
+
|
|
270
|
+
# Populando com as propriedades da superclasse (extends)
|
|
271
|
+
if entity_model.extends:
|
|
272
|
+
super_model = entity_models[entity_model.extends]
|
|
273
|
+
|
|
274
|
+
self._make_properties_structures(
|
|
275
|
+
properties_structure,
|
|
276
|
+
super_model,
|
|
277
|
+
entity_models,
|
|
278
|
+
)
|
|
279
|
+
|
|
246
280
|
# Populando com as propriedades do trait
|
|
247
281
|
if entity_model.trait_from:
|
|
248
282
|
trait_model = entity_models[entity_model.trait_from]
|
|
@@ -276,19 +310,6 @@ class EDLCompiler:
|
|
|
276
310
|
entity_model.repository.properties
|
|
277
311
|
)
|
|
278
312
|
|
|
279
|
-
# Populando com as propriedades dos mixins
|
|
280
|
-
if entity_model.mixins:
|
|
281
|
-
for mixin_id in entity_model.mixins:
|
|
282
|
-
if mixin_id not in entity_models:
|
|
283
|
-
raise Exception(f"Mixin '{mixin_id}' não encontrado.")
|
|
284
|
-
|
|
285
|
-
mixin_model = entity_models[mixin_id]
|
|
286
|
-
self._make_properties_structures(
|
|
287
|
-
properties_structure,
|
|
288
|
-
mixin_model,
|
|
289
|
-
entity_models,
|
|
290
|
-
)
|
|
291
|
-
|
|
292
313
|
def _make_unique_map_by_property(
|
|
293
314
|
self,
|
|
294
315
|
map_indexes_by_property: dict[str, list[IndexCompilerStructure]],
|
|
@@ -301,6 +322,30 @@ class EDLCompiler:
|
|
|
301
322
|
if not entity_model:
|
|
302
323
|
return
|
|
303
324
|
|
|
325
|
+
# Populando com as uniques da superclasse (extends)
|
|
326
|
+
if entity_model.extends:
|
|
327
|
+
super_model = entity_models[entity_model.extends]
|
|
328
|
+
|
|
329
|
+
self._make_unique_map_by_property(
|
|
330
|
+
map_indexes_by_property,
|
|
331
|
+
map_unique_by_property,
|
|
332
|
+
super_model,
|
|
333
|
+
entity_models,
|
|
334
|
+
deep=deep + 1,
|
|
335
|
+
)
|
|
336
|
+
|
|
337
|
+
# Populando com as uniques do trait
|
|
338
|
+
if entity_model.trait_from:
|
|
339
|
+
trait_model = entity_models[entity_model.trait_from]
|
|
340
|
+
|
|
341
|
+
self._make_unique_map_by_property(
|
|
342
|
+
map_indexes_by_property,
|
|
343
|
+
map_unique_by_property,
|
|
344
|
+
trait_model,
|
|
345
|
+
entity_models,
|
|
346
|
+
deep=deep + 1,
|
|
347
|
+
)
|
|
348
|
+
|
|
304
349
|
# Varrendo e organizando os índices
|
|
305
350
|
if entity_model.repository.indexes:
|
|
306
351
|
for index in entity_model.repository.indexes:
|
|
@@ -324,23 +369,11 @@ class EDLCompiler:
|
|
|
324
369
|
list_index = map_indexes_by_property.setdefault(pkey, [])
|
|
325
370
|
list_index.append(IndexCompilerStructure(index, deep > 1))
|
|
326
371
|
|
|
327
|
-
# Populando com as propriedades do trait
|
|
328
|
-
if entity_model.trait_from:
|
|
329
|
-
trait_model = entity_models[entity_model.trait_from]
|
|
330
|
-
|
|
331
|
-
self._make_unique_map_by_property(
|
|
332
|
-
map_indexes_by_property,
|
|
333
|
-
map_unique_by_property,
|
|
334
|
-
trait_model,
|
|
335
|
-
entity_models,
|
|
336
|
-
deep=deep + 1,
|
|
337
|
-
)
|
|
338
|
-
|
|
339
372
|
def list_dependencies(
|
|
340
373
|
self, edl_json: dict[str, Any]
|
|
341
374
|
) -> tuple[list[str], EntityModelBase]:
|
|
342
375
|
if edl_json.get("mixin", False):
|
|
343
|
-
entity_model =
|
|
376
|
+
entity_model = EntityModelRoot(**edl_json)
|
|
344
377
|
else:
|
|
345
378
|
entity_model = EntityModel(**edl_json)
|
|
346
379
|
|
|
@@ -349,16 +382,30 @@ class EDLCompiler:
|
|
|
349
382
|
def _list_dependencies(self, entity_model: EntityModelBase) -> list[str]:
|
|
350
383
|
entities: list[str] = []
|
|
351
384
|
|
|
352
|
-
# Adicionando dependências por traits
|
|
353
|
-
if entity_model.trait_from:
|
|
354
|
-
entities.append(entity_model.trait_from)
|
|
355
|
-
|
|
356
385
|
# Adicionando dependências por mixins
|
|
357
386
|
if entity_model.mixins:
|
|
358
387
|
entities.extend(entity_model.mixins)
|
|
359
388
|
|
|
389
|
+
# Adicionando dependências por traits
|
|
390
|
+
if entity_model.extends:
|
|
391
|
+
entities.append(entity_model.extends)
|
|
392
|
+
|
|
393
|
+
# Adicionando dependências por traits
|
|
394
|
+
if entity_model.trait_from:
|
|
395
|
+
entities.append(entity_model.trait_from)
|
|
396
|
+
|
|
360
397
|
# Populando com as dependências de propriedades de relacionamento
|
|
361
398
|
relations = self._list_dependencies_relations(entity_model)
|
|
399
|
+
|
|
400
|
+
components_dependency_list = []
|
|
401
|
+
if entity_model.components is not None:
|
|
402
|
+
for component in entity_model.components:
|
|
403
|
+
components_dependency_list.extend(
|
|
404
|
+
self._list_dependencies(entity_model.components[component])
|
|
405
|
+
)
|
|
406
|
+
|
|
407
|
+
relations.extend(components_dependency_list)
|
|
408
|
+
|
|
362
409
|
entities.extend(relations)
|
|
363
410
|
|
|
364
411
|
return entities
|
|
@@ -419,7 +466,7 @@ if __name__ == "__main__":
|
|
|
419
466
|
# e já realizando as validações básicas de tipo e estrutura.
|
|
420
467
|
print(f"Validando arquivo: {file}")
|
|
421
468
|
if edl.get("mixin", False):
|
|
422
|
-
entity_model =
|
|
469
|
+
entity_model = EntityModelRoot(**edl)
|
|
423
470
|
else:
|
|
424
471
|
entity_model = EntityModel(**edl)
|
|
425
472
|
|
{nsj_rest_lib2-0.0.15 → nsj_rest_lib2-0.0.16}/nsj_rest_lib2/compiler/edl_model/entity_model.py
RENAMED
|
@@ -4,10 +4,10 @@ from pydantic import Field
|
|
|
4
4
|
from typing import Optional
|
|
5
5
|
|
|
6
6
|
from nsj_rest_lib2.compiler.edl_model.api_model import APIModel
|
|
7
|
-
from nsj_rest_lib2.compiler.edl_model.
|
|
7
|
+
from nsj_rest_lib2.compiler.edl_model.entity_model_root import EntityModelRoot
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
class EntityModel(
|
|
10
|
+
class EntityModel(EntityModelRoot):
|
|
11
11
|
edl_version: Optional[str] = Field(default="1.0", description="Versão do EDL")
|
|
12
12
|
version: Optional[str] = Field(
|
|
13
13
|
default="1.0", description="Versão da entidade (padrão: 1.0)."
|
{nsj_rest_lib2-0.0.15 → nsj_rest_lib2-0.0.16}/nsj_rest_lib2/compiler/edl_model/entity_model_base.py
RENAMED
|
@@ -18,6 +18,13 @@ class EntityModelBase(BaseModel):
|
|
|
18
18
|
...,
|
|
19
19
|
description="Identificador único da entidade, dentro de um determinado escopo (podendo ser sobreescrito para um tenant ou grupo _empresarial).",
|
|
20
20
|
)
|
|
21
|
+
mixin: Optional[bool] = Field(
|
|
22
|
+
False,
|
|
23
|
+
description="Indica se o modelo é um mixin (bloco reutilizável, que não gera contém tabela própria no banco).",
|
|
24
|
+
)
|
|
25
|
+
extends: Optional[str] = Field(
|
|
26
|
+
None, description="Identificador da entidade estendida por esta."
|
|
27
|
+
)
|
|
21
28
|
trait_from: Optional[str] = Field(
|
|
22
29
|
None, description="Identificador da entidade que a trait estende."
|
|
23
30
|
)
|
|
@@ -28,10 +35,6 @@ class EntityModelBase(BaseModel):
|
|
|
28
35
|
required: Optional[List[str]] = Field(
|
|
29
36
|
None, description="Lista de campos obrigatórios no modelo."
|
|
30
37
|
)
|
|
31
|
-
mixin: Optional[bool] = Field(
|
|
32
|
-
False,
|
|
33
|
-
description="Indica se o modelo é um mixin (bloco reutilizável, que não gera contém tabela própria no banco).",
|
|
34
|
-
)
|
|
35
38
|
partition_data: Optional[List[str]] = Field(
|
|
36
39
|
None,
|
|
37
40
|
description="Lista de propriedades da entidade, que serã usadas para particionamento dos dados no banco (sendo obrigatórias em todas as chamadas, inclusive como um tipo de filtro obrigatório).",
|
|
@@ -3,5 +3,5 @@ from pydantic import Field
|
|
|
3
3
|
from nsj_rest_lib2.compiler.edl_model.entity_model_base import EntityModelBase
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
class
|
|
6
|
+
class EntityModelRoot(EntityModelBase):
|
|
7
7
|
escopo: str = Field(..., description="Escopo do EDL (define a aplicação).")
|
|
@@ -26,7 +26,6 @@ class PropertyMetaModel(BaseModel):
|
|
|
26
26
|
key_alternative: Optional[bool] = Field(
|
|
27
27
|
default=False,
|
|
28
28
|
description="Indica se a propriedade é parte de uma chave alternativa (chave natural).",
|
|
29
|
-
alias="keyAlternative",
|
|
30
29
|
)
|
|
31
30
|
cardinality: Optional[CardinalityTypes] = Field(
|
|
32
31
|
None,
|
|
@@ -39,7 +38,7 @@ class PropertyMetaModel(BaseModel):
|
|
|
39
38
|
|
|
40
39
|
## TODO Sugestões de validação
|
|
41
40
|
min_length: Optional[int] = Field(
|
|
42
|
-
None, description="Comprimento mínimo (para strings)."
|
|
41
|
+
None, description="Comprimento mínimo (para strings)."
|
|
43
42
|
)
|
|
44
43
|
pattern: Optional[str] = Field(
|
|
45
44
|
None,
|
|
@@ -50,6 +50,15 @@ class EntityCompiler:
|
|
|
50
50
|
)
|
|
51
51
|
|
|
52
52
|
default_order_props = []
|
|
53
|
+
|
|
54
|
+
key_field = props_pk[0]
|
|
55
|
+
if entity_model.repository.properties:
|
|
56
|
+
if (
|
|
57
|
+
key_field in entity_model.repository.properties
|
|
58
|
+
and entity_model.repository.properties[key_field].column
|
|
59
|
+
):
|
|
60
|
+
key_field = entity_model.repository.properties[props_pk[0]].column
|
|
61
|
+
|
|
53
62
|
if (
|
|
54
63
|
isinstance(entity_model, EntityModel)
|
|
55
64
|
and entity_model.api
|
|
@@ -69,8 +78,8 @@ class EntityCompiler:
|
|
|
69
78
|
|
|
70
79
|
default_order_fields.append(CompilerStrUtil.to_snake_case(field))
|
|
71
80
|
|
|
72
|
-
if CompilerStrUtil.to_snake_case(
|
|
73
|
-
default_order_fields.append(CompilerStrUtil.to_snake_case(
|
|
81
|
+
if CompilerStrUtil.to_snake_case(key_field) not in default_order_fields:
|
|
82
|
+
default_order_fields.append(CompilerStrUtil.to_snake_case(key_field))
|
|
74
83
|
|
|
75
84
|
class_name = compile_entity_class_name(entity_model.id, prefix_class_name)
|
|
76
85
|
ast_class = ast.ClassDef(
|
|
@@ -89,7 +98,7 @@ class EntityCompiler:
|
|
|
89
98
|
ast.keyword(
|
|
90
99
|
arg="pk_field",
|
|
91
100
|
value=ast.Constant(
|
|
92
|
-
value=CompilerStrUtil.to_snake_case(
|
|
101
|
+
value=CompilerStrUtil.to_snake_case(key_field)
|
|
93
102
|
),
|
|
94
103
|
),
|
|
95
104
|
ast.keyword(
|
|
@@ -665,9 +665,19 @@ class EDLPropertyCompiler:
|
|
|
665
665
|
)
|
|
666
666
|
)
|
|
667
667
|
else:
|
|
668
|
+
dto_property_name = f"relation_1_1_self_column_{relation_column}"
|
|
668
669
|
# Adicionando propriedade, para o campo de relação, no DTO (quando for o dono da relação)
|
|
669
670
|
ast_dto_attributes.append(
|
|
670
|
-
self._build_dto_property_ast(
|
|
671
|
+
self._build_dto_property_ast(
|
|
672
|
+
dto_property_name,
|
|
673
|
+
PrimitiveTypes.UUID,
|
|
674
|
+
keywords=[
|
|
675
|
+
ast.keyword(
|
|
676
|
+
arg="entity_field",
|
|
677
|
+
value=ast.Constant(value=relation_column),
|
|
678
|
+
),
|
|
679
|
+
],
|
|
680
|
+
)
|
|
671
681
|
)
|
|
672
682
|
|
|
673
683
|
# Adicionando propriedade, para o campo de relação, no Entity (quando for o dono da relação)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: nsj_rest_lib2
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.16
|
|
4
4
|
Summary: Biblioteca para permitir a distribuição de rotas dinâmicas numa API, configuradas por meio de EDLs declarativos (em formato JSON).
|
|
5
5
|
Home-page: https://github.com/Nasajon/nsj_rest_lib2
|
|
6
6
|
Author: Nasajon Sistemas
|
|
@@ -23,8 +23,11 @@ Requires-Dist: pyyaml<7.0.0,>=6.0.3
|
|
|
23
23
|
|
|
24
24
|
Biblioteca para permitir a distribuição de rotas dinâmicas numa API, configuradas por meio de EDLs declarativos (em formato JSON).
|
|
25
25
|
|
|
26
|
+
[ESPECIFICAÇÃO DO MODELO DE ENTIDADES](docs/especificacao.md)
|
|
27
|
+
|
|
26
28
|
## TODO
|
|
27
|
-
* Colocar tempo para recarregamento das entidades (para checar, no redis, se mudou o hash.)
|
|
28
29
|
* Unificar o arquivo redis_config.py
|
|
29
30
|
* Usar pydantic, ou similar, para transformar a configuração das entidades, no redis, num objeto
|
|
30
31
|
* Rever modo de usar o InjectFactory (talvez dando ciência, ao RestLib, do padrão multibanco)
|
|
32
|
+
* Implementar e documentar campos join
|
|
33
|
+
* Implementar e documentar conjuntos
|
|
@@ -24,7 +24,7 @@ setup.cfg
|
|
|
24
24
|
./nsj_rest_lib2/compiler/edl_model/column_meta_model.py
|
|
25
25
|
./nsj_rest_lib2/compiler/edl_model/entity_model.py
|
|
26
26
|
./nsj_rest_lib2/compiler/edl_model/entity_model_base.py
|
|
27
|
-
./nsj_rest_lib2/compiler/edl_model/
|
|
27
|
+
./nsj_rest_lib2/compiler/edl_model/entity_model_root.py
|
|
28
28
|
./nsj_rest_lib2/compiler/edl_model/index_model.py
|
|
29
29
|
./nsj_rest_lib2/compiler/edl_model/primitives.py
|
|
30
30
|
./nsj_rest_lib2/compiler/edl_model/property_meta_model.py
|
|
@@ -61,7 +61,7 @@ nsj_rest_lib2/compiler/edl_model/api_model.py
|
|
|
61
61
|
nsj_rest_lib2/compiler/edl_model/column_meta_model.py
|
|
62
62
|
nsj_rest_lib2/compiler/edl_model/entity_model.py
|
|
63
63
|
nsj_rest_lib2/compiler/edl_model/entity_model_base.py
|
|
64
|
-
nsj_rest_lib2/compiler/edl_model/
|
|
64
|
+
nsj_rest_lib2/compiler/edl_model/entity_model_root.py
|
|
65
65
|
nsj_rest_lib2/compiler/edl_model/index_model.py
|
|
66
66
|
nsj_rest_lib2/compiler/edl_model/primitives.py
|
|
67
67
|
nsj_rest_lib2/compiler/edl_model/property_meta_model.py
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[metadata]
|
|
2
2
|
name = nsj_rest_lib2
|
|
3
|
-
version = 0.0.
|
|
3
|
+
version = 0.0.16
|
|
4
4
|
author = Nasajon Sistemas
|
|
5
5
|
author_email = contact.dev@nasajon.com.br
|
|
6
6
|
description = Biblioteca para permitir a distribuição de rotas dinâmicas numa API, configuradas por meio de EDLs declarativos (em formato JSON).
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{nsj_rest_lib2-0.0.15 → nsj_rest_lib2-0.0.16}/nsj_rest_lib2/compiler/edl_model/ai_entity_edl.py
RENAMED
|
File without changes
|
|
File without changes
|
{nsj_rest_lib2-0.0.15 → nsj_rest_lib2-0.0.16}/nsj_rest_lib2/compiler/edl_model/column_meta_model.py
RENAMED
|
File without changes
|
{nsj_rest_lib2-0.0.15 → nsj_rest_lib2-0.0.16}/nsj_rest_lib2/compiler/edl_model/index_model.py
RENAMED
|
File without changes
|
{nsj_rest_lib2-0.0.15 → nsj_rest_lib2-0.0.16}/nsj_rest_lib2/compiler/edl_model/primitives.py
RENAMED
|
File without changes
|
{nsj_rest_lib2-0.0.15 → nsj_rest_lib2-0.0.16}/nsj_rest_lib2/compiler/edl_model/repository_model.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{nsj_rest_lib2-0.0.15 → nsj_rest_lib2-0.0.16}/nsj_rest_lib2/compiler/util/type_naming_util.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{nsj_rest_lib2-0.0.15 → nsj_rest_lib2-0.0.16}/nsj_rest_lib2/controller/dynamic_controller.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|