-
Notifications
You must be signed in to change notification settings - Fork 191
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
Implemented views with django rest framework and serializers #295
base: master
Are you sure you want to change the base?
Conversation
Would JSON response include |
Yes it does, but I also changed the JSON-Response into a more machine-readable way. {
"data": [
{
"name": "foo",
"status": "working",
"time_taken": 0.001123
},
{
"name": "bar",
"status": "working",
"time_taken": 1.23353e-05
},
{
"name": "foobar",
"status": "failed",
"time_taken": 0.501123
}
]
} The beauty of using serializers is, that you get automatic documentation on your API endpoints. That way it fits the specification of OpenAPI better. I am currently fixing the behavior so that no tests fail because of the changed JSON response, but locally everything works fine. I will mark this pull request as Ready for review as soon as all tests go through |
All test were successful on my forked repository. |
I like the DRF and serializer approach. Good job! But the change to JSON output is a breaking change as the format change is backwards incompatible. How about versioning the API? It could be a query parameter, a header etc. That would allow current users to update the package and their integrations would continue to work without modifications. Currently the JSON output is generated if |
I pushed a new Version with the old tests and API, as well as the serializers approach as v2. It can be addressed by adding /v2 to the end of the URL. However, I can into a problem that I couldn't resolve. Two tests fail (test_success and test_warning) if both, the old testfile (test_views_v1.py) and the new testfile (test_views_v2.py) are tested. Now everything should be backwards compatibel. |
The issue is that both v1 and v2 tests reset Adding following to @classmethod
def setup_class(cls):
cls.registry = plugin_dir._registry.copy()
HEALTH_CHECK['WARNINGS_AS_ERRORS'] = True
@classmethod
def teardown_class(cls):
plugin_dir._registry = cls.registry.copy()
HEALTH_CHECK['WARNINGS_AS_ERRORS'] = True |
Thank you, works like a charm! I need workflow approval to run the tests here, after that everything should be ready to merge (identical Tests went well on my own repository) |
@codingjoe Could you approve the workflow? The PR looks good to me. |
@maszaa @codingjoe Is this PR still considered? |
Hi @JakobJBauer, Thanks for reaching out. To be honest, I am looking for a new maintainer, so I might be a bit slower than usual to respond here. Best, |
Hello @codingjoe The old version is still the default and all tests went through, so there should be no issues regarding backward compatibility. Also, there is no new required dependency, as it only imports new librarys if they are already installed (and enables v2 then). The new version can be addressed by adding 'v2/' into the API request (described in the README.md) |
If you are looking for a new maintainer, maybe JazzBand would take care of this project. They are a group of people that maintain many different projects, but most of them are related to django, so they should already be familiar with most of this project. |
No description provided.