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

Forward compatibility with SnakeYAML 2.0 #332

Merged
merged 1 commit into from
Jul 20, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
import org.yaml.snakeyaml.LoaderOptions;
import org.yaml.snakeyaml.Yaml;
import org.yaml.snakeyaml.constructor.SafeConstructor;

Expand All @@ -37,7 +38,7 @@
public class Manifests {
private static final String DEFAULT_ENCODING = "UTF-8";

static Yaml yaml = new Yaml(new SafeConstructor());
static Yaml yaml = new Yaml(new SafeConstructor(new LoaderOptions()));
private List<ManifestObject> objects = new ArrayList<ManifestObject>();

/** ManifestObject wrapper that encapsulates an object spec loaded from a supplied manifest. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import org.junit.runner.RunWith;
import org.mockito.Mockito;
import org.mockito.junit.MockitoJUnitRunner;
import org.yaml.snakeyaml.LoaderOptions;
import org.yaml.snakeyaml.Yaml;
import org.yaml.snakeyaml.constructor.SafeConstructor;

Expand Down Expand Up @@ -108,7 +109,7 @@ public void testToYamlReturnsProperly() throws Exception {
}

private static boolean yamlEquals(String expectedYaml, String testYaml) throws IOException {
Yaml yaml = new Yaml(new SafeConstructor());
Yaml yaml = new Yaml(new SafeConstructor(new LoaderOptions()));
Map<String, Object> testConfig = yaml.load(new BufferedReader(new StringReader(testYaml)));
Map<String, Object> expectedConfig =
yaml.load(new BufferedReader(new StringReader(expectedYaml)));
Expand Down