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

14 dates default output format causes deserialization error #24

Merged

Conversation

jemacineiras
Copy link
Contributor

No description provided.

@jemacineiras jemacineiras added enhancement New feature or request release Trigger a release labels Nov 9, 2023
@jemacineiras jemacineiras requested a review from apenlor November 9, 2023 17:26
@jemacineiras jemacineiras self-assigned this Nov 9, 2023
@jemacineiras jemacineiras linked an issue Nov 9, 2023 that may be closed by this pull request
@jemacineiras jemacineiras marked this pull request as draft November 9, 2023 17:31
@jemacineiras jemacineiras marked this pull request as ready for review November 9, 2023 22:09
Copy link

github-actions bot commented Nov 9, 2023

This pull request hasn't been labeled as release, gradle, maven nor documentation. Please ensure this is intentional before merging.

@apenlor
Copy link
Contributor

apenlor commented Nov 9, 2023

Testing the new versión, I'm facing the following issues:

@PactDslBodyBuilder
public class Student {
    
    @Example("Sep 27, 2023, 11:02:00 AM")
    private Date init;

}
public class StudentBuilder {
      java.util.Date init = Date.from(Instant.parse("2023-09-27T11:02:00-04:00"));

  public StudentBuilder setInit(final java.util.Date init) {
    this.init = init;
    return this;
  }

    public DslPart build() {
        PactDslJsonBody pactDslJsonBody = new PactDslJsonBody();
      if (Objects.nonNull(init)) {
          pactDslJsonBody.date("init", init); //---> THIS LINE: java: no suitable method found for date(java.lang.String,java.util.Date)
      }

        return pactDslJsonBody;
    }

    private static void applyCustomModifiers(PactDslJsonBody pactDslJsonBody) throws ClassNotFoundException, InstantiationException, IllegalAccessException {
    }

}

And regarding ZoneDateTime:

@PactDslBodyBuilder
public class Student {

    @Example("2023-12-03T10:15:30+01:00[Europe/Madrid]")
    private ZonedDateTime date;

}
public class StudentBuilder {

  public StudentBuilder setDate(final java.time.ZonedDateTime date) {
    this.date = date; //-->> THIS LINE: cannot resolve symbol date
    return this;
  }

    public DslPart build() {
        PactDslJsonBody pactDslJsonBody = new PactDslJsonBody();
      if (Objects.nonNull(date)) { //-->> THIS LINE: cannot resolve symbol date
          pactDslJsonBody.datetime("date", date); //-->> THIS LINE: cannot resolve symbol date
      }

        return pactDslJsonBody;
    }

    private static void applyCustomModifiers(PactDslJsonBody pactDslJsonBody) throws ClassNotFoundException, InstantiationException, IllegalAccessException {
    }

}

Tested in a project with

        <dependency>
            <groupId>au.com.dius.pact.consumer</groupId>
            <artifactId>junit5</artifactId>
            <version>4.6.3</version>
            <scope>test</scope>
        </dependency>

@jemacineiras jemacineiras marked this pull request as draft November 10, 2023 07:04
@apenlor apenlor requested a review from tfdsimoes November 15, 2023 17:28
@apenlor apenlor linked an issue Nov 22, 2023 that may be closed by this pull request
@jemacineiras jemacineiras marked this pull request as ready for review November 22, 2023 17:15
jemacineiras and others added 16 commits November 22, 2023 23:09
…alization-error

# Conflicts:
#	src/main/java/com/sngular/annotation/processor/PactDslProcessor.java
#	src/main/java/com/sngular/annotation/processor/mapping/ByteMapping.java
#	src/main/java/com/sngular/annotation/processor/mapping/DecimalMapping.java
#	src/main/java/com/sngular/annotation/processor/mapping/IntegerMapping.java
#	src/main/java/com/sngular/annotation/processor/mapping/LongMapping.java
#	src/main/java/com/sngular/annotation/processor/mapping/ShortMapping.java
#	src/main/resources/templates/templateDslBuilder.ftlh
…alization-error

# Conflicts:
#	README.md
#	pom.xml
#	src/main/java/com/sngular/annotation/processor/PactDslProcessor.java
#	src/main/java/com/sngular/annotation/processor/mapping/ShortMapping.java
#	src/main/resources/templates/templateDslBuilder.ftlh
…auses-deserialization-error' into 14-dates-default-output-format-causes-deserialization-error

# Conflicts:
#	src/test/resources/basic/CharacterDataTypesBuilder.java
#	src/test/resources/basic/NumericDataTypesBuilder.java
#	src/test/resources/date/DateDataTypesBuilder.java
#	src/test/resources/random/NumericDataTypesBuilder.java
…alization-error

# Conflicts:
#	pom.xml
#	src/main/java/com/sngular/annotation/processor/mapping/ByteMapping.java
#	src/main/java/com/sngular/annotation/processor/mapping/DoubleMapping.java
#	src/main/java/com/sngular/annotation/processor/mapping/IntegerMapping.java
#	src/main/java/com/sngular/annotation/processor/mapping/LongMapping.java
#	src/main/java/com/sngular/annotation/processor/mapping/ShortMapping.java
@jemacineiras jemacineiras merged commit 7f64a90 into main Jan 8, 2024
5 checks passed
@jemacineiras jemacineiras deleted the 14-dates-default-output-format-causes-deserialization-error branch January 8, 2024 15:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request release Trigger a release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Dates default output format causes deserialization error Support custom format definition for date types
2 participants