the-scouts / compass-interface

Providing a unified (well-documented) API to the Scouts' national membership system, Compass.
MIT License
10 stars 3 forks source link

Full models for optional data #41

Open AA-Turner opened 3 years ago

AA-Turner commented 3 years ago

In ci.schemas.member.MemberDetails, disabilities, hobbies, and qualifications are currently implemented as a simple dict str -> str. The fields are implemented in Compass in such a way that only one entry of each subtype (e.g. A Levels, Degree (eg BA, BSC), Doctorate) is allowd, enabling using a dict in Python.

This would also feasibly enable using a full pydantic model, but I somewhat question the usecase -- it would be ~60 lines for the three models, increasing the size of schemas.members by 12%. Willing to consider it if someone has a use, but for now will leave this issue open as a marker.

AA-Turner commented 3 years ago

Code:

https://github.com/the-scouts/compass-interface-core/blob/49a15dd08d009de648d7c24c8c9474d612097da4/compass/core/schemas/member.py#L279-L282