https://linen.dev logo
#general
Title
# general
t

Tom

11/20/2023, 1:03 PM
Is there any reason it’s more complicated for you than to just do this?
Copy code
Json.write( get(urlPathMatching("/the/.*/one"))
                .andMatching("path-contains-param", Parameters.one("path", "correct"))
                .willReturn(ok())
                .build())
b

Balog Tamás

11/20/2023, 1:24 PM
The plan is/was to see if the conversion could happen from static code (not runtime object instances), and also to find out if there is a reason to implement it in the first place. But, yeah, you are right, it looks quite straightforward and way easier to do what you've just sent. And I've just realized that I didn't account for the fact the a mapping created in Java may produce multiple JSON stub mappings depending on how it is used and how it parametrized.
One additional detail: the reason I was also thinking about such a conversion is to be able to generate IntelliJ HTTP Client requests (at leasts some sort of live templates) via a line marker icon that I already have for some of the Admin API endpoints. And I might be able to use
Json.write()
there too.
t

Tom

11/20/2023, 2:04 PM
OK, so you’d click the line marker in a piece of code and it’d give you an HTTP request formed according to the bit of DSL you marked?
b

Balog Tamás

11/20/2023, 2:06 PM
Yes. request method, url, body, headers, etc., in the HTTP Client plugin's format. (At the moment, in only that format.)