andrewvy / chrome-remote-interface

Elixir Client for the Chrome Debugger Protocol
https://hexdocs.pm/chrome_remote_interface
66 stars 30 forks source link

Log usage of deprecated APIs #23

Open andrewvy opened 6 years ago

andrewvy commented 6 years ago

If usage of a deprecated API function call is detected, we should log out the deprecation message:

{
    "name": "addScriptToEvaluateOnLoad",
    "parameters": [
        {
            "name": "scriptSource",
            "type": "string"
        }
    ],
    "returns": [
        {
            "name": "identifier",
            "$ref": "ScriptIdentifier",
            "description": "Identifier of the added script."
        }
    ],
    "deprecated": true,
    "description": "Deprecated, please use addScriptToEvaluateOnNewDocument instead.",
    "experimental": true
}

Here, we can parse out the deprecated boolean attribute and log out the description.

bcardarella commented 6 years ago

It would be great if the generated code was smart enough to conditionally log if the command had a deprecation. In other words, unnecessary bytes shouldn't be present in generated functions for commands that don't have deprecations.