Skip to content
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

chore: use new FAB functionality for component schemas update OAS #17967

Merged
merged 7 commits into from
Jan 11, 2022

Conversation

dpgaspar
Copy link
Member

@dpgaspar dpgaspar commented Jan 7, 2022

SUMMARY

FAB 3.4.3 now implements openapi_spec_component_schemas ;) this PR removes that functionality from Superset.

Also the new version properly uses OpenAPI spec servers with actual servers and we can now define a list of servers for docs, by default the included swagger UI will set the current request host URL.

Since the spec is not using a base path (api/v1) anymore and FAB is not relying on the resource_name to infer the spec path but the route_base (this used to be a limitation). All endpoints are declared with their full relative path:

This PR also fixes the OpenAPI spec auto generation for Superset docs, so that all the schema components are not declared with MetaN anymore.

So these have are not duplicated anymore:

Screenshot 2022-01-07 at 16 12 40

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Before:
Screenshot 2022-01-07 at 16 11 03

After:
Screenshot 2022-01-07 at 16 09 13

TESTING INSTRUCTIONS

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

@codecov
Copy link

codecov bot commented Jan 7, 2022

Codecov Report

Merging #17967 (2f94058) into master (d35da1f) will decrease coverage by 0.03%.
The diff coverage is 100.00%.

❗ Current head 2f94058 differs from pull request most recent head b44acd7. Consider uploading reports for the commit b44acd7 to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master   #17967      +/-   ##
==========================================
- Coverage   67.10%   67.07%   -0.04%     
==========================================
  Files        1612     1609       -3     
  Lines       64992    64892     -100     
  Branches     6871     6868       -3     
==========================================
- Hits        43615    43524      -91     
+ Misses      19510    19502       -8     
+ Partials     1867     1866       -1     
Flag Coverage Δ
hive 53.29% <100.00%> (-0.03%) ⬇️
mysql 82.18% <100.00%> (-0.03%) ⬇️
postgres 82.23% <100.00%> (-0.03%) ⬇️
presto 53.13% <100.00%> (-0.03%) ⬇️
python 82.68% <100.00%> (-0.03%) ⬇️
sqlite 81.92% <100.00%> (-0.04%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
superset/dashboards/filter_state/api.py 100.00% <ø> (ø)
superset/cli.py 54.92% <100.00%> (+0.10%) ⬆️
superset/views/base_api.py 98.22% <100.00%> (-0.10%) ⬇️
...board/components/nativeFilters/FilterBar/index.tsx 82.83% <0.00%> (-0.13%) ⬇️
superset-frontend/src/components/Select/Select.tsx 86.33% <0.00%> (-0.10%) ⬇️
superset/db_engine_specs/base.py 88.67% <0.00%> (-0.07%) ⬇️
superset/css_templates/api.py 95.74% <0.00%> (ø)
.../plugins/legacy-preset-chart-nvd3/src/Bar/index.js 66.66% <0.00%> (ø)
...plugins/legacy-preset-chart-nvd3/src/ReactNVD3.jsx 0.00% <0.00%> (ø)
... and 5 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d35da1f...b44acd7. Read the comment docs.

Copy link
Member

@villebro villebro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I much prefer this new UI! Also, great to see this logic being moved upstream! 🙂 LGTM

Comment on lines +223 to +225
self.openapi_spec_component_schemas: Tuple[
Type[Schema], ...
] = self.openapi_spec_component_schemas + (
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really need this type declaration? Seems like this should be enough:

Suggested change
self.openapi_spec_component_schemas: Tuple[
Type[Schema], ...
] = self.openapi_spec_component_schemas + (
self.openapi_spec_component_schemas = self.openapi_spec_component_schemas + (

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it does, and it surprised me also, this is declared on FAB here: https://github.com/dpgaspar/Flask-AppBuilder/blob/master/flask_appbuilder/api/__init__.py#L297

@dpgaspar dpgaspar merged commit 44df04f into apache:master Jan 11, 2022
@dpgaspar dpgaspar deleted the chore/leverage-fab-3-4-3 branch January 11, 2022 09:30
shcoderAlex pushed a commit to casual-precision/superset that referenced this pull request Feb 7, 2022
…ache#17967)

* chore: use new FAB functionality for component schemas and update OpenAPI spec

* remove unused import

* fix spec and lint

* EOF fix

* update open api spec with latest master
bwang221 pushed a commit to casual-precision/superset that referenced this pull request Feb 10, 2022
…ache#17967)

* chore: use new FAB functionality for component schemas and update OpenAPI spec

* remove unused import

* fix spec and lint

* EOF fix

* update open api spec with latest master
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 1.5.0 labels Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels preset-io size/XXL 🚢 1.5.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants