Skip to content

Commit 366793e

Browse files
committed
[#3732] Fix API documentation after drf-spectacular upgrade
1 parent 970fb94 commit 366793e

File tree

10 files changed

+101
-9
lines changed

10 files changed

+101
-9
lines changed

src/openapi.yaml

+55-2
Original file line numberDiff line numberDiff line change
@@ -6333,6 +6333,8 @@ components:
63336333
title: Appointment time
63346334
description: Date and time of the appointment
63356335
contactDetails:
6336+
type: object
6337+
additionalProperties: {}
63366338
description: Additional contact detail field values.
63376339
privacyPolicyAccepted:
63386340
type: boolean
@@ -6348,7 +6350,6 @@ components:
63486350
the endpoint contains a token which invalidates on state changes and after
63496351
one day.
63506352
required:
6351-
- contactDetails
63526353
- date
63536354
- datetime
63546355
- location
@@ -6923,6 +6924,8 @@ components:
69236924
- $ref: '#/components/schemas/PaymentBackendEnum'
69246925
- $ref: '#/components/schemas/BlankEnum'
69256926
paymentBackendOptions:
6927+
type: object
6928+
additionalProperties: {}
69266929
nullable: true
69276930
paymentOptions:
69286931
type: array
@@ -7138,6 +7141,8 @@ components:
71387141
type: object
71397142
properties:
71407143
data:
7144+
type: object
7145+
additionalProperties: {}
71417146
title: form data
71427147
description: The Form.io submission data object. This will be merged with
71437148
the full form submission data, including data from other steps, to evaluate
@@ -7165,6 +7170,8 @@ components:
71657170
pattern: ^[-a-zA-Z0-9_]+$
71667171
deprecated: true
71677172
configuration:
7173+
allOf:
7174+
- $ref: '#/components/schemas/FormDefinitionConfiguration'
71687175
title: Form.io configuration
71697176
description: The form definition as Form.io JSON schema
71707177
loginRequired:
@@ -7183,6 +7190,22 @@ components:
71837190
- configuration
71847191
- name
71857192
- url
7193+
FormDefinitionConfiguration:
7194+
type: object
7195+
properties:
7196+
type:
7197+
$ref: '#/components/schemas/FormDefinitionConfigurationTypeEnum'
7198+
components:
7199+
type: array
7200+
items: {}
7201+
required:
7202+
- components
7203+
- type
7204+
FormDefinitionConfigurationTypeEnum:
7205+
enum:
7206+
- form
7207+
type: string
7208+
description: '* `form` - form'
71867209
FormDefinitionDetail:
71877210
type: object
71887211
properties:
@@ -7206,6 +7229,8 @@ components:
72067229
pattern: ^[-a-zA-Z0-9_]+$
72077230
deprecated: true
72087231
configuration:
7232+
allOf:
7233+
- $ref: '#/components/schemas/FormDefinitionConfiguration'
72097234
title: Form.io configuration
72107235
description: The form definition as Form.io JSON schema
72117236
loginRequired:
@@ -7597,11 +7622,14 @@ components:
75977622
title: Registration backend
75987623
maxLength: 100
75997624
options:
7600-
title: Registration backend options
7625+
type: object
7626+
additionalProperties: {}
7627+
title: registration backend options
76017628
required:
76027629
- backend
76037630
- key
76047631
- name
7632+
- options
76057633
FormStep:
76067634
type: object
76077635
properties:
@@ -7617,6 +7645,8 @@ components:
76177645
maxLength: 100
76187646
pattern: ^[-a-zA-Z0-9_]+$
76197647
configuration:
7648+
allOf:
7649+
- $ref: '#/components/schemas/FormDefinitionConfiguration'
76207650
readOnly: true
76217651
formDefinition:
76227652
type: string
@@ -8131,6 +8161,8 @@ components:
81318161
type: object
81328162
properties:
81338163
value:
8164+
type: object
8165+
additionalProperties: {}
81348166
title: service_fetch_configuration
81358167
required:
81368168
- value
@@ -8460,6 +8492,8 @@ components:
84608492
- $ref: '#/components/schemas/PaymentBackendEnum'
84618493
- $ref: '#/components/schemas/BlankEnum'
84628494
paymentBackendOptions:
8495+
type: object
8496+
additionalProperties: {}
84638497
nullable: true
84648498
paymentOptions:
84658499
type: array
@@ -8652,6 +8686,8 @@ components:
86528686
pattern: ^[-a-zA-Z0-9_]+$
86538687
deprecated: true
86548688
configuration:
8689+
allOf:
8690+
- $ref: '#/components/schemas/FormDefinitionConfiguration'
86558691
title: Form.io configuration
86568692
description: The form definition as Form.io JSON schema
86578693
loginRequired:
@@ -8681,6 +8717,8 @@ components:
86818717
maxLength: 100
86828718
pattern: ^[-a-zA-Z0-9_]+$
86838719
configuration:
8720+
allOf:
8721+
- $ref: '#/components/schemas/FormDefinitionConfiguration'
86848722
readOnly: true
86858723
formDefinition:
86868724
type: string
@@ -8773,6 +8811,8 @@ components:
87738811
type: string
87748812
description: The human-readable name for a plugin.
87758813
schema:
8814+
type: object
8815+
additionalProperties: {}
87768816
title: JSON schema
87778817
description: The generated JSON schema for the plugin options.
87788818
required:
@@ -8901,6 +8941,8 @@ components:
89018941
type: string
89028942
description: The human-readable name for a plugin.
89038943
schema:
8944+
type: object
8945+
additionalProperties: {}
89048946
title: JSON schema
89058947
description: The generated JSON schema for the plugin options.
89068948
required:
@@ -8978,10 +9020,17 @@ components:
89789020
* `GET` - GET
89799021
* `POST` - POST
89809022
headers:
9023+
type: object
9024+
additionalProperties: {}
89819025
title: HTTP request headers
89829026
description: Additions and overrides for the HTTP request headers as defined
89839027
in the Service.
89849028
queryParams:
9029+
type: object
9030+
additionalProperties:
9031+
type: array
9032+
items:
9033+
type: string
89859034
title: HTTP query string
89869035
body:
89879036
nullable: true
@@ -9139,6 +9188,8 @@ components:
91399188
value:
91409189
description: Raw value of the component.
91419190
component:
9191+
type: object
9192+
additionalProperties: {}
91429193
description: Configuration of the component.
91439194
required:
91449195
- component
@@ -9242,6 +9293,8 @@ components:
92429293
- $ref: '#/components/schemas/ContextAwareFormStep'
92439294
readOnly: true
92449295
data:
9296+
type: object
9297+
additionalProperties: {}
92459298
nullable: true
92469299
isApplicable:
92479300
type: boolean

src/openforms/appointments/api/serializers.py

+5
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,11 @@ class AppointmentSerializer(serializers.HyperlinkedModelSerializer):
168168
"one day."
169169
),
170170
)
171+
contact_details = serializers.DictField(
172+
label=_("contact details"),
173+
help_text=_("Additional contact detail field values."),
174+
required=False,
175+
)
171176

