fix: openapi bug (#6525)

This commit is contained in:
montezdesousa
2024-06-20 12:03:49 +01:00
committed by GitHub
parent 2392a8a9e2
commit 0202079f2a
10 changed files with 25 additions and 17 deletions

View File

@@ -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

View File

@@ -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()

View File

@@ -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"

View File

@@ -1,5 +1,5 @@
{
"openbb": "4.2.2",
"openbb": "4.2.3",
"info": {
"title": "OpenBB Platform (Python)",
"description": "Investment research for everyone, anywhere.",
@@ -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",
@@ -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",
@@ -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,

View File

@@ -23,7 +23,7 @@ Extensions:
- 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
@@ -37,7 +37,7 @@ Extensions:
- 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

View File

@@ -43,7 +43,7 @@ class ROUTER_derivatives_options(Container):
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)

View File

@@ -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.",
)
@@ -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.",
)

View File

@@ -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.",
)
@@ -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.",
)

View File

@@ -6,7 +6,7 @@ from datetime import (
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
@@ -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"]},
@@ -233,7 +233,7 @@ class IntrinioOptionsChainsFetcher(
# 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:

View File

@@ -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"