-
Notifications
You must be signed in to change notification settings - Fork 74
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
Misdocumented getting a verticle configuration #187
Comments
You're correct the way verticles work on es4x are slightly different from Java. In Java there's the need to implement an interface in es4x the main script is the "body" of the verticle so the methods You also noticed a bug in the generated type definitions, the generated code "assumes" that the Java type
Which means that returned With vert.x 4 there's a chance that In the meantime if there is a simple type definition of the classes:
A fix would be to update the code generator to issue If you want to contribute I can assist you. The steps are:
|
The just released 0.9.1 version (still being synchronized across the maven repos) updates the
When upstream (vertx-core) supports json types as Map/List then this issue will be solved by itself, for now this is a workaround. Note that the Array fix will only allow exposing the members using the bracket notation but won't have the full Array prototype implemented (no push/shift/etc...) |
Been a few days, did try 0.9.1; Other than that, I don't have any real input here, I'm not using Java arrays enough to say anything on those, but at least people can know objects work just fine now :D |
Context::config() is typed to be a JS object of {[key: string] : any} | null.
It's not, specifically it's a vert.x/JsonObject.
Implicating that doing config.key will return undefined.
Vert.x is nice enough to provide a getValue, as well as an overload to get a default value should the key not exist though.
Worthy note: this Vertx blog post describes just calling "config()", while calling it as a function creates a java exception, "config" is actually a global...
But it's a java object with a string format of {key=value}, so it's essentially useless.
I did try to look into changing this myself, so I could just submit a PR, but honestly I can't make head nor tail out of how the typing generator works, or how to help it.
The text was updated successfully, but these errors were encountered: