-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
7 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,15 @@ | ||
""" Base Model (Pydantic) Over-Ride """ | ||
|
||
from typing import List | ||
|
||
# pylint: disable=no-name-in-module | ||
from pydantic import BaseModel as PydanticBaseModel | ||
|
||
|
||
def lower_camel_case(string: str) -> str: | ||
""" | ||
Alias Generator Definition | ||
Used for externally based consumption | ||
. | ||
Parameters | ||
---------- | ||
string: str | ||
The input string to change casing of. | ||
Returns | ||
------- | ||
new_string: str | ||
A new string which has been camel cased. | ||
""" | ||
|
||
string_list: List[str] = string.split("_") | ||
prefix: str = string_list[0] | ||
suffix: str = "".join(word.capitalize() for word in string_list[1:]) | ||
return prefix + suffix | ||
|
||
|
||
class BaseModel(PydanticBaseModel): | ||
"""BaseModel [Pydantic] Over-Ride""" | ||
|
||
# Pydantic Config Over-Ride | ||
# https://pydantic-docs.helpmanual.io/usage/model_config/#options | ||
class Config: | ||
alias_generator = lower_camel_case | ||
populate_by_name = True | ||
"""Pydantic Config Over-Ride""" | ||
|
||
arbitrary_types_allowed = True | ||
use_enum_values = True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters