question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Improve documentation on fields.DelimitedList vs fields.List

See original GitHub issue

The docs for the fields.DelimitedList say it “can load from either a list or a delimited string” but I cannot get it to load from a list. It's possible I'm doing something wrong but When I swap out fields.DelimitedList for fields.List everything works as expected. I think either the docs should be changed, or we should fix the implementation of DelimitedList so that it works as expected.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:13 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
sloriacommented, Jul 24, 2019

5.4.0 removes the duck typing . I also added more docs re: parsing lists in query strings: https://webargs.readthedocs.io/en/latest/quickstart.html#parsing-lists-in-query-strings .

0reactions
sloriacommented, Jul 24, 2019

If we’re always expecting DelimitedList to handle the deserialization of a single value, why have it extend marshmallow.fields.List

Conceptually, DelimitedList is a List, evidenced by the fact that you can’t implement DelimitedList as a non-subclass of List without duplicating a bunch of List’s code. I suppose you could use composition, but that’s not clearly better design in this context.

Anything that extends marshmallow.fields.List and has a property delimiter will not behave as expected.

Yeah…I don’t recall why we decided to use duck-typing here. At the very least, it hurts readability. At worst, it leads to unexpected behavior like you ran into. I’ll change this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Source code for webargs.fields
"""Field classes. Includes all fields from `marshmallow.fields` in addition to a custom `Nested` field and `DelimitedList`. All fields can optionally take a ...
Read more >
webargs - Read the Docs
If a List field is used to parse data from a location like query parameters – where one or multiple values can be...
Read more >
webargs(1) - Arch manual pages
Parsing Lists in Query Strings. Use fields.DelimitedList to parse comma-separated lists in query parameters, e.g. /?permissions=read,write. from webargs import ...
Read more >
How to work with search results - Azure Cognitive Search
On a query request, append $select=<field list> to specify which fields ... words and reduce words to root forms, which usually improves the ......
Read more >
Commands - OpenSearch documentation
fields. Use the fields command to keep or remove fields from a search result. ... field list, Specify a comma-delimited list of fields....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found