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

[#3688] Remove productaanvraagType for v2 options #4043

Merged
merged 1 commit into from
Mar 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
SilviaAmAm marked this conversation as resolved.
Show resolved Hide resolved
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
Loading