172177
_status_url: str # set by the view
173178

src/openforms/forms/api/serializers/form.py

+7
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ class FormLiteralsSerializer(serializers.Serializer):
5757

5858

5959
class FormRegistrationBackendSerializer(serializers.ModelSerializer):
60+
options = serializers.DictField(label=_("registration backend options"))
61+
6062
class Meta:
6163
model = FormRegistrationBackend
6264
fields = [
@@ -161,6 +163,11 @@ class FormSerializer(PublicFieldsSerializerMixin, serializers.ModelSerializer):
161163
required=False,
162164
default="",
163165
)
166+
payment_backend_options = serializers.DictField(
167+
label=_("payment backend options"),
168+
required=False,
169+
allow_null=True,
170+
)
164171
payment_options = PaymentOptionsReadOnlyField()
165172

166173
appointment_options = AppointmentOptionsSerializer(

src/openforms/forms/api/serializers/form_definition.py

+11
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,13 @@ def get_admin_url(self, obj: Form) -> str:
5858
return request.build_absolute_uri(admin_url)
5959

6060

61+
class FormDefinitionConfigurationSerializer(serializers.Serializer):
62+
type = serializers.ChoiceField(
63+
choices=["form"],
64+
)
65+
components = serializers.ListField()
66+
67+
6168
@extend_schema_serializer(deprecate_fields=["slug"])
6269
class FormDefinitionSerializer(
6370
PublicFieldsSerializerMixin, serializers.HyperlinkedModelSerializer
@@ -66,6 +73,10 @@ class FormDefinitionSerializer(
6673
component_translations = ComponentTranslationsSerializer(
6774
required=False, allow_null=True
6875
)
76+
configuration = FormDefinitionConfigurationSerializer(
77+
label=_("Form.io configuration"),
78+
help_text=_("The form definition as Form.io JSON schema"),
79+
)
6980

7081
class Meta:
7182
model = FormDefinition

src/openforms/forms/api/serializers/form_step.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
from ...validators import validate_no_duplicate_keys_across_steps
1414
from ..validators import FormStepIsApplicableIfFirstValidator
1515
from .button_text import ButtonTextSerializer
16+
from .form_definition import FormDefinitionConfigurationSerializer
1617

1718

1819
class FormStepLiteralsSerializer(serializers.Serializer):
@@ -68,7 +69,7 @@ class FormStepSerializer(
6869
PublicFieldsSerializerMixin, serializers.HyperlinkedModelSerializer
6970
):
7071
index = serializers.IntegerField(source="order")
71-
configuration = serializers.JSONField(
72+
configuration = FormDefinitionConfigurationSerializer(
7273
source="form_definition.configuration", read_only=True
7374
)
7475
login_required = serializers.BooleanField(

src/openforms/forms/api/serializers/logic/action_serializers.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ class LogicValueActionSerializer(serializers.Serializer):
6767

6868

6969
class LogicFetchActionSerializer(serializers.Serializer):
70-
value = serializers.JSONField(
70+
value = serializers.DictField(
7171
label=_("service_fetch_configuration"),
7272
)
7373

src/openforms/payments/api/serializers.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class PaymentPluginSerializer(PluginBaseSerializer):
1313
"""
1414

1515
# add the configuration form options
16-
schema = serializers.JSONField(
16+
schema = serializers.DictField(
1717
source="configuration_options.display_as_jsonschema",
1818
label=_("JSON schema"),
1919
help_text=_("The generated JSON schema for the plugin options."),

src/openforms/registrations/api/serializers.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111

1212
class RegistrationPluginSerializer(PluginBaseSerializer):
13-
schema = serializers.JSONField(
13+
schema = serializers.DictField(
1414
source="configuration_options.display_as_jsonschema",
1515
label=_("JSON schema"),
1616
help_text=_("The generated JSON schema for the plugin options."),

src/openforms/submissions/api/serializers.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ def get_configuration(self, instance) -> dict:
211211
class SubmissionStepSerializer(NestedHyperlinkedModelSerializer):
212212
form_step = ContextAwareFormStepSerializer(read_only=True)
213213
slug = serializers.SlugField(source="form_step.slug", read_only=True)
214-
data = serializers.JSONField(
214+
data = serializers.DictField(
215215
label=_("data"),
216216
required=False,
217217
allow_null=True,
@@ -261,7 +261,7 @@ def validate_data(self, data: dict):
261261

262262

263263
class FormDataSerializer(serializers.Serializer):
264-
data = serializers.JSONField(
264+
data = serializers.DictField(
265265
label=_("form data"),
266266
required=False,
267267
help_text=_(
@@ -469,7 +469,7 @@ class SubmissionComponentSummarySerializer(serializers.Serializer):
469469
help_text=_("Raw value of the component."),
470470
required=True,
471471
)
472-
component = serializers.JSONField(
472+
component = serializers.DictField(
473473
help_text=_("Configuration of the component."),
474474
required=True,
475475
)

src/openforms/variables/api/serializers.py

+15
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from django.utils.translation import gettext_lazy as _
2+
13
from rest_framework import serializers
24

35
from openforms.api.validators import ModelValidator
@@ -7,6 +9,19 @@
79

810

911
class ServiceFetchConfigurationSerializer(serializers.HyperlinkedModelSerializer):
12+
headers = serializers.DictField(
13+
label=_("HTTP request headers"),
14+
help_text=_(
15+
"Additions and overrides for the HTTP request headers as defined in the Service."
16+
),
17+
required=False,
18+
)
19+
query_params = serializers.DictField(
20+
child=serializers.ListField(child=serializers.CharField()),
21+
label=_("HTTP query string"),
22+
required=False,
23+
)
24+
1025
def to_internal_value(self, data):
1126
value = super().to_internal_value(data)
1227
# add id for the bulk update of form_variables

0 commit comments

Comments
 (0)