raml-javascript-generator icon indicating copy to clipboard operation
raml-javascript-generator copied to clipboard

fix for incorrect property name

Open denisoby opened this issue 8 years ago • 2 comments

Hello, everyone. Thank you for this module, I'm using it for my node JS project.

Recently I've got an error. My api contains url with zero as one of parts:

/api/0/someMethodName

And this causes error, because generated client contains code

this.0

This is correct url, but incorrect JS client code. So I suggest changing client template to safer property addressing through square brackets.

denisoby avatar Aug 16 '17 09:08 denisoby

Thanks a lot. Not sure about the fix since it probably breaks some clients and would need a major release. I think at least.

Can you also add some tests, please?

sichvoge avatar Aug 16 '17 10:08 sichvoge

@sichvoge I've change to example.raml - is enough. Without fix - generated JS is incorrect and will fail all tests.

denisoby avatar Aug 16 '17 11:08 denisoby