dpgaspar commented on a change in pull request #10335:
URL:
https://github.com/apache/incubator-superset/pull/10335#discussion_r456599279
##########
File path: superset/databases/api.py
##########
@@ -265,3 +275,87 @@ def select_star(
return self.response(404, message="Table not found on the
database")
self.incr_stats("success", self.select_star.__name__)
return self.response(200, result=result)
+
+ @expose("/schemas/", methods=["GET"])
+ @protect()
+ @safe
+ @statsd_metrics
+ @rison(get_schemas_schema)
+ def schemas(self, **kwargs: Any) -> FlaskResponse:
+ """Get all schemas
+ ---
+ get:
+ parameters:
+ - in: query
+ name: q
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ page_size:
+ type: integer
+ page:
+ type: integer
+ filter:
+ type: string
+ responses:
+ 200:
+ description: Related column data
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ count:
+ type: integer
+ result:
+ type: object
+ properties:
+ value:
+ type: string
+ text:
+ type: string
Review comment:
Here also, declare a marshmallow schema for the response and reference
that. Register your schema on OpenAPI using `openapi_spec_component_schemas`
FAB attr
##########
File path: superset/databases/api.py
##########
@@ -265,3 +275,87 @@ def select_star(
return self.response(404, message="Table not found on the
database")
self.incr_stats("success", self.select_star.__name__)
return self.response(200, result=result)
+
+ @expose("/schemas/", methods=["GET"])
+ @protect()
+ @safe
+ @statsd_metrics
+ @rison(get_schemas_schema)
+ def schemas(self, **kwargs: Any) -> FlaskResponse:
+ """Get all schemas
+ ---
+ get:
+ parameters:
+ - in: query
+ name: q
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ page_size:
+ type: integer
+ page:
+ type: integer
+ filter:
+ type: string
Review comment:
It's nicer to use a reference here to the schema, so we don't have to
repeat ourselfs. Take a look at:
https://github.com/apache/incubator-superset/blob/master/superset/charts/api.py#L502
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]