Skip to content

Commit

Permalink
[#3688] Remove productaanvraagType for v2 options
Browse files Browse the repository at this point in the history
  • Loading branch information
Viicos authored and sergei-maertens committed Mar 22, 2024
1 parent 4fbbea1 commit 7e39fe9
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ const ObjectsApiOptionsFormFields = ({index, name, schema, formData, onChange})
} else {
delete draft.variablesMapping;
}
delete draft.productaanvraagType;
delete draft.contentJson;
delete draft.paymentStatusUpdateJson;
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ const V2ConfigFields = ({index, name, formData, onChange}) => {
const {
objecttype = '',
objecttypeVersion = '',
productaanvraagType = '',
informatieobjecttypeSubmissionReport = '',
uploadSubmissionCsv = '',
informatieobjecttypeSubmissionCsv = '',
Expand Down Expand Up @@ -94,27 +93,6 @@ const V2ConfigFields = ({index, name, formData, onChange}) => {
onChange={onChange}
/>
</CustomFieldTemplate>
<CustomFieldTemplate
id="root_productaanvraagType"
label={intl.formatMessage({
defaultMessage: 'Productaanvraag type',
description: 'Objects API registration options "Productaanvraag type" label',
})}
rawDescription={intl.formatMessage({
defaultMessage: 'The type of ProductAanvraag',
description: 'Objects API registration options "Productaanvraag type" description',
})}
rawErrors={getFieldErrors(name, index, validationErrors, 'productaanvraagType')}
errors={buildErrorsComponent('productaanvraagType')}
displayLabel
>
<TextInput
id="root_productaanvraagType"
name="productaanvraagType"
value={productaanvraagType}
onChange={onChange}
/>
</CustomFieldTemplate>
<CustomFieldTemplate
id="root_informatieobjecttypeSubmissionReport"
label={intl.formatMessage({
Expand Down Expand Up @@ -250,7 +228,6 @@ V2ConfigFields.propTypes = {
version: PropTypes.number,
objecttype: PropTypes.string,
objecttypeVersion: PropTypes.string,
productaanvraagType: PropTypes.string,
informatieobjecttypeSubmissionReport: PropTypes.string,
uploadSubmissionCsv: PropTypes.string,
informatieobjecttypeSubmissionCsv: PropTypes.string,
Expand Down
16 changes: 10 additions & 6 deletions src/openforms/registrations/contrib/objects_api/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,6 @@ class ObjectsAPIOptionsSerializer(JsonSchemaSerializerMixin, serializers.Seriali
label=_("objecttype version"),
help_text=_("Version of the objecttype in the Objecttypes API"),
)
productaanvraag_type = serializers.CharField(
label=_("productaanvraag type"),
help_text=_("The type of ProductAanvraag"),
required=False,
)
informatieobjecttype_submission_report = serializers.URLField(
label=_("submission report PDF informatieobjecttype"),
help_text=_(
Expand Down Expand Up @@ -117,6 +112,11 @@ class ObjectsAPIOptionsSerializer(JsonSchemaSerializerMixin, serializers.Seriali
)

# V1 only fields:
productaanvraag_type = serializers.CharField(
label=_("productaanvraag type"),
help_text=_("The type of ProductAanvraag"),
required=False,
)
content_json = serializers.CharField(
label=_("JSON content field"),
help_text=_(
Expand Down Expand Up @@ -161,7 +161,11 @@ class ObjectsAPIOptionsSerializer(JsonSchemaSerializerMixin, serializers.Seriali
)

def validate(self, attrs: dict[str, Any]) -> dict[str, Any]:
v1_only_fields = {"content_json", "payment_status_update_json"}
v1_only_fields = {
"productaanvraag_type",
"content_json",
"payment_status_update_json",
}
v2_only_fields = {"variables_mapping", "geometry_variable_key"}

version = get_from_serializer_data_or_instance("version", attrs, self)
Expand Down
2 changes: 1 addition & 1 deletion src/openforms/registrations/contrib/objects_api/typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
class _BaseRegistrationOptions(TypedDict, total=False):
objecttype: Required[str]
objecttype_version: Required[int]
productaanvraag_type: str
informatieobjecttype_submission_report: str
upload_submission_csv: bool
informatieobjecttype_submission_csv: str
Expand All @@ -18,6 +17,7 @@ class _BaseRegistrationOptions(TypedDict, total=False):

class RegistrationOptionsV1(_BaseRegistrationOptions, total=False):
version: Required[Literal[1]]
productaanvraag_type: str
content_json: str
payment_status_update_json: str

Expand Down

0 comments on commit 7e39fe9

Please sign in to comment.