Skip to content
This repository has been archived by the owner on Feb 22, 2023. It is now read-only.

[Feature] API code quality improvements #181

Closed
5 of 6 tasks
dhruvkb opened this issue Aug 16, 2021 · 0 comments · Fixed by #194
Closed
5 of 6 tasks

[Feature] API code quality improvements #181

dhruvkb opened this issue Aug 16, 2021 · 0 comments · Fixed by #194
Assignees
Labels
💻 aspect: code Concerns the software code in the repository 🤖 aspect: dx Concerns developers' experience with the codebase 🧰 goal: internal improvement Improvement that benefits maintainers, not users 🟩 priority: low Low priority and doesn't need to be rushed 🏁 status: ready for work Ready for work

Comments

@dhruvkb
Copy link
Member

dhruvkb commented Aug 16, 2021

Problem

The API server can use some refactoring and code quality improvements in a lot of places for a smoother development experience. This is a task list to collect a bunch of ways to improve code quality in the Openverse API codebase.

  • 1. Using DRF generic views, viewsets and routers wherever possible instead of the lower level APIView.

🚫 2. Documenting API responses dynamically generated using serializers for ensuring they stay up to date with the actual output. (Blocked as serializers need requests in the context)

  • 3. Standardising error messages and responses, ensuring 100% JSON responses even for error scenarios.
  • 4. Keeping constants and magic values outside the logic and code. This helps when extending code for mode media types and functionalities.
  • 5. Generate hyperlinks based on the current protocol and domain, instead of hardcoding 'https://' in some places which doesn't work for dev envs
  • 6. Type hint all SerializerMethodFields so that the correct data type is shown in the Swagger API docs.

Additional context

Preferably make individual atomic PRs addressing one issue at a time, so that they can be reviewed and merged faster.

Implementation

  • 🙋 I would be interested in implementing this feature.
@dhruvkb dhruvkb added 🟩 priority: low Low priority and doesn't need to be rushed 🏁 status: ready for work Ready for work 💻 aspect: code Concerns the software code in the repository 🤖 aspect: dx Concerns developers' experience with the codebase python 🧰 goal: internal improvement Improvement that benefits maintainers, not users labels Aug 16, 2021
@dhruvkb dhruvkb self-assigned this Aug 31, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
💻 aspect: code Concerns the software code in the repository 🤖 aspect: dx Concerns developers' experience with the codebase 🧰 goal: internal improvement Improvement that benefits maintainers, not users 🟩 priority: low Low priority and doesn't need to be rushed 🏁 status: ready for work Ready for work
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant