When building FastAPI client I use provided types for typehints and OpenAPI schema, this however has some amount of weirdness:
- Many model docstrings has
_symbol escaped, this results in numerous warnings happening when importing a related module:
/usr/local/lib/python3.12/site-packages/square/requests/invoice.py:143: SyntaxWarning: invalid escape sequence '\_'
For example, a payment `due_date` of 2021-03-09 with a `timezone` of America/Los\_Angeles
/usr/local/lib/python3.12/site-packages/square/requests/invoice_payment_request.py:54: SyntaxWarning: invalid escape sequence '\_'
of America/Los\_Angeles becomes overdue at midnight on March 9 in America/Los\_Angeles (which equals a UTC
/usr/local/lib/python3.12/site-packages/square/types/invoice.py:144: SyntaxWarning: invalid escape sequence '\_'
For example, a payment `due_date` of 2021-03-09 with a `timezone` of America/Los\_Angeles
/usr/local/lib/python3.12/site-packages/square/types/invoice_payment_request.py:55: SyntaxWarning: invalid escape sequence '\_'
of America/Los\_Angeles becomes overdue at midnight on March 9 in America/Los\_Angeles (which equals a UTC
/usr/local/lib/python3.12/site-packages/square/requests/external_payment_details.py:21: SyntaxWarning: invalid escape sequence '\_'
- OTHER\_GIFT\_CARD - Paid using a non-Square gift card.
/usr/local/lib/python3.12/site-packages/square/types/external_payment_details.py:22: SyntaxWarning: invalid escape sequence '\_'
- OTHER\_GIFT\_CARD - Paid using a non-Square gift card.
/usr/local/lib/python3.12/site-packages/square/requests/destination_details_external_refund_details.py:19: SyntaxWarning: invalid escape sequence '
- Confusingly, all models have typing.Optional[some type here] = pydantic.Field(default=None) set on all fields. And the model itself subclasses custom
UncheckedBaseModel.
Not sure what exactly is patched, but this completely breaks OpenAPI schema generator, which in turn resolves all type definition to Any:
Money {}
Payment {}
PaymentRefund {}
Is it possible to update Fern configuration so that information is generated with proper typehints?