Skip to content
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

HTTP interface client ignores @DateTimeFormat on path variable #29095

Closed
dominik-kovacs opened this issue Sep 6, 2022 · 0 comments
Closed

HTTP interface client ignores @DateTimeFormat on path variable #29095

dominik-kovacs opened this issue Sep 6, 2022 · 0 comments
Assignees
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: enhancement A general enhancement
Milestone

Comments

@dominik-kovacs
Copy link

dominik-kovacs commented Sep 6, 2022

Affects: 6.0.0-M5

@DateTimeFormat is not formatting the path variable in the final URL.

example client:

public interface OpenBankingClient {

  @GetExchange("/periods/{token}/{dateFrom}/{dateTo}/transactions.json")
  OpenBankingTransactionsDto fetchTransactionsStatement(
      @PathVariable String token,
      @PathVariable @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate dateFrom,
      @PathVariable @DateTimeFormat(pattern = "yyyy-MM-dd") LocalDate dateTo);
}

client config:

@Configuration
public class RestClientConfig {

  @Bean
  public OpenBankingClient openBankingClient() throws Exception {
    WebClientAdapter webClientAdapter =
            WebClientAdapter.forClient(WebClient.create("https://example.com"));
    HttpServiceProxyFactory httpServiceProxyFactory = new HttpServiceProxyFactory(webClientAdapter);
    httpServiceProxyFactory.afterPropertiesSet();
    return httpServiceProxyFactory.createClient(OpenBankingClient.class);
  }
}

The desired string format of dateTo and dateFrom variables is yyyy-MM-dd.
-- for example, https://example.com/periods/xxx/2022-09-05/2022-09-06/transactions.json

What am I getting is MM/dd/yy (this may vary based on the locale) -- for example, https://example.com/periods/xxx/9%2F5%2F22/9%2F6%2F22/transactions.json

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Sep 6, 2022
@bclozel bclozel added the in: web Issues in web modules (web, webmvc, webflux, websocket) label Sep 7, 2022
@sbrannen sbrannen changed the title HTTP interface client ignoring @DateTimeFormat on path variable HTTP interface client ignores @DateTimeFormat on path variable Sep 7, 2022
@rstoyanchev rstoyanchev self-assigned this Sep 16, 2022
@rstoyanchev rstoyanchev added type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Sep 16, 2022
@rstoyanchev rstoyanchev added this to the 6.0.0-RC1 milestone Sep 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

4 participants