Add a way to generate a Schema from a dictionary
See original GitHub issueGenerating 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:
- Created 4 years ago
- Reactions:1
- Comments:10 (5 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@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.
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
)?