cubos / sdkgen

[ DEPRECATED, SEE https://github.com/sdkgen/sdkgen ] Tool that aims on solving client-server communication and data layout sharing between server, web, android and ios using a description language also called sdkgen.
MIT License
45 stars 9 forks source link

@deprecated flag #4

Open dygufa opened 6 years ago

dygufa commented 6 years ago

Problem: the need to mark methods as deprecated in order to enforce warning on the clients.

Implementation:

@deprecated($message)
get plansWithPrice()

get fullPlans()

If message is set the client will show it otherwise the message will be: "The method getPlansWithPrice is deprecated"

lbguilherme commented 6 years ago

Should it be possible to deprecate a field? Or an optional argument?

vhfmag commented 6 years ago

It seems reasonable, but how the deprecation would be communicated to the targets?

Maybe the deprecation could be informed via documentation, but while JSDoc offers support for documenting function parameters, I don't think it supports object fields. Another option would be to deliver class instances instead of plain JS objects, so that the getter of deprecated fields could warn the developer about it, when not on production mode.

I think Swift and JVM support should be easier.

dygufa commented 6 years ago

I agree that we should have the deprecated flag for fields as well. It could be implemented on the web by using getters and setters.