List schema fields
See original GitHub issueI have a schema that I am filtering using query attributes. I want to remove invalid field names before dumping the schema, but I cannot figure out how to properly list the fields that are part of my schema. I tried JournalListSchema.dict.keys() which worked on my local machine, but when I deployed it to production the fields were not listed. Any ideas on how to do this?
Here is my example code:
# schema
class JournalListSchema(ma.Schema):
issn = fields.String()
title = fields.String()
# view
attrs = request.args.get("attrs")
only = attrs.split(",")
for field in only:
if field not in JournalListSchema.__dict__.keys():
only.remove(field)
journal_list_schema = JournalListSchema(only=only)
journals_dumped = journal_list_schema.dump(journals.items, many=True)
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Field element (List) | Microsoft Learn
Defines the internal data types used in the list infrastructure of a SharePoint website. A field is a column or attribute of information ......
Read more >Schemas and Types - GraphQL
The most basic components of a GraphQL schema are object types, which just represent a kind of object you can fetch from your...
Read more >List all schemas - ActiveCampaign
Retrieve all schemas available within an account. Users are encouraged to leverage the ?showFields=all query parameter when programmatically creating new schema ...
Read more >SharePoint Field Schema XML Examples
SharePoint Field Schema XML Examples. By Gunjan Datta in field. This post will give examples of SharePoint field schema xml.
Read more >GraphQL schema basics - Apollo GraphQL Docs
Each field returns data of the type specified. A field's return type can be a scalar, object, enum, union, or interface (all described...
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
Yes I did consider that but thought it’s a bit too much overhead for now.
Another thing you could to is use webargs to validate the inputs in the first place. You’d have to to declare explicitly which fields you allow the user to select, which may involve duplication, though.