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

Feature/4908 json registration backend #4956

Draft
wants to merge 35 commits into
base: master
Choose a base branch
from

Conversation

viktorvanwijk
Copy link
Contributor

Closes #4908

Changes

Add registration backend plugin that converts submitted form data to JSON and sends it to a specified API endpoint

Checklist

Check off the items that are completed or not relevant.

  • Impact on features

    • Checked copying a form
    • Checked import/export of a form
    • Config checks in the configuration overview admin page
    • Problem detection in the admin email digest is handled
  • Release management

    • I have labelled the PR as "needs-backport" accordingly
  • I have updated the translations assets (you do NOT need to provide translations)

    • Ran ./bin/makemessages_js.sh
    • Ran ./bin/compilemessages_js.sh
  • Dockerfile/scripts

    • Updated the Dockerfile with the necessary scripts from the ./bin folder
  • Commit hygiene

    • Commit messages refer to the relevant Github issue
    • Commit messages explain the "why" of change, not the how

Plugin name did not make sense before
API endpoint is relative, name should reflect that
It should match the corresponding property of the serializer (which is 'service' and not 'service_select')
Not relevant anymore or duplicates
Wrong place and doesn't look great
…n plugin

Need to include all form variables listed in the options to a values dictionary
The content of the attachment is now added to the result
Now includes a check on the generated values dictionary for easy testing
Copy link

codecov bot commented Dec 19, 2024

Codecov Report

Attention: Patch coverage is 94.73684% with 3 lines in your changes missing coverage. Please review.

Project coverage is 96.61%. Comparing base (eedffb3) to head (4ed04a4).
Report is 8 commits behind head on master.

Files with missing lines Patch % Lines
src/openforms/registrations/contrib/json/plugin.py 90.90% 1 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4956      +/-   ##
==========================================
- Coverage   96.61%   96.61%   -0.01%     
==========================================
  Files         760      764       +4     
  Lines       25820    25894      +74     
  Branches     3383     3391       +8     
==========================================
+ Hits        24947    25018      +71     
- Misses        608      609       +1     
- Partials      265      267       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

This is a requirement of the plugin
The user might want to send it to just the api root of the service
Makes more sense to keep static variables dict close to where it's used
The previous size was not big enough to show all elements without scroll bars
Required for simulating a receiving service
It is sufficient to only pass the relative endpoint to the .post method
This check if redundant, as the for loop will never be executed anyway if the query set is empty
It is closely related to the serializer
…pes only

Only ORC type services are relevant for this plugin
"Any other fields that need special attention?":
Not for the moment, all the fields are JSON serializable

"Service type relevant?":
Yes, but not here. In the serializer, it should only show the services of type ORC. The other ones are not relevant for this plugin

"Does execute_unless_result_exists need to be used?":
Not for this plugin. It is normally used in plugins where a lot of API calls are made, where it prevents objects from being created multiple times on retries (when one or multiple API calls had failed).
This will raise a KeyError if a form variable is not available in the submitted data nor in the static variables. This is better than passing is silently
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.

Add a registration backend that sends the form/submission variables as JSON to some API endpoint
1 participant