Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit f251426

Browse filesBrowse files
committed
Update python
1 parent 984b197 commit f251426
Copy full SHA for f251426

File tree

Expand file treeCollapse file tree

1 file changed

+25
-5
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+25
-5
lines changed

‎python.json

Copy file name to clipboardExpand all lines: python.json
+25-5Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,14 @@
77
"import ormar",
88
"import ormar.exceptions",
99
"from fastapi import HTTPException",
10-
"",
1110
"from freenit.api.router import route",
1211
"",
1312
"from ..models.${1} import ${1/(.*)/${1:/capitalize}/}, ${1/(.*)/${1:/capitalize}/}Optional",
1413
"",
14+
"tags=['${1}']",
15+
"",
1516
"",
16-
"@route('/${1}s', tags=['${1}'])",
17+
"@route('/${1}s', tags=tags)",
1718
"class ${1/(.*)/${1:/capitalize}/}ListAPI():",
1819
" @staticmethod",
1920
" async def get() -> List[${1/(.*)/${1:/capitalize}/}]:",
@@ -25,7 +26,7 @@
2526
" return ${1}",
2627
"",
2728
"",
28-
"@route('/${1}s/{id}', tags=['${1}'])",
29+
"@route('/${1}s/{id}', tags=tags)",
2930
"class ${1/(.*)/${1:/capitalize}/}DetailAPI():",
3031
" @staticmethod",
3132
" async def get(id: int) -> ${1/(.*)/${1:/capitalize}/}:",
@@ -60,8 +61,11 @@
6061
"prefix": "freenitormar",
6162
"body": [
6263
"import ormar",
63-
"",
64-
"from freenit.models.ormar.base import OrmarBaseModel, generate_optional, ormar_config",
64+
"from freenit.models.ormar.base import (",
65+
" OrmarBaseModel,",
66+
" generate_optional,",
67+
" ormar_config,",
68+
")",
6569
"",
6670
"",
6771
"class ${1}(OrmarBaseModel):",
@@ -73,5 +77,21 @@
7377
"${1}Optional = generate_optional(${1})"
7478
],
7579
"description": "Freenit model using Ormar"
80+
},
81+
82+
"pydantic": {
83+
"prefix": "freenitpydantic",
84+
"body": [
85+
"from pydantic import BaseModel, Field",
86+
"from freenit.models.ormar.base import generate_optional",
87+
"",
88+
"",
89+
"class ${1}(BaseModel):",
90+
" ${2:field_name}: str = Field(\"\", description=(\"${3:Field description}\"))",
91+
"",
92+
"",
93+
"${1}Optional = generate_optional(${1})"
94+
],
95+
"description": "Freenit model using Pydantic"
7696
}
7797
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.