Skip to content

Add default schema URL / Endpoint for model REST API  #34

@pythononwheels

Description

@pythononwheels

So you can access the schema as well

API /modelname/schema
Returns JSON

Example JSON Rsponse for a blog article model:

call:

localhost:8080/article/shema

response:

schema = {
        'title'          :   { 'type' : 'string', 'maxlength' : 255},
        'teaser'         :   { 'type' : 'string' },
        'text'           :   { 'type' : 'string'},
        'tags'           :   { 'type' : 'list', "default" : [] },
        'comments'       :   { 'type' : 'list', "default" : [] },
        'featured'       :   { 'type' : 'boolean', "default" : False },
        'blog'           :   { 'type' : 'boolean', "default" : False },  
        "blog_link"      :   { 'type' : 'string', "default" : "" },
        "votes"          :   { "type" : "integer", "default" : 0 },
        "author"         :   { "type" : "dict" }, #author 
        "images"         :   { "type" : "list"  }, #list of images uploaded for this article   
        "featured_image" :   { "type" : "string", "default" : "" },
        "read_time"      :   { "type" : "string"},
        "published"      :   { "type" : "boolean"},
        "published_date" :   { "type" : "datetime", "default" : datetime.datetime(1999,1,1,23,59)},
        "voter_ips"      :   { "type" : "list", "default" : [] },
	 "twitter_card"	 :   { "type" : "boolean", "default" : False }
    }

fwfgr

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions