jfinkels / flask-restless

NO LONGER MAINTAINED - A Flask extension for creating simple ReSTful JSON APIs from SQLAlchemy models.
https://flask-restless.readthedocs.io
GNU Affero General Public License v3.0
1.02k stars 301 forks source link

added the info in meta/urls for now #627

Closed tarekziade closed 7 years ago

tarekziade commented 7 years ago

This is for #625

before I go further and add some tests in the PR, I would like to know where the data should land. I am unclear wether you want to split things around links/urls/relationships or have everything groups per model

Thanks

jfinkels commented 7 years ago

I think the data should probably look like

{
  "meta": {
    "modelinfo": {
      "person": {
        "url": "...",
        "primarykey": "..."
      },
      "article": {
        "url": "...",
        "primarykey": "...",
      }
    }
  }
}

The keys in the modelinfo object should be the collection_name(model), don't expose the table name. Similarly, use the primary_key_for(model) helper function. This way, we respect the user's choices as specified in the APIManager.create_api() call.

Thanks!

jfinkels commented 7 years ago

I have uploaded a working version of this in pull request #640 so I'm closing this one.