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

Support DictField with child #142

Closed
zach-waggoner opened this issue Aug 17, 2020 · 3 comments
Closed

Support DictField with child #142

zach-waggoner opened this issue Aug 17, 2020 · 3 comments
Labels
enhancement New feature or request

Comments

@zach-waggoner
Copy link

There doesn't seem to be any way to represent dictionaries with a known value type. For example, this:

class ExampleSerializer(serializers.Serializer):
    dictionary = serializers.DictField(child=serializers.IntegerField())

produces this:

Example:
  type: object
  properties:
    dictionary:
      type: object
      additionalProperties: {}

It would be nice if it would instead produce this:

Example:
  type: object
  properties:
    dictionary:
      type: object
      additionalProperties:
        type: integer
@tfranzel tfranzel added the enhancement New feature or request label Aug 17, 2020
@tfranzel
Copy link
Owner

good catch! i think this should be an easy addition for the basic cases

@tfranzel
Copy link
Owner

@zach-waggoner that should do the trick. can you confirm and close the issue? thx

@zach-waggoner
Copy link
Author

zach-waggoner commented Aug 26, 2020

Works great! Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants