spiral-project / daybed

Form validation and data storage API
http://daybed.rtfd.org/
BSD 3-Clause "New" or "Revised" License
53 stars 8 forks source link

GET model definition should return the required parameter for all fields. #241

Open Natim opened 9 years ago

leplatrem commented 9 years ago

Can you give an example of what you mean here ?

almet commented 9 years ago

Currently when we do a GET on the definition, we cannot tell if the field is required or not.

Natim commented 9 years ago
http GET https://daybed.io/v1/models/todo/definition --auth-type=hawk      --auth='769f36d23f904f1507afc80400553b1271889cabeb975d5193476b00e12f9ab9:

Returns:

{
    "description": "A list of my stuff to do", 
    "fields": [
        {
            "label": "The item", 
            "name": "item", 
            "type": "string"
        }, 
        {
            "choices": [
                "done", 
                "todo"
            ], 
            "label": "is it done or not", 
            "name": "status", 
            "type": "enum"
        }
    ], 
    "title": "todo"
}

Should returns:

{
    "description": "A list of my stuff to do", 
    "fields": [
        {
            "label": "The item", 
            "name": "item", 
            "type": "string",
            "required": true
        }, 
        {
            "choices": [
                "done", 
                "todo"
            ], 
            "label": "is it done or not", 
            "name": "status", 
            "type": "enum",
            "required": true
        }
    ], 
    "title": "todo"
}
leplatrem commented 9 years ago

Then I guess there are not explicitely stored ?

leplatrem commented 9 years ago

I don't reproduce this locally :(

Natim commented 9 years ago

But do you remotely?