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.

Add a way to generate a Schema from a dictionary

See original GitHub issue

Generating schemas at runtime is a fairly common use case that I’ve run into a handful of times at this point (webargs, environs , form builders…).

It might make sense to incorporate this into marshmallow core.

Proposed API

>>> MyDynamicSchema = Schema.from_dict({"foo": fields.Str()})
>>> MyDynamicSchema
<class 'marshmallow.schema.GeneratedSchema'>
class AlbumSchema(Schema):
     artist = fields.Nested(Schema.from_dict({"name": fields.Str()})

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
deckar01commented, Oct 25, 2019

@sakshiaroras It looks like you are new to GitHub. You can use 3 back ticks ``` before and after your code to preserve the white space. You can learn more about this by reading GitHub’s Mastering Markdown guide.

You may also want to learn more about minimal repro cases to help get your problem solved more efficiently. I recommend StackOverflow’s guide on the subject: How to create a Minimal, Reproducible Example.

From what I can tell, your issue does not seem to be related to this closed issue. You might consider opening a new issue to avoid sending unrelated notifications to the original participants of this discussion.

0reactions
sloriacommented, Oct 25, 2019

That’s still not a runnable script. Can you please post a minimal script that can be run on its own (i.e. python repro.py)?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Python dictionary from schema - Stack Overflow
I need to check if all the keys declared in a schema file are present in ... for key in schema['properties'].keys(): if not...
Read more >
How to create a Data Dictionary and Schema (ERD Diagram ...
In this video we will explore the Driving School App. System.We will create a Data Dictionary and Schema (ERD Diagram).
Read more >
Creating a Metadata Dictionary (Preview)
Click the Add To Dictionary button. If the source has more than one schema, Anzo displays the select schema dialog box. In the...
Read more >
How to Add Items to a Python Dictionary? - phoenixNAP
Learn how to add items to a Python dictionary in this guide through example code. See how you can add multiple items at...
Read more >
Data Dictionaries | U.S. Geological Survey - USGS.gov
Business rules, such as for validation of a schema or data quality. How Data Dictionaries are Used. Documentation - provide data structure details...
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