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

♻️ [#5044] Add constant for dataSrc options #5080

Merged
merged 1 commit into from
Feb 5, 2025

Conversation

stevenbal
Copy link
Contributor

@stevenbal stevenbal commented Feb 4, 2025

Closes #5044

Changes

  • Add constant for dataSrc options

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

@stevenbal stevenbal marked this pull request as draft February 4, 2025 15:38
@stevenbal stevenbal force-pushed the cleanup/5044-data-src-constants branch 4 times, most recently from 58b3212 to ede4fe9 Compare February 4, 2025 15:52
@stevenbal stevenbal marked this pull request as ready for review February 4, 2025 15:52
Copy link

codecov bot commented Feb 4, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.72%. Comparing base (a201a2a) to head (5fccbdf).
Report is 2 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #5080   +/-   ##
=======================================
  Coverage   96.72%   96.72%           
=======================================
  Files         770      770           
  Lines       26524    26534   +10     
  Branches     3452     3452           
=======================================
+ Hits        25656    25666   +10     
  Misses        606      606           
  Partials      262      262           

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

Comment on lines 48 to 54
dataSrc: NotRequired[
Literal[
DataSrcOptions.manual,
DataSrcOptions.variable,
DataSrcOptions.referentielijsten,
]
]
Copy link
Member

Choose a reason for hiding this comment

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

I'm fairly certain type checkers don't understand this - type checking is done statically and no python code is actually evaluated.

image

Suggested change
dataSrc: NotRequired[
Literal[
DataSrcOptions.manual,
DataSrcOptions.variable,
DataSrcOptions.referentielijsten,
]
]
dataSrc: NotRequired[DataSrcOptions]

using the choices class should help enforce that comparisons are made with the constant rather than magic strings, but I haven't tested this.

@sergei-maertens sergei-maertens force-pushed the cleanup/5044-data-src-constants branch from ede4fe9 to 5fccbdf Compare February 5, 2025 10:22
@sergei-maertens sergei-maertens merged commit 53752fa into master Feb 5, 2025
15 of 17 checks passed
@sergei-maertens sergei-maertens deleted the cleanup/5044-data-src-constants branch February 5, 2025 10:24
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 constants for component.openForms.dataSrc values
2 participants