Skip to content

Commit

Permalink
Merge pull request #4751 from open-formulieren/task/4418-transform-me…
Browse files Browse the repository at this point in the history
…chanism-for-addressnl-in-objectsAPI

[#4418] Add addressNl specific mappings to Objects API registration (variables tab)
  • Loading branch information
sergei-maertens authored Nov 22, 2024
2 parents d985471 + 8371e62 commit a5b4a23
Show file tree
Hide file tree
Showing 17 changed files with 1,376 additions and 257 deletions.
13 changes: 12 additions & 1 deletion src/openforms/api/drf_jsonschema.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@
from drf_jsonschema_serializer.converters import (
BooleanFieldConverter,
PrimaryKeyRelatedFieldConverter,
SerializerJSONFieldConverter,
)
from rest_framework import serializers

from .fields import PrimaryKeyRelatedAsChoicesField
from .fields import JSONFieldWithSchema, PrimaryKeyRelatedAsChoicesField


@converter
Expand Down Expand Up @@ -60,3 +61,13 @@ def convert(self, field):
]

return result


@converter
class JSONFieldConverter(SerializerJSONFieldConverter):
field_class = JSONFieldWithSchema

def convert(self, field):
schema = super().convert(field)
schema.update(field.schema)
return schema
13 changes: 13 additions & 0 deletions src/openforms/api/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,19 @@ class PrimaryKeyRelatedAsChoicesField(serializers.PrimaryKeyRelatedField):
pass


class JSONFieldWithSchema(serializers.JSONField):
"""
Custom subclass to register a custom drf-jsonschema-serializer converter.
"""

@property
def schema(self):
return {
"type": "object",
"properties": {},
}


class RelatedFieldFromContext(serializers.HyperlinkedRelatedField):
"""
Look up the object in the serializer context.
Expand Down
84 changes: 60 additions & 24 deletions src/openforms/js/compiled-lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,12 @@
"value": "API group"
}
],
"2nxTFx": [
{
"type": 0,
"value": "Postcode Schema target"
}
],
"2sbkGI": [
{
"type": 0,
Expand Down Expand Up @@ -949,12 +955,6 @@
"value": "The text that will be displayed in the form step to save the current information. Leave blank to get value from global configuration."
}
],
"8M403q": [
{
"type": 0,
"value": "Soft required fields should be filled out, but empty values don't block the users' progress. Sometimes this is needed for legal reasons. A component cannot be hard and soft required at the same time."
}
],
"8NbOpb": [
{
"type": 0,
Expand Down Expand Up @@ -1825,6 +1825,12 @@
"value": "in"
}
],
"F+UwT0": [
{
"type": 0,
"value": "House letter Schema target"
}
],
"F+cPJR": [
{
"type": 0,
Expand Down Expand Up @@ -1981,6 +1987,12 @@
"value": "The text that will be displayed in the overview page to confirm the form is filled in correctly. Leave blank to get value from global configuration."
}
],
"Ggu4I8": [
{
"type": 0,
"value": "Whether to map the specific subfield of addressNl component"
}
],
"Gi+cvN": [
{
"type": 0,
Expand Down Expand Up @@ -2879,12 +2891,6 @@
"value": "Select existing form definition"
}
],
"QL4SGQ": [
{
"type": 0,
"value": "Soft required"
}
],
"QLTh2N": [
{
"type": 0,
Expand Down Expand Up @@ -3623,6 +3629,12 @@
"value": "Basic"
}
],
"Xg9O5Y": [
{
"type": 0,
"value": "House number Schema target"
}
],
"Xj1uvL": [
{
"type": 0,
Expand Down Expand Up @@ -4545,6 +4557,12 @@
"value": "Payment status update variable mapping"
}
],
"fUaRWW": [
{
"type": 0,
"value": "City Schema target"
}
],
"fWcg7I": [
{
"type": 0,
Expand Down Expand Up @@ -4641,6 +4659,12 @@
"value": "Are you sure that you want to remove this mapping?"
}
],
"gdEbdr": [
{
"type": 0,
"value": "Map specific subfields"
}
],
"gheRkp": [
{
"type": 0,
Expand Down Expand Up @@ -5039,12 +5063,6 @@
"value": "Folder path"
}
],
"jtWzSW": [
{
"type": 0,
"value": "option 2: € 15,99"
}
],
"jy1jTd": [
{
"offset": 0,
Expand Down Expand Up @@ -5481,12 +5499,24 @@
"value": "Tooltip"
}
],
"o4AUIi": [
{
"type": 0,
"value": "Multiple target paths configured"
}
],
"o5Mfn3": [
{
"type": 0,
"value": "Include children"
}
],
"o5iEgm": [
{
"type": 0,
"value": "JSON Schema object target"
}
],
"o6Ju6l": [
{
"type": 0,
Expand Down Expand Up @@ -5709,6 +5739,12 @@
"value": "Select registration backend"
}
],
"pjbN8m": [
{
"type": 0,
"value": "Street name Schema target"
}
],
"poZZD9": [
{
"type": 0,
Expand Down Expand Up @@ -5963,12 +5999,6 @@
"value": "Regular expression for city"
}
],
"sxdJ/8": [
{
"type": 0,
"value": "option 1: € 10,99"
}
],
"t5fg/K": [
{
"type": 0,
Expand Down Expand Up @@ -6061,6 +6091,12 @@
"value": "Description (omschrijving) of the ROLTYPE to use for employees filling in a form for a citizen/company."
}
],
"u/0IPY": [
{
"type": 0,
"value": "House number addition Schema target"
}
],
"u3P/1E": [
{
"type": 0,
Expand Down
Loading

0 comments on commit a5b4a23

Please sign in to comment.