stoicflame / enunciate

Build-time enhancement tool for Java-based Web services projects
http://enunciate.webcohesion.com/
Other
481 stars 201 forks source link

Refactor PHP client to parse data as actual types #930

Open sbrattla opened 5 years ago

sbrattla commented 5 years ago

The PHP XML client currently parses all data as string. I'd really like it to at least parse boolean values as boolean, but I'm uncertain about the consequences.

If anyone out there use the PHP XML client, they'd might now be doing isAvailable() === 'true', and if I commit a patch for the parser this would turn into a false since isAvailable() would not equal a boolean true with ===.

On the other hand, it's much easier to work with booleans as boolean. That would allow me to do isAvailable() without the explicit === 'true'.

Maybe both variations could be supported by allowing a configurable variable for the PHP XML client module, something like useRealTypes?

Note! I'd be more than happy to contribe with a patch. I'd just like to hear if this could have unforeseen consequences.

What's your thoughts on this @stoicflame?

stoicflame commented 5 years ago

I'm not too concerned about backwards compatibility for the generated client code. I'd say just submit the patch and let people deal with the compatibility issues.

sbrattla commented 5 years ago

Alright!

But, if I wanted to make it configurable, is there a way to inject config variables into a freemarker template (which generates the client)?

Do you work with any particular coding standards in the fmt files by the way (indents etc)? I might try to make the fmt files slightly more readable as well.

Cheers!

On 11. januar 2019 17:24:47 Ryan Heaton notifications@github.com wrote:

I'm not too concerned about backwards compatibility for the generated client code. I'd say just submit the patch and let people deal with the compatibility issues. — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

stoicflame commented 5 years ago

Yes, variables are passed into the freemarker template via the "model" (it's just a map).

See PHPXMLClientModule lines 161-172.