-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Asset PATCH API returns invalid assigned_to value & type in payload then GET #9427
Comments
There is an I agree that more information being returned on the patch and delete methods would be nice though. |
Yes but these are internal declarations that shouldn't be exposed. Even worse, the API itself doesn't use what is specified in the documentation and diverges from your scheme at another section: The report part of the API is a total mess. You don't provide a So parts of the API are a total mess, please unify asset objects returned or leave those fields at least blank. (It doesn't make that much sense to return assigned_to when you're not supposed to set the field via PATCH, see down below.) PATCHing the Last but not least: The activity report API returns localized values for the action type of history entries, giving you structures like these: pub enum ActionType {
#[serde(rename = "aktualisieren")]
Update,
#[serde(rename = "herausgeben")]
Checkout,
#[serde(rename = "hinzufügen")]
Add,
#[serde(rename = "zurücknehmen von")]
Checkin,
#[serde(rename = "hochgeladen")]
Upload,
} It's a mess to deserialize Assets if PATCH and GET return different structures about the same values, making it impossible in some languages to use a unified Object as deserialization target. |
Another error in the API docs: it's |
Please confirm you have done the following before posting your bug report:
Describe the bug
The patch API for assets reports the
assigned_to
field only as a number that could be anything.Meanwhile the normal assets GET API returns
assigned_to
as an object that describes also what kind of ID we're looking at.The further implication is that parsing an Asset is not only different between a PATCH and a GET but the returned data for a PATCH makes no sense as we get an anonymous ID.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Asset object has the same kind of
assigned_to
field.Screenshots
Server (please complete the following information):
What you can also see is that some other fields are reported as either NULL or "" depending on whether its a PATCH payload or a GET response. Changing this would probably require a V2 of the API. Either way its a real pain to parse and requires an additional API request if you want to use the updated Asset and want to use snipeit as source of truth.
The text was updated successfully, but these errors were encountered: