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

[1.0.0b1] Multiple endpoints for one model overrides randomly #668

Closed lennartblom closed 4 years ago

lennartblom commented 6 years ago

Currently I have the given scenario: I have one complexe model, which I want to publish on a suitable url endpoint.This works like a charm! Thanks for that!

Given the complexity of the model and the use case that I need only one attribute of the model sometimes, I defined a new url endpoint for the retrievement of just the attribute (with help of the only=[”attribute_name"])

Route for the overall model

api_manater.create_api(
    model=entities.User,
    methods=['GET', 'POST', 'PATCH'],
    primary_key="id",
    collection_name="users",
)

Route for the one attribute only model

api_manater.create_api(
    model=entities.User,
    methods=['GET'],
    primary_key="id",
    collection_name="user_email_validations"
    only=[”email_validated"]
)

So after this the results of endpoints "localhost/api/users" and localhost/api/user_email_validations" randomly switch from either all attributes or just the defined email_validated.

Is the usage with multiple endpoints for one SQLAlchemy model not wanted? Or did I miss something?

Thank in advance and thanks for the package anyway!