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

🎨 web-api: Simpler error models and auto-generated errors in OAS #6855

Merged
merged 13 commits into from
Nov 28, 2024

Conversation

pcrespov
Copy link
Member

@pcrespov pcrespov commented Nov 27, 2024

What do these changes do?

This PR implements various enhancements on error models

  • 🎨 Auto document error responses in openapi specs using error handling maps (_TO_HTTP_ERROR_MAP) : ReDoc
    from simcore_service_webserver.folders._exceptions_handlers import _TO_HTTP_ERROR_MAP
    
    router = APIRouter(
        prefix=f"/{API_VTAG}",
        tags=[
            "folders",
        ],
        responses={
            i.status_code: {"model": EnvelopedError} for i in _TO_HTTP_ERROR_MAP.values() # <---
        },
    )
    • Here we apply it in for folders and worskspace resources
    • A preview of the reDoc
      image
  • 🎨 Simplified model for errors .
    • New models_library.rest_error
    • Old fields have been marked as deprecated (i.e. still usable) and will be retired when the front-end adapts to the new model
    • Example
    {
      "data": null,
      "error": {
        "msg": "OOps this error was unexpected. we are working on that!",
        "supportId": "OEC:12346789",
      }
    }
  • 🎨 update logging default formatting to include log_oec capture.

Related issue/s

How to test

Dev-ops checklist

@pcrespov pcrespov self-assigned this Nov 27, 2024
Copy link

codecov bot commented Nov 27, 2024

Codecov Report

Attention: Patch coverage is 91.93548% with 5 lines in your changes missing coverage. Please review.

Project coverage is 88.37%. Comparing base (573b7c3) to head (1f1770a).
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6855      +/-   ##
==========================================
- Coverage   88.39%   88.37%   -0.02%     
==========================================
  Files        1550     1550              
  Lines       61764    61777      +13     
  Branches     2112     2165      +53     
==========================================
+ Hits        54597    54598       +1     
- Misses       6837     6848      +11     
- Partials      330      331       +1     
Flag Coverage Δ
integrationtests 64.76% <100.00%> (-0.01%) ⬇️
unittests 86.30% <91.93%> (-0.02%) ⬇️
Components Coverage Δ
api 78.42% <ø> (ø)
pkg_aws_library 93.28% <ø> (ø)
pkg_dask_task_models_library 96.57% <ø> (ø)
pkg_models_library 91.22% <97.43%> (+0.05%) ⬆️
pkg_notifications_library 84.57% <ø> (ø)
pkg_postgres_database 87.52% <ø> (ø)
pkg_service_integration 70.00% <ø> (ø)
pkg_service_library 75.91% <81.81%> (-0.21%) ⬇️
pkg_settings_library 90.62% <ø> (ø)
pkg_simcore_sdk 85.36% <ø> (ø)
agent 97.00% <ø> (ø)
api_server 89.72% <ø> (ø)
autoscaling 95.21% <ø> (ø)
catalog 90.57% <ø> (ø)
clusters_keeper 98.73% <ø> (ø)
dask_sidecar 91.26% <ø> (ø)
datcore_adapter 93.17% <ø> (ø)
director 76.49% <ø> (ø)
director_v2 91.04% <ø> (-0.10%) ⬇️
dynamic_scheduler 96.59% <ø> (ø)
dynamic_sidecar 89.75% <ø> (ø)
efs_guardian 90.12% <ø> (ø)
invitations 93.44% <ø> (ø)
osparc_gateway_server 85.49% <ø> (ø)
payments 92.76% <ø> (ø)
resource_usage_tracker 90.64% <ø> (ø)
storage 89.66% <ø> (ø)
webclient ∅ <ø> (∅)
webserver 88.68% <100.00%> (ø)

Continue to review full report in Codecov by Sentry.

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

@pcrespov pcrespov added a:api framework api, data schemas, a:models-library labels Nov 27, 2024
@pcrespov pcrespov added this to the Event Horizon milestone Nov 27, 2024
@pcrespov pcrespov marked this pull request as ready for review November 27, 2024 19:16
@pcrespov pcrespov requested a review from odeimaiz November 27, 2024 19:31
@pcrespov pcrespov enabled auto-merge (squash) November 27, 2024 19:32
Copy link
Member

@odeimaiz odeimaiz left a comment

Choose a reason for hiding this comment

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

👌

@pcrespov pcrespov disabled auto-merge November 28, 2024 12:18
@pcrespov pcrespov requested a review from GitHK November 28, 2024 12:22
@pcrespov pcrespov merged commit 57b7c60 into ITISFoundation:master Nov 28, 2024
88 of 90 checks passed
@pcrespov pcrespov deleted the mai/error-models branch November 28, 2024 15:05
@pcrespov pcrespov restored the mai/error-models branch November 28, 2024 15:05
@pcrespov pcrespov deleted the mai/error-models branch November 28, 2024 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:api framework api, data schemas, a:models-library
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants