Hello, I need support for DurationField.
Would be this a valid implementation in converters.py?
@converter
class DurationFieldConverter:
"""
A converter specifically for Django's DurationField.
"""
# This attribute tells the registration system which field this handles.
field_class = serializers.DurationField
def convert(self, field):
"""
The method that returns the JSON schema for the field.
The `field_to_jsonschema` function will automatically add
the 'title' and 'description' from the field's label and
help_text afterwards.
"""
return {
'type': 'string',
'format': 'duration',
# Per ISO 8601 duration format (e.g., "P3DT6H4M")
'pattern': r'^(\-)?P(?=\d|T\d)(?:(\d+)Y)?(?:(\d+)M)?(?:(\d+)W)?(?:(\d+)D)?(?:T(?:(\d+)H)?(?:(\d+)M)?(?:(\d*(\.\d+)?)S)?)?$'
}
If so, would it be possible to add it to the lib?
Thanks in advance
Hello, I need support for DurationField.
Would be this a valid implementation in converters.py?
If so, would it be possible to add it to the lib?
Thanks in advance