-
Notifications
You must be signed in to change notification settings - Fork 27
Decouple API resources from internal structures #164
Copy link
Copy link
Open
Labels
Code Cleanup / RefactoringTidying and Making NeatTidying and Making NeatEPICContains several subissuesContains several subissues
Milestone
Description
The API endpoints return internal objects, for example:
The endpoint to get all categories:
http://127.0.0.1:3000/v1/category
returns the struct Category:
pub struct Category {
pub category_id: i64,
pub name: String,
pub num_torrents: i64,
}That's only one example.
That has some problems:
- If you change the internal representation, you can break the API unintentionally.
- You cannot change the API resources and the internal objects independently. For example, it will be harder to implement version 2 for the API.
- In the future, the API resource could contain different data.
- It's harder to mock the API responses if those objects have extra logic, ar nested, etcetera.
We could change it progressively or when we implement the API v2.
Subtasks
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Code Cleanup / RefactoringTidying and Making NeatTidying and Making NeatEPICContains several subissuesContains several subissues
Type
Projects
Status
Maintenance