Closed devraj closed 2 months ago
From some basic research the above isn't incorrect unless it causes cyclic issues with validation.
Should we park this until this becomes an issue?
The card
for a cardholder
has the attribute from
which is a valid directive at most levels in python
eg:
{
"href": "https://localhost:8904/api/cardholders/325/cards/97b6a24ard6d4500a9",
"number": "1",
"cardSerialNumber": "045A5769713E80",
"issueLevel": 1,
"status": {
"value": "Disabled (manually)",
"type": "inactive"
},
"type": {
"href": "https://localhost:8904/api/card_types/354",
"name": "Card type no. 1"
},
"invitation": {
"email": "nick@example.com",
"mobile": "02123456789",
"singleFactorOnly": true,
"status": "sent",
"href": "https://security.gallagher.cloud/api/invitations/abcd1234defg5678"
},
"from": "2017-01-01T00:00:00Z",
"until": "2017-12-31T11:59:59Z",
"credentialClass": "mobile",
"trace": false,
"lastPrintedOrEncodedTime": "2020-08-10T09:20:50Z",
"lastPrintedOrEncodedIssueLevel": 1,
"pin": "153624",
"visitorContractor": false,
"ownedBySite": false,
"credentialId": "reserved",
"bleFacilityId": "reserved"
}
in light of this we should investigate this further and come up with a solution to not use reserved words at all. Example of using from
as a method name not being valid either.
See also #1 for discovery on extras
support via pydantic
Describe the bug While this works, it's not best practice to use reserved words as attribute names in classes. Consider this class:
type
is a reserved word in python and is used as an attribute in the class. IDEs will prompt that this is the wrong thing to:Pyndatic has support for
TypeDict
anddataclasses
for defining classes, we should look into what is the best way to implement this without losing the developer focus and pythonic nature of the API class.To Reproduce NA
Expected behavior Implement a proper way