Skip to content

Commit

Permalink
fix: openapi bug (#6525)
Browse files Browse the repository at this point in the history
  • Loading branch information
montezdesousa authored Jun 20, 2024
1 parent 2392a8a commit 0202079
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/general-linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
if: github.event_name == 'pull_request'
run: |
# "Checking PR diff"
echo "diff_files=$(git diff --diff-filter=d --name-only origin/${{ github.base_ref }}...${{ github.head_ref }} | grep 'openbb_platform/.*\.py$|cli/.*\.py$' | grep -v 'openbb_platform/openbb/package' | grep -v 'integration' | grep -v 'tests' | xargs)" >> $GITHUB_ENV
echo "diff_files=$(git diff --diff-filter=d --name-only origin/${{ github.base_ref }}...${{ github.head_ref }} | grep -E '^(openbb_platform|cli)/.*\.py$' | grep -v 'openbb_platform/openbb/package' | grep -v 'integration' | grep -v 'tests' | xargs)" >> $GITHUB_ENV
echo $diff_files
- uses: actions/cache@v3
Expand Down
8 changes: 8 additions & 0 deletions openbb_platform/core/tests/api/test_rest_api.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
"""Test rest_api.py."""

from openbb_core.api.rest_api import app


def test_openapi():
"""Test openapi schema generation."""
assert app.openapi()
2 changes: 1 addition & 1 deletion openbb_platform/extensions/derivatives/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "openbb-derivatives"
version = "1.2.3"
version = "1.2.4"
description = "Derivatives extension for OpenBB"
authors = ["OpenBB Team <hello@openbb.co>"]
license = "AGPL-3.0-only"
Expand Down
8 changes: 4 additions & 4 deletions openbb_platform/openbb/assets/reference.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"openbb": "4.2.2",
"openbb": "4.2.3",
"info": {
"title": "OpenBB Platform (Python)",
"description": "Investment research for everyone, anywhere.",
Expand All @@ -9,7 +9,7 @@
"commodity@1.1.3",
"crypto@1.2.3",
"currency@1.2.3",
"derivatives@1.2.3",
"derivatives@1.2.4",
"economy@1.2.3",
"equity@1.2.3",
"etf@1.2.3",
Expand All @@ -24,7 +24,7 @@
"federal_reserve@1.2.3",
"fmp@1.2.3",
"fred@1.2.3",
"intrinio@1.2.3",
"intrinio@1.2.4",
"oecd@1.2.3",
"polygon@1.2.3",
"sec@1.2.3",
Expand Down Expand Up @@ -1216,7 +1216,7 @@
},
{
"name": "option_type",
"type": "Literal[None, Union[ForwardRef('call'), ForwardRef('put')]]",
"type": "Literal['call', 'put']",
"description": "The option type, call or put, 'None' is both (default).",
"default": null,
"optional": true,
Expand Down
4 changes: 2 additions & 2 deletions openbb_platform/openbb/package/__extensions__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class Extensions(Container):
- commodity@1.1.3
- crypto@1.2.3
- currency@1.2.3
- derivatives@1.2.3
- derivatives@1.2.4
- economy@1.2.3
- equity@1.2.3
- etf@1.2.3
Expand All @@ -37,7 +37,7 @@ class Extensions(Container):
- federal_reserve@1.2.3
- fmp@1.2.3
- fred@1.2.3
- intrinio@1.2.3
- intrinio@1.2.4
- oecd@1.2.3
- polygon@1.2.3
- sec@1.2.3
Expand Down
2 changes: 1 addition & 1 deletion openbb_platform/openbb/package/derivatives_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def chains(
The provider to use, by default None. If None, the priority list configured in the settings is used. Default priority: intrinio, yfinance.
date : Optional[datetime.date]
The end-of-day date for options chains data. (provider: intrinio)
option_type : Literal[None, Union[ForwardRef('call'), ForwardRef('put')]]
option_type : Optional[Literal['call', 'put']]
The option type, call or put, 'None' is both (default). (provider: intrinio)
moneyness : Literal['otm', 'itm', 'all']
Return only contracts that are in or out of the money, default is 'all'. Parameter is ignored when a date is supplied. (provider: intrinio)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class IntrinioForwardEpsEstimatesQueryParams(ForwardEpsEstimatesQueryParams):
description="The future fiscal year to retrieve estimates for."
+ " When no symbol and year is supplied the current calendar year is used.",
)
fiscal_period: Union[Literal["fy", "q1", "q2", "q3", "q4"], None] = Field(
fiscal_period: Optional[Literal["fy", "q1", "q2", "q3", "q4"]] = Field(
default=None,
description="The future fiscal period to retrieve estimates for.",
)
Expand All @@ -44,7 +44,7 @@ class IntrinioForwardEpsEstimatesQueryParams(ForwardEpsEstimatesQueryParams):
description="The future calendar year to retrieve estimates for."
+ " When no symbol and year is supplied the current calendar year is used.",
)
calendar_period: Union[Literal["q1", "q2", "q3", "q4"], None] = Field(
calendar_period: Optional[Literal["q1", "q2", "q3", "q4"]] = Field(
default=None,
description="The future calendar period to retrieve estimates for.",
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class IntrinioForwardSalesEstimatesQueryParams(ForwardSalesEstimatesQueryParams)
description="The future fiscal year to retrieve estimates for."
+ " When no symbol and year is supplied the current calendar year is used.",
)
fiscal_period: Union[Literal["fy", "q1", "q2", "q3", "q4"], None] = Field(
fiscal_period: Optional[Literal["fy", "q1", "q2", "q3", "q4"]] = Field(
default=None,
description="The future fiscal period to retrieve estimates for.",
)
Expand All @@ -44,7 +44,7 @@ class IntrinioForwardSalesEstimatesQueryParams(ForwardSalesEstimatesQueryParams)
description="The future calendar year to retrieve estimates for."
+ " When no symbol and year is supplied the current calendar year is used.",
)
calendar_period: Union[Literal["q1", "q2", "q3", "q4"], None] = Field(
calendar_period: Optional[Literal["q1", "q2", "q3", "q4"]] = Field(
default=None,
description="The future calendar period to retrieve estimates for.",
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
datetime,
timedelta,
)
from typing import Any, Dict, List, Literal, Optional, Union
from typing import Any, Dict, List, Literal, Optional
from warnings import warn

from dateutil import parser
Expand Down Expand Up @@ -47,7 +47,7 @@ class IntrinioOptionsChainsQueryParams(OptionsChainsQueryParams):
date: Optional[dateType] = Field(
default=None, description="The end-of-day date for options chains data."
)
option_type: Literal[None, Union["call", "put"]] = Field(
option_type: Optional[Literal["call", "put"]] = Field(
default=None,
description="The option type, call or put, 'None' is both (default).",
json_schema_extra={"choices": ["call", "put"]},
Expand Down Expand Up @@ -233,7 +233,7 @@ async def callback(response: ClientResponse, _: Any) -> list:
# If the EOD chains are not available for the given date, try the previous day
if not results and query.date is not None:
date = get_weekday(date - timedelta(days=1)).strftime("%Y-%m-%d")
urls = await get_urls(date)
urls = await get_urls(date.strftime("%Y-%m-%d"))
results = await amake_requests(urls, response_callback=callback, **kwargs)

if not results:
Expand Down
2 changes: 1 addition & 1 deletion openbb_platform/providers/intrinio/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "openbb-intrinio"
version = "1.2.3"
version = "1.2.4"
description = "Intrinio extension for OpenBB"
authors = ["OpenBB Team <hello@openbb.co>"]
license = "AGPL-3.0-only"
Expand Down

0 comments on commit 0202079

Please sign in to comment.