Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix JSON API #892

Open
ernestask opened this issue Mar 18, 2020 · 0 comments
Open

Fix JSON API #892

ernestask opened this issue Mar 18, 2020 · 0 comments

Comments

@ernestask
Copy link
Collaborator

ernestask commented Mar 18, 2020

It’s just completely nonsensical, because we:

  • try to return JSON-unserializable types:
    solutions=solutions,

    (though for that you can use/extend WebfafJSONEncoder)
  • try to return JSON-unserializable types that don’t make any sense in the context:
    components_form = ProblemComponents()
  • return wildly inconsistent data (null, [null] for the same field, where you would expect [] in case there is no data for an array type)

In short: we should have a well-defined API and not mix endpoints that return JSON or Flask-rendered HTML based on the temperature outside, because we don’t have the tests to verify the correctness (over time as well) and because there should be a clear separation between the backend and web UI, due to its optional nature.

One attempt was #886, but that broke everything and I’ve since discovered that it goes deeper.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant