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

Improve developer documentation of submission state and component configuration #4044

Closed
Viicos opened this issue Mar 22, 2024 · 2 comments · Fixed by #4091
Closed

Improve developer documentation of submission state and component configuration #4044

Viicos opened this issue Mar 22, 2024 · 2 comments · Fixed by #4091
Assignees
Labels
documentation Improvements or additions to documentation owner: maykin
Milestone

Comments

@Viicos
Copy link
Contributor

Viicos commented Mar 22, 2024

While working on the Objects API registration, I sometimes found it hard to understand how the submission state should be loaded. Here's a couple things I noted:

  • The SubmissionValueVariablesState (available through submission.load_submission_value_variables_state) has 11 public methods/attributes, making it hard to find out the right one to use. Naming is sometimes ambiguous (e.g. get_data). None of them have docstrings.
  • There seem to be a distinction between "saved variables" (with a PK) and variables not persisted, but it is unclear what is the use case for this.
  • The SubmissionValueVariable name is confusing: it should probably be SubmissionVariableValue instead. However not sure if it is possible to rename it.

I had the same trouble with components configuration:

  • The recommended way to access the component configuration is through the FormioConfigurationWrapper class, but is also missing docstrings.
  • While I understand a component is following the {"type": "...", "key": "..."} structure, it is still unclear to me how that plays with repeating groups and/or nested components. This relates to the FormioData structure.

For this, I would really like having some kind of introduction in the docs to the formio structure, how it is integrated in Open forms and how we manage to extend it.


I would also really like having some kind of "cheat sheet" in docs, stating the recommended ways of dealing with the submission state, the formio configuration wrapper, etc

@sergei-maertens
Copy link
Member

I'd also like a critical review of these service layers - they have grown beyond their initial scope because of certain requirements.

Let's figure out what developers need and how we can provide this while keeping the implementation evolvable.

@Viicos Viicos added documentation Improvements or additions to documentation triage Issue needs to be validated. Remove this label if the issue considered valid. labels Mar 25, 2024
@joeribekker joeribekker added owner: maykin and removed triage Issue needs to be validated. Remove this label if the issue considered valid. labels Mar 25, 2024
@joeribekker
Copy link
Contributor

joeribekker commented Mar 25, 2024

Refinement: We focus first on documenting existing behaviour and make a list of possible improvements. Focus on the intent of the service layers. Timeboxed on a day + team discussion.

@Viicos starts with a rough draft so we can shoot at it.

@joeribekker joeribekker added this to the Release 2.7.0 milestone Mar 25, 2024
Viicos added a commit that referenced this issue Mar 25, 2024
Viicos added a commit that referenced this issue Mar 25, 2024
Viicos added a commit that referenced this issue Mar 26, 2024
Use a single `get_variables` method to access variables.
Old behavior (using `variables`/`saved_variables`/`get_prefill_variables`)
is still available through arguments.
Add docstrings
Switch to a normal class, dataclasses are confusing when using field(init=False)
Mark some methods are private
Add a `load_variables` init arg, to load variables when the wrapper gets created
Viicos added a commit that referenced this issue Mar 26, 2024
Viicos added a commit that referenced this issue Apr 2, 2024
Viicos added a commit that referenced this issue Apr 2, 2024
sergei-maertens added a commit that referenced this issue May 1, 2024
[#4044] Improve dev documentation regarding forms and submissions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment