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

feat: Machinery configuration via API #13056

Open
wants to merge 18 commits into
base: main
Choose a base branch
from

Conversation

gersona
Copy link
Collaborator

@gersona gersona commented Nov 18, 2024

Proposed changes

  • new endpoint has been added for Machinery service installation /api/projects/{string:project}/machinery_settings/
  • validation has been moved out to weblate.machinery.models to be used by both API based and command based configuration

Checklist

  • Lint and unit tests pass locally with my changes.
  • I have added tests that prove my fix is effective or that my feature works.
  • I have added documentation to describe my feature.
  • I have squashed my commits into logic units.
  • I have described the changes in the commit messages.

Other information

weblate/api/views.py Fixed Show fixed Hide fixed
weblate/api/views.py Fixed Show resolved Hide resolved
@gersona gersona marked this pull request as ready for review November 22, 2024 04:10
Copy link
Member

@nijel nijel left a comment

Choose a reason for hiding this comment

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

What I miss is support for removing a service.

Also the semantics is slightly different than with the other API endpoints.

How about:

  • PATCH would change configuration for a single service. Setting it to blank would remove it.
  • PUT would replace configuration for all services.

weblate/api/views.py Show resolved Hide resolved
weblate/api/views.py Outdated Show resolved Hide resolved
)

if service is None or errors:
return Response({"errors": errors}, status=HTTP_400_BAD_REQUEST)

Check warning

Code scanning / CodeQL

Information exposure through an exception Medium

Stack trace information
flows to this location and may be exposed to an external user.
)

if service is None or errors:
return Response({"errors": errors}, status=HTTP_400_BAD_REQUEST)

Check warning

Code scanning / CodeQL

Information exposure through an exception Medium

Stack trace information
flows to this location and may be exposed to an external user.
Copy link
Member

@nijel nijel left a comment

Choose a reason for hiding this comment

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

There are some errors in OpenAPI validation: https://github.com/WeblateOrg/weblate/pull/13056/checks (You can ignore the warnings, these were present before).

weblate/api/serializers.py Show resolved Hide resolved
weblate/api/serializers.py Outdated Show resolved Hide resolved
Copy link

codecov bot commented Nov 28, 2024

Codecov Report

Attention: Patch coverage is 99.21875% with 1 line in your changes missing coverage. Please review.

Project coverage is 90.95%. Comparing base (c342a37) to head (1bf4fa7).

Files with missing lines Patch % Lines
weblate/api/views.py 97.67% 0 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #13056      +/-   ##
==========================================
+ Coverage   90.92%   90.95%   +0.03%     
==========================================
  Files         601      601              
  Lines       62143    62248     +105     
  Branches     6404     6415      +11     
==========================================
+ Hits        56505    56620     +115     
+ Misses       3976     3967       -9     
+ Partials     1662     1661       -1     
Files with missing lines Coverage Δ
weblate/api/serializers.py 92.50% <100.00%> (+0.22%) ⬆️
weblate/api/tests.py 100.00% <100.00%> (ø)
...machinery/management/commands/install_machinery.py 100.00% <100.00%> (+27.50%) ⬆️
weblate/machinery/models.py 100.00% <100.00%> (ø)
weblate/machinery/tests.py 99.69% <100.00%> (+<0.01%) ⬆️
weblate/api/views.py 89.07% <97.67%> (+0.30%) ⬆️

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.

Per-project automatic suggestion configuration via API
2 participants