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

Objects API "contract" feature - release blockers #4019

Closed
3 tasks done
Tracked by #4033
sergei-maertens opened this issue Mar 18, 2024 · 2 comments · Fixed by #4026, #4028, #4036 or #4042
Closed
3 tasks done
Tracked by #4033

Objects API "contract" feature - release blockers #4019

sergei-maertens opened this issue Mar 18, 2024 · 2 comments · Fixed by #4026, #4028, #4036 or #4042
Assignees
Milestone

Comments

@sergei-maertens
Copy link
Member

sergei-maertens commented Mar 18, 2024

Follow up from #3688, these aspects should land in the 2.6 release

  • Handling of file fields - a file component (single or multiple uploads) should be possible to explicitly map to a particular (nested) property in the object type definition. Currently all upload fields are processed and result in an array of Documenten API urls, and it's not possible to match which component/file upload matches to which URL. We have the means now to work with structured data, this would be an unfortunate omission.
  • Document how one would use a "productaanvraag" user-defined variable and map that into the structure. This facilitates migrating from v1 to v2
  • Check if we can replace the payment status PATCH call with a PUT call instead (payment related variables need to be mappable)
@sergei-maertens sergei-maertens added triage Issue needs to be validated. Remove this label if the issue considered valid. enhancement labels Mar 18, 2024
@sergei-maertens sergei-maertens added this to the Release 2.6.0 milestone Mar 18, 2024
@joeribekker
Copy link
Contributor

Refinement: Decided this should be done (and remove the productaanvraag field from the v2 config form)

@joeribekker joeribekker removed the triage Issue needs to be validated. Remove this label if the issue considered valid. label Mar 18, 2024
@Viicos
Copy link
Contributor

Viicos commented Mar 19, 2024

For the first checkbox:

  • File upload components will be special cased during registration. This part of the code should be adapted:

dynamic_values = state.get_data()
static_values = state.static_data()
static_values.update(
{
variable.key: variable.initial_value
for variable in get_static_variables(
submission=submission,
variables_registry=variables_registry,
)
}
)
variables_values = FormioData(
{
**dynamic_values,
**static_values,
}
).data

  • Because we only offer compatible target paths to the user (e.g. when configuring the mapping for a textfield component, only the JSON Schema targets of {"type": "string"} will be offered in the UI), we have to special case this compatibility logic:
    • the fileupload component is of datatype array, but when registered, we will deal with the Documents URL (of datatype string). The admin frontend is the one providing a JSON Schema matching a variable, and requests the backend for a list of target paths compatible with such a JSON Schema. So this code will have to be adapted:
      * Return a JSON Schema definition matching the provided variable.
      * @param {Object} variable - The current variable
      * @returns {Object} - The JSON Schema
      */
      const asJsonSchema = variable => {
      if (VARIABLE_TYPE_MAP.hasOwnProperty(variable.dataType))
      return {type: VARIABLE_TYPE_MAP[variable.dataType]};
      return {
      type: 'string',
      format: FORMAT_TYPE_MAP[variable.dataType],
      };
      };
    • Maybe the variables tab should display datatype: string instead of datatype: array in the datatype column? To make things less confusing

@Viicos Viicos moved this from Todo to In Progress in Development Mar 20, 2024
This was linked to pull requests Mar 20, 2024
@github-project-automation github-project-automation bot moved this from In Progress to Done in Development Mar 20, 2024
@github-project-automation github-project-automation bot moved this from Done to In Progress in Development Mar 20, 2024
SilviaAmAm added a commit that referenced this issue Mar 21, 2024
The variable for file components has type 'array', but if only one file can be uploaded we want to be able to map it to attributes of type 'string' in the JSON schema. If multiple files can be uploaded, then we map it to 'array' attributes
SilviaAmAm added a commit that referenced this issue Mar 21, 2024
The variable for file components has type 'array', but if only one file can be uploaded we want to be able to map it to attributes of type 'string' in the JSON schema. If multiple files can be uploaded, then we map it to 'array' attributes
sergei-maertens added a commit that referenced this issue Mar 22, 2024
…fields

[#4019] Mapping file uploads in Object API registration (frontend)
@github-project-automation github-project-automation bot moved this from In Progress to Done in Development Mar 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment