Skip to content

Commit

Permalink
Ensure Kotlin Serialization providers are limited to the proper runti…
Browse files Browse the repository at this point in the history
…me type
  • Loading branch information
geoand committed Jan 7, 2022
1 parent 27f4b85 commit 832a16c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

import java.util.List;

import javax.ws.rs.Priorities;
import javax.ws.rs.RuntimeType;
import javax.ws.rs.core.MediaType;

import io.quarkus.arc.deployment.AdditionalBeanBuildItem;
Expand All @@ -29,10 +31,12 @@ public void additionalProviders(
.setUnremovable().build());
additionalReaders.produce(new MessageBodyReaderBuildItem(
KotlinSerializationMessageBodyReader.class.getName(), Object.class.getName(), List.of(
MediaType.APPLICATION_JSON)));
MediaType.APPLICATION_JSON),
RuntimeType.SERVER, true, Priorities.USER));
additionalWriters.produce(new MessageBodyWriterBuildItem(
KotlinSerializationMessageBodyWriter.class.getName(), Object.class.getName(), List.of(
MediaType.APPLICATION_JSON)));
MediaType.APPLICATION_JSON),
RuntimeType.SERVER, true, Priorities.USER));
}

@BuildStep
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

import java.util.Collections;

import javax.ws.rs.Priorities;
import javax.ws.rs.RuntimeType;
import javax.ws.rs.core.MediaType;

import io.quarkus.arc.deployment.AdditionalBeanBuildItem;
Expand Down Expand Up @@ -34,9 +36,9 @@ void additionalProviders(

additionalReaders
.produce(new MessageBodyReaderBuildItem(ClientKotlinMessageBodyReader.class.getName(), Object.class.getName(),
Collections.singletonList(MediaType.APPLICATION_JSON)));
Collections.singletonList(MediaType.APPLICATION_JSON), RuntimeType.CLIENT, true, Priorities.USER));
additionalWriters
.produce(new MessageBodyWriterBuildItem(ClientKotlinMessageBodyWriter.class.getName(), Object.class.getName(),
Collections.singletonList(MediaType.APPLICATION_JSON)));
Collections.singletonList(MediaType.APPLICATION_JSON), RuntimeType.CLIENT, true, Priorities.USER));
}
}

0 comments on commit 832a16c

Please sign in to comment.