-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #37 from ESSS/fb-RFDAP-5724-refactor-rockSampleTyp…
…e-and-bodyShape RFDAP-5724 - Add EnumKeySerializer
- Loading branch information
Showing
20 changed files
with
115 additions
and
35 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,7 @@ | ||
from .enum_field import EnumKeyField | ||
from .field import Field | ||
from .nested_fields import ( | ||
NestedModelField, | ||
NestedAttributesField, | ||
PrimaryKeyField, | ||
NestedModelListField, | ||
) | ||
from .model_serializer import ModelSerializer | ||
from .nested_fields import ( | ||
NestedAttributesField, NestedModelField, NestedModelListField, PrimaryKeyField) | ||
from .polymorphic_serializer import PolymorphicModelSerializer | ||
from .serializer import ColumnSerializer, Serializer |
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 |
---|---|---|
|
@@ -12,5 +12,6 @@ email: null | |
firstname: Sarah | ||
id: 2 | ||
lastname: Kerrigan | ||
marital_status: Divorced | ||
password: null | ||
role: Employee |
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 |
---|---|---|
|
@@ -15,4 +15,5 @@ email: null | |
firstname: Jim | ||
id: 1 | ||
lastname: Raynor | ||
marital_status: Married | ||
role: Manager |
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 |
---|---|---|
|
@@ -20,4 +20,5 @@ email: null | |
firstname: Jim | ||
id: 1 | ||
lastname: Raynor | ||
marital_status: Married | ||
role: Manager |
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 |
---|---|---|
|
@@ -15,4 +15,5 @@ email: null | |
firstname: John | ||
id: null | ||
lastname: Doe | ||
marital_status: Married | ||
role: Employee |
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
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 |
---|---|---|
|
@@ -7,5 +7,6 @@ email: null | |
firstname: Tychus | ||
id: 3 | ||
lastname: Findlay | ||
marital_status: Single | ||
password: null | ||
role: Employee |
20 changes: 20 additions & 0 deletions
20
src/serialchemy/_tests/test_serialization/test_enum_key_field_dump.yml
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
address: | ||
city: Tarsonis | ||
id: 1 | ||
number: '943' | ||
state: null | ||
street: 5 Av | ||
zip: null | ||
address_id: 1 | ||
admission: '2000-01-01' | ||
company_id: 5 | ||
company_name: Terrans | ||
contacts: [] | ||
contract_type: null | ||
created_at: '2000-01-02T00:00:00' | ||
email: null | ||
firstname: Jim | ||
id: 1 | ||
lastname: Raynor | ||
marital_status: MARRIED | ||
role: Manager |
12 changes: 12 additions & 0 deletions
12
src/serialchemy/_tests/test_serialization/test_enum_key_field_load.yml
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
address_id: null | ||
admission: '2152-01-02' | ||
company_id: null | ||
contract_type: null | ||
created_at: null | ||
email: sarahk@blitz.com | ||
firstname: Sarah | ||
id: null | ||
lastname: Kerrigan | ||
marital_status: Married | ||
password: null | ||
role: Employee |
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 |
---|---|---|
|
@@ -7,5 +7,6 @@ email: null | |
firstname: Jim | ||
id: 1 | ||
lastname: Raynor | ||
marital_status: Married | ||
password: null | ||
role: Manager |
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 |
---|---|---|
|
@@ -10,4 +10,5 @@ email: null | |
firstname: Sarah | ||
id: 2 | ||
lastname: Kerrigan | ||
marital_status: Married | ||
role: Engineer |
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from serialchemy.enum_serializer import EnumKeySerializer | ||
from serialchemy.field import Field | ||
|
||
|
||
class EnumKeyField(Field): | ||
def __init__(self, enum_class, dump_only=False, load_only=False, creation_only=False): | ||
super().__init__(dump_only=dump_only, load_only=load_only, creation_only=creation_only, serializer=EnumKeySerializer(enum_class)) |
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