by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    juv
    @juv
    @tipsy someone on StackOverflow says that my Java Mockito bug is coming from a missing annotation in the Context class of Javalin. Can you take a look if that makes sense? I'll be happy to open a issue if that is the case. https://stackoverflow.com/questions/61792392/final-kotlin-class-can-not-be-mocked-because-method-should-return-validator -- see the comment from "smac89" in the initial post
    David
    @tipsy
    hmm
    reified methods should be synthetic or mockito might choose the wrong one?
    @juv could you create an issue in the javalin project?
    juv
    @juv
    juv
    @juv
    @tipsy I'm trying out the JitPack master-javalin-3.8.0-gb690a6a-34 build but maven fails with compiling because the OpenAPI plugin is not included - is that intended? Is there a way to add that plugin separately in the POM?
    Error:(24,33) java: package io.javalin.plugin.openapi does not exist
    Basically, all I did is to add the JitPack repository to my pom and change the Javalin dependency:
    <!--<dependency>
          <groupId>io.javalin</groupId>
          <artifactId>javalin</artifactId>
          <version>${javalin.version}</version>
        </dependency>-->
        <dependency>
          <groupId>com.github.tipsy.javalin</groupId>
          <artifactId>javalin</artifactId>
          <version>master-javalin-3.8.0-gb690a6a-34</version>
        </dependency>
    David
    @tipsy
    you need to also add the javalin-openapi dependency
    3.8.0 will introduce dedicated modules for the larger plugins like openapi
    i haven't tested this myself @juv, but i think it should be all good if you add <artifactId>javalin-openapi</artifactId>too (then you can also remove all your other open-api dependencies from your pom)
    juv
    @juv
    @tipsy yup, the build works now. Thanks. My unit test still fails with the version master-javalin-3.8.0-gbe8910b-36. My IntelliJ decompiler does not see the annotation @JvmSynthetic for the header() method of class Context.kt -- not sure if it should. Am I using the correct version/build with master-javalin-3.8.0-gbe8910b-36?
    I went to https://jitpack.io/#tipsy/javalin and took the latest version in tab "Builds"
    The Jitpack log says Start: Wed May 27 07:11:37 UTC 2020 26818da26f7b so in theory it should include the pull request tipsy/javalin#981 from two days ago. Edit: it also mentions the commit/pull request in the log file.
    juv
    @juv
    I'm certain that my environment is using the correct dependency though: https://i.imgur.com/TK97vLL.png
    David
    @tipsy
    so the annotation had no effect?
    it did say it would leave the code, just hide it, so maybe it doesn't matter to mockito
    did you try asking in the kotlin slack?
    juv
    @juv
    @tipsy referring to the imgur link: I can not see the annotation in my IntelliJ when decompiling/"looking at" the Context.kt class. However, I can see other annotations on different methods such as @kotlin.jvm.JvmOverloads and @field:kotlin.jvm.JvmField. I am wondering if I am supposed to see the @JvmSynthetic annotations or not. I have not yet asked in the Kotlin slack, I'll give that a try later
    David
    @tipsy
    ah, i don't really know if they should be visible, i sort of expected them to be
    Ralph J. Steinhagen
    @RalphSteinhagen
    @tipsy had a look into issue #956 (OpenAPI annotation API for Java fields), installed Intellij, learned Kotlin (:smirk:), forked Javalin and prepared a commit that should address this issue (including updated unit-tests) ... since this would be my first PR to Javalin... anything else that need to be done beforehand? Would you be willing to give feedback on the commit?
    David
    @tipsy
    @RalphSteinhagen i already had a sneak peek a few days ago, it looked good
    i'd be happy to give it a more formal review once you make a PR, there's nothing else you have to do beforehand
    Ralph J. Steinhagen
    @RalphSteinhagen
    Burning the midnight oil aye ... ;-)
    OK... will do. Thanks.
    David
    @tipsy
    I'll review sometime before the weekend
    @RalphSteinhagen seems to be broken on java8 though
    Ralph J. Steinhagen
    @RalphSteinhagen
    For 1.8 Ubuntu it fails for the Kotlin field handling that (to my knowledge) I haven't touched either... might be collateral though... which JDK do you use for 1.8?
    It's a pitty... works fine on 'openjdk 11.0.7 2020-04-14'
    David
    @tipsy
    I'll retrigger them
    Ralph J. Steinhagen
    @RalphSteinhagen
    thanks...
    David
    @tipsy
    It uses openjdk, it's defined in the github actions file
    Not at my computer now
    Ralph J. Steinhagen
    @RalphSteinhagen
    Ah.. OK. Probably I shouldn't be either... have a long day tomorrow.
    David
    @tipsy
    This PR isn't going anywhere :)
    Leave it for now, I'll look at what's up with j8 when I review
    Ralph J. Steinhagen
    @RalphSteinhagen
    Thanks, much appreciated!
    juv
    @juv
    @tipsy would it be possible to have a new "official" release - as in not on JitPack - such as version 3.8.1 for the current master branch? I have the feeling that something might be broken in the JitPack build. It does not really make sense that I can see the @kotlin.jvm.JvmOverloads and @field:kotlin.jvm.JvmField in the Context class but the newly added @JvmSynthetic annotations are missing... I've just tried to workaround my mockito problem and start with different unit tests, but same mock error happens with when(context.pathParam("user-id")).thenReturn(userId); and the queryParam method. It makes testing the Javalin classes really complicated :/
    David
    @tipsy
    i think it's very unlikely to be a problem with jitpack, i've used that at work a for long time to depend on javalin
    but i'm hoping to do a new release this weekend or next
    juv
    @juv
    Thanks for your help!
    Cesc Canet
    @canetcesc
    Hi guys, I'm unable to get JavalinJackson to display my fields in SNAKE_CASE
            ObjectMapper objectMapper = JavalinJackson.getObjectMapper();;
            objectMapper.setPropertyNamingStrategy(PropertyNamingStrategy.SNAKE_CASE);
            JavalinJackson.configure(objectMapper);
            Javalin app = Javalin.create().start(7000);
    @JsonNaming(PropertyNamingStrategy.SnakeCaseStrategy.class)
    public class ScannableResource {
    
        @JsonProperty("id")
        private int id;
    
        @JsonProperty("url")
        private String url;
    
        @JsonProperty("name")
        private String name;
    
        @JsonProperty("user_id")
        private String userId;
    
        @JsonProperty("scan_frequency")
        private String scanFrequency;
    is this syntax correct?
    David
    @tipsy
    @canetcesc i would consult the jackson docs, the javalin-wrapper is extremely thin
    the only thing i would do differently in your code is to not get the default mapper from javalin
    ObjectMapper objectMapper = new ObjectMapper();
    objectMapper.setPropertyNamingStrategy(PropertyNamingStrategy.SNAKE_CASE);
    JavalinJackson.configure(objectMapper);
    just to make sure you get exactly what you want