danielwerg / r6api.js

🍫 Node.js wrapper around Rainbow Six Siege APIs
https://npm.im/r6api.js
MIT License
109 stars 19 forks source link

Unexpected behavior from "structureChange" function in "methods.ts" #38

Closed danielwerg closed 4 years ago

danielwerg commented 4 years ago

<getStatus>.maintenance value changed from null to false which caused "structureChange" function to return true.

https://github.com/danielwerg/r6api.js/commit/2ed937327bcb676c4158b8b903b9333af7c77c93 https://github.com/danielwerg/r6api.js/runs/1147076465

EndBug commented 4 years ago

Hmm, I see how that would happen: null has an object type, while false is boolean. That technically is a structure change... The point is that the script doesn't check the types against our typings for the responses, but it only checks if they changed: it has no way to know that maintenance is supposed to be null | boolean. If we wanted to make it that way we would need to have a utility function for every method that can return whether a value corresponds to our interface: if it is still the same type we don't need to update anything, if it changed the types need to be updated manually in the source code, because it means we've done something wrong...

danielwerg commented 4 years ago

That's probably too much work for a simple outcome

EndBug commented 4 years ago

Ok, I'll close the issue for now