mirror of
https://github.com/apache/superset.git
synced 2026-04-20 08:34:37 +00:00
chore: Add OpenAPI docs to /api/v1/chart/data EP (#9556)
* Add OpenAPI docs to /api/v1/chart/data EP * Add missing fields to QueryObject, fix linting and unit test errors * Fix unit test errors * abc * Fix errors uncovered by schema validation and add unit test for invalid payload * Add schema for response * Remove unnecessary pylint disable
This commit is contained in:
@@ -47,9 +47,9 @@ class QueryObject:
|
||||
is_timeseries: bool
|
||||
time_shift: Optional[timedelta]
|
||||
groupby: List[str]
|
||||
metrics: List[Union[Dict, str]]
|
||||
metrics: List[Union[Dict[str, Any], str]]
|
||||
row_limit: int
|
||||
filter: List[str]
|
||||
filter: List[Dict[str, Any]]
|
||||
timeseries_limit: int
|
||||
timeseries_limit_metric: Optional[Dict]
|
||||
order_desc: bool
|
||||
@@ -61,9 +61,9 @@ class QueryObject:
|
||||
def __init__(
|
||||
self,
|
||||
granularity: str,
|
||||
metrics: List[Union[Dict, str]],
|
||||
metrics: List[Union[Dict[str, Any], str]],
|
||||
groupby: Optional[List[str]] = None,
|
||||
filters: Optional[List[str]] = None,
|
||||
filters: Optional[List[Dict[str, Any]]] = None,
|
||||
time_range: Optional[str] = None,
|
||||
time_shift: Optional[str] = None,
|
||||
is_timeseries: bool = False,
|
||||
@@ -75,14 +75,17 @@ class QueryObject:
|
||||
columns: Optional[List[str]] = None,
|
||||
orderby: Optional[List[List]] = None,
|
||||
post_processing: Optional[List[Dict[str, Any]]] = None,
|
||||
relative_start: str = app.config["DEFAULT_RELATIVE_START_TIME"],
|
||||
relative_end: str = app.config["DEFAULT_RELATIVE_END_TIME"],
|
||||
):
|
||||
extras = extras or {}
|
||||
is_sip_38 = is_feature_enabled("SIP_38_VIZ_REARCHITECTURE")
|
||||
self.granularity = granularity
|
||||
self.from_dttm, self.to_dttm = utils.get_since_until(
|
||||
relative_start=relative_start,
|
||||
relative_end=relative_end,
|
||||
relative_start=extras.get(
|
||||
"relative_start", app.config["DEFAULT_RELATIVE_START_TIME"]
|
||||
),
|
||||
relative_end=extras.get(
|
||||
"relative_end", app.config["DEFAULT_RELATIVE_END_TIME"]
|
||||
),
|
||||
time_range=time_range,
|
||||
time_shift=time_shift,
|
||||
)
|
||||
@@ -106,7 +109,7 @@ class QueryObject:
|
||||
self.timeseries_limit = timeseries_limit
|
||||
self.timeseries_limit_metric = timeseries_limit_metric
|
||||
self.order_desc = order_desc
|
||||
self.extras = extras or {}
|
||||
self.extras = extras
|
||||
|
||||
if app.config["SIP_15_ENABLED"] and "time_range_endpoints" not in self.extras:
|
||||
self.extras["time_range_endpoints"] = get_time_range_endpoints(form_data={})
|
||||
|
||||
Reference in New Issue
Block a user