Add web support for Yaml via Jackson
This commit adds support for application/yaml in MediaType and leverages jackson-dataformat-yaml in order to support Yaml in RestTemplate, RestClient and Spring MVC. See gh-32345
This commit is contained in:
committed by
Sébastien Deleuze
parent
246e4977a2
commit
6a8f0d6d7d
@@ -79,6 +79,7 @@ import com.fasterxml.jackson.dataformat.cbor.CBORFactory;
|
||||
import com.fasterxml.jackson.dataformat.smile.SmileFactory;
|
||||
import com.fasterxml.jackson.dataformat.xml.XmlFactory;
|
||||
import com.fasterxml.jackson.dataformat.xml.XmlMapper;
|
||||
import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
|
||||
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
|
||||
import kotlin.ranges.IntRange;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -95,6 +96,7 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException
|
||||
*
|
||||
* @author Sebastien Deleuze
|
||||
* @author Eddú Meléndez
|
||||
* @author Hyoungjune Kim
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
class Jackson2ObjectMapperBuilderTests {
|
||||
@@ -588,6 +590,13 @@ class Jackson2ObjectMapperBuilderTests {
|
||||
assertThat(objectMapper.getFactory().getClass()).isEqualTo(SmileFactory.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
void yaml() {
|
||||
ObjectMapper objectMapper = Jackson2ObjectMapperBuilder.yaml().build();
|
||||
assertThat(objectMapper).isNotNull();
|
||||
assertThat(objectMapper.getFactory().getClass()).isEqualTo(YAMLFactory.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
void visibility() throws JsonProcessingException {
|
||||
ObjectMapper objectMapper = Jackson2ObjectMapperBuilder.json()
|
||||
|
||||
Reference in New Issue
Block a user