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.

suggestion: only='string'

See original GitHub issue

It took me time to understand what is happening when I passed a ('string') instead of ('string',). Maybe it would be a good idea to raise an error or accept one unique field in the only field.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Reactions:2
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
sloriacommented, May 14, 2018

This is closely related to #800, where it’s being proposed that we remove the “plucking” behavior when passing a string to only.

If we move forward with that, then it probably makes sense to go with option 1 and disallow non-collection input to only.

1reaction
deckar01commented, Jul 25, 2018

I think modulating the Nested functionality this much based on the type of a parameter is confusing.

https://github.com/marshmallow-code/marshmallow/issues/800#issuecomment-388662028

@timc13 The same argument applies here. I am in the process of removing the string handling for only in Nested in favor of a dedicated Pluck field. I’m not sure adding string handling for only is the best way to support this feature during schema instantiation. It would be nice if fields could be loaded and dumped without a schema to wrap them.

user_names_schema = fields.Pluck(UserSchema, 'name', many=True)
data, errors = user_names_schema.dumps(users)

@sloria I have been experimenting with treating schema as an dict/object field internally. This allows all fields (including non-collection types) to be used like a schema. It also eliminates the need for the many schema constructor argument in favor of wrapping the schema in a list field.

https://deckar01.gitlab.io/marsha/guide.html#deserializing-data

Read more comments on GitHub >

github_iconTop Results From Across the Web

javascript - search suggestion based on any letter of string
i am trying to write some java script code the auto suggest based on pretrial strings so to speak. here an example of...
Read more >
String suggestions in Unity - Rider Support | JetBrains
When I use SceneManager.LoadSceneAsync() I get suggestions on all the scenes in the project but their name as a string. But when I...
Read more >
Completion suggestions with strings containing only numbers ...
Hi, I'm using and testing against 0.90.5 (three nodes and five shards) and 0.90.7 (one node and five shards).
Read more >
VS Code tips — The Editor: Quick suggestions setting - YouTube
The Quick suggestions setting lets you configure if/when suggestions are shown as you type in VS Code."editor.
Read more >
Address bar autocomplete suggestions in Firefox
When you see the page you want, just click on it or use the up and down ... down to bookmarks only by...
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