damnhandy / Handy-URI-Templates

A Java URI Template processor implementing RFC6570

Home Page:https://damnhandy.github.io/Handy-URI-Templates/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot expand an exploded template variable

janbols opened this issue · comments

Using 2.0.4

When creating an exploded VarSpec name "experiment", the object is initialized with a variableName = "experimen" because the last character is substringed away on line 157.

As a result that variable is not expanded in UriTemplate#expandVariables line 592.

As a temporary workaround I can initialize the exploded VarSpec by adding the * to its value like here:

new VarSpec("experiment*", Modifier.EXPLODE, null) 

Sorry, slightly confused. Does this issue occur when expanding a template or when you're calling VarSpec directly? If it is a template issue, do can you provide the template expression you are using and the values you're passing to it?

I have added a test case to help isolate the issue here:

https://github.com/damnhandy/Handy-URI-Templates/blob/master/src/test/java/com/damnhandy/uri/template/impl/TestVarSpec.java

So far, I am not able to get the the behavior you are seeing. If you provide a test case that demonstrates the problem, I'll fix it. I'll leave this open for now but will address it in a future release, after 2.1.0. Please write your test against 2.1.0.

Hi, I added 3 tests (2 failing, 1 succeeding) that show the bug and created a pull request for it.

Best regards
Jan

This is now in the 2.1.2 snapshot

Thank you for the work and for a nice useful library ;-)