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

fix(api): various small fixes for schema generation #14088

Merged
merged 7 commits into from
Mar 3, 2025

Conversation

walpox
Copy link
Contributor

@walpox walpox commented Mar 3, 2025

Changelog

The format is based on Keep a Changelog.

Fixed

  • [GroupViewSet]: Unable to derive type of path parameter "language_code" because model "weblate.auth.models.Group" contained no such field.
  • [ComponentViewSet]: Unable to derive type of path parameter "project_slug" because model "weblate.trans.models.component.Component" contained no such field.
  • [ComponentListViewSet]: Unable to derive type of path parameter "component_slug" because model "weblate.trans.models.componentlist.ComponentList" contained no such field.
  • Annotated non-existent method on TasksViewSet.
  • [TasksViewSet]: Unable to guess serializer.
  • [Search]: Unable to guess serializer.

The purpose of this PR is to fix most the remaining error and warning log messages which are issued when a user sends a GET request to /api/docs/.

Relates to #12584.

walpox added 6 commits March 1, 2025 12:03
Fix the following issue:
'gunicorn stderr | /app/src/weblate/api/views.py: Warning [GroupViewSet]:
could not derive type of path parameter "language_code" because model "weblate.auth.models.Group"
contained no such field. Consider annotating parameter with @extend_schema. Defaulting to "string".'
Fix the following issue:
'gunicorn stderr | /app/src/weblate/api/views.py: Warning [ComponentViewSet]: could not derive type
of path parameter "project_slug" because model "weblate.trans.models.component.Component" contained
no such field. Consider annotating parameter with @extend_schema. Defaulting to "string".'
Fix the following issue:
'gunicorn stderr | /app/src/weblate/api/views.py: Warning [ComponentListViewSet]: could not derive
type of path parameter "component_slug" because model "weblate.trans.models.componentlist.ComponentList"
contained no such field. Consider annotating parameter with @extend_schema. Defaulting to "string".'
Fix the following issue:
'gunicorn stderr | Warning: @extend_schema_view argument "list" was not found on view TasksViewSet.
method override for "list" will be ignored.'
Fix the following issue:
'gunicorn stderr | /app/src/weblate/api/views.py: Error [TasksViewSet]: unable to guess serializer.
This is graceful fallback handling for APIViews.
Consider using GenericAPIView as view base class, if view is under your control.
Either way you may want to add a serializer_class (or method).
Ignoring view for now.'
Fix the following issue:
'gunicorn stderr | /app/src/weblate/api/views.py: Error [Search]: unable to guess serializer.
This is graceful fallback handling for APIViews.
Consider using GenericAPIView as view base class, if view is under your control.
Either way you may want to add a serializer_class (or method).
Ignoring view for now.'
@walpox walpox requested a review from nijel as a code owner March 3, 2025 11:42
Copy link

codecov bot commented Mar 3, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.99%. Comparing base (bfff372) to head (2bc1318).
Report is 361 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #14088      +/-   ##
==========================================
- Coverage   91.01%   90.99%   -0.02%     
==========================================
  Files         608      608              
  Lines       63617    63655      +38     
  Branches     6582     6588       +6     
==========================================
+ Hits        57901    57923      +22     
- Misses       4024     4034      +10     
- Partials     1692     1698       +6     
Files with missing lines Coverage Δ
weblate/api/spectacular.py 87.50% <ø> (ø)
weblate/api/views.py 89.19% <100.00%> (+<0.01%) ⬆️

... and 8 files with indirect coverage changes

@nijel nijel merged commit 2467f6f into WeblateOrg:main Mar 3, 2025
48 of 49 checks passed
@nijel
Copy link
Member

nijel commented Mar 3, 2025

Merged, thanks for your contribution!

@nijel nijel added this to the 5.10.3 milestone Mar 3, 2025
@walpox walpox deleted the walpox/api-fixes branch March 3, 2025 21:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants