You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
E.g. given locale "de-DE", I am expected to provide a money value like this: "EUR 123,45", which is rejected by the input validation inside the HAL browser (taking the regex from json schema iirc). So either stick to a fixed locale (I was using Locale.US in my PR, and that matches your regex), or remove the regular expression validation.
If you want, I can provide a test case that reproduces the bug.
The text was updated successfully, but these errors were encountered:
I wouldn't mind a fix even! :D I guess there's the fundamental question of how we'd create a proper regex depending on the Locale. The Money API unfortunately doesn't expose that yet so I filed a [ticket](MonetaryAmountFormat should expose regular expression that will match the format) for the JSR.
Not sure what a good workaround in the meantime could look like.
Perfecfly valid choice. But I would question the idea to use locale-specific representations of money values in the API in the first place. There are other options. In my PR I used the root-locale so the format always looks like CurrencyCode + " " + NumberValue, quite easy/stable to parse and use from the client side. Another option could be to separate amount and currency into separate json properties. See zalando-money module: https://github.com/zalando/jackson-datatype-money
There are, but I think if we go the length to return properly i18ned schema, the values should match the locale to. I stopped counting the number of times I was annoyed about software that has a German interface but exposes the rules of the US number formatting on me (dots VS. commas etc.).
It's perfectly fine not to do that, but I guess if one'd like to do that it should work. And even if you go with separated currency and amount, you're still left with the locale dependent formatting of the numbers.
Hi Oliver,
I have to bug you again for the REST API of money values. Polishing of my pull request (specifically https://github.com/olivergierke/spring-restbucks/blob/master/src/main/java/org/springsource/restbucks/JacksonCustomizations.java#L188) introduces LocaleContextHolder.getLocale() to obtain a money parser for a given locale. This does not fit anymore with the other part of the code (lines 123 ff) where you provide a regular expression pattern for the money value.
E.g. given locale "de-DE", I am expected to provide a money value like this: "EUR 123,45", which is rejected by the input validation inside the HAL browser (taking the regex from json schema iirc). So either stick to a fixed locale (I was using Locale.US in my PR, and that matches your regex), or remove the regular expression validation.
If you want, I can provide a test case that reproduces the bug.
The text was updated successfully, but these errors were encountered: