-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BugFix] Add json_schema_extra
With Choices To Provider 'period' Field
#6451
Conversation
A lot of changes. Please merge only after release 4.2.1 |
filing_date: Optional[date] = Field( | ||
period: Literal["annual", "quarter", "ttm"] = Field( | ||
default="annual", | ||
json_schema_extra={"choices": ["annual", "quarter", "ttm"]}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For future reference:
For the CLI to leverage custom choices, one only need to populate the json_schema_extra
with them if it's not possible to use such options inside the Literal
- cases where we want to leverage comma separated lists and as such the type need to be str
instead of Literal
.
Here, we're just duplicating the same info.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From what I've experienced, the act of defining almost any Literal is an exercise in duplication, and this appears to be a limitation of Python 3.9, because you cannot dynamically define a Literal.
Why?:
choices
for the schema.What?:
json_schema_extra
for each provider'speriod
field in balance/cash/income endpoints.json_schema_extra={"x-unit_measurement"}
wherever was missing.Impact:
openapi.json
orreference.json
Testing Done: