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
The API endpoints return internal objects, for example:
The endpoint to get all categories:
http://127.0.0.1:3000/v1/categoryreturns the struct Category:
That's only one example.
That has some problems:
We could change it progressively or when we implement the API v2.
Subtasks
Categoryfrom internal DB structures #501