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

MongoDB update #449

Merged
merged 4 commits into from
Jul 6, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
[versions]
micronaut = "4.0.0-RC5"
micronaut-platform = "4.0.0-M4"
micronaut-platform = "4.0.0-M5"
micronaut-docs = "2.0.0"
micronaut-gradle-plugin = "4.0.0-M8"

groovy = "4.0.11"
groovy = "4.0.13"
spock = "2.3-groovy-4.0"
testcontainers = "1.18.3"

managed-mongo = "4.10.1"
managed-mongo-reactive = "4.10.1"

micronaut-micrometer = "5.0.0-M5"
micronaut-serde = "2.0.0-M12"
micronaut-serde = "2.0.0-M13"
micronaut-test = "4.0.0-M9"
micronaut-testresources = "2.0.0-M8"
micronaut-validation = "4.0.0-M11"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import io.micronaut.core.type.Argument;
import io.micronaut.serde.Deserializer;
import io.micronaut.serde.LimitingStream;
import io.micronaut.serde.SerdeRegistry;
import io.micronaut.serde.Serializer;
import io.micronaut.serde.bson.BsonReaderDecoder;
Expand Down Expand Up @@ -73,7 +74,7 @@ class SerdeCodec<T> implements Codec<T> {
@Override
public T decode(BsonReader reader, DecoderContext decoderContext) {
try {
return deserializer.deserialize(new BsonReaderDecoder(reader), this.decoderContext, argument);
return deserializer.deserialize(new BsonReaderDecoder(reader, LimitingStream.DEFAULT_LIMITS), this.decoderContext, argument);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sdelamo Compile was failing without this. The change is introduced in micronaut-projects/micronaut-serialization#496
Maybe they should left default constructor and pass default like this. Not sure if this is correct fix, but there is no config for this currently in mongodb. Maybe @yawkat can advise what is the correct approach here

Copy link
Contributor

@radovanradic radovanradic Jul 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now test is failing because platform includes serde M12 and this change is in M13

} catch (IOException e) {
throw new IllegalStateException("Cannot deserialize: " + type, e);
}
Expand All @@ -82,7 +83,7 @@ public T decode(BsonReader reader, DecoderContext decoderContext) {
@Override
public void encode(BsonWriter writer, T value, EncoderContext encoderContext) {
try {
serializer.serialize(new BsonWriterEncoder(writer), this.encoderContext, argument, value);
serializer.serialize(new BsonWriterEncoder(writer, LimitingStream.DEFAULT_LIMITS), this.encoderContext, argument, value);
} catch (IOException e) {
throw new IllegalStateException("Cannot serialize: " + value, e);
}
Expand Down
9 changes: 9 additions & 0 deletions tests/mongo-serde/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,16 @@ plugins {
id "io.micronaut.build.internal.mongodb-functional-test"
}

micronaut {
importMicronautPlatform = false
}

dependencies {
micronautBoms(
sdelamo marked this conversation as resolved.
Show resolved Hide resolved
platform(mn.micronaut.core.bom),
platform(mnTest.micronaut.test.bom),
platform("io.micronaut.serde:micronaut-serde-bom:${libs.versions.micronaut.serde.get()}")
)
annotationProcessor mnSerde.micronaut.serde.processor

implementation projects.micronautMongoSync
Expand Down