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

Use Core Schema by default as recommended by the YAML specification #390

Merged
merged 1 commit into from
Feb 13, 2025
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 @@ -17,7 +17,7 @@ import it.krzeminski.snakeyaml.engine.kmp.api.ConstructNode
import it.krzeminski.snakeyaml.engine.kmp.nodes.Tag
import it.krzeminski.snakeyaml.engine.kmp.resolver.ScalarResolver

internal val DEFAULT_SCHEMA = JsonSchema()
internal val DEFAULT_SCHEMA = CoreSchema()

krzema12 marked this conversation as resolved.
Show resolved Hide resolved
/**
* Interface to be implemented by any Schema
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import org.junit.jupiter.api.Test;
import it.krzeminski.snakeyaml.engine.kmp.api.LoadSettings.SpecVersionMutator;
import it.krzeminski.snakeyaml.engine.kmp.exceptions.DuplicateKeyException;
import it.krzeminski.snakeyaml.engine.kmp.schema.JsonSchema;
import it.krzeminski.snakeyaml.engine.kmp.schema.CoreSchema;

@Tag("fast")
class LoadSettingsTest {
Expand Down Expand Up @@ -104,10 +104,10 @@ void bufferSize() {
}

@Test
@DisplayName("Use JSON schema by default")
@DisplayName("Use Core schema by default")
void defaultSchema() {
LoadSettings settings = LoadSettings.builder().build();
assertEquals(JsonSchema.class, settings.schema.getClass());
assertEquals(CoreSchema.class, settings.schema.getClass());
}

public enum SomeStatus implements SettingKey {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import it.krzeminski.snakeyaml.engine.kmp.common.ScalarStyle;
import it.krzeminski.snakeyaml.engine.kmp.common.SpecVersion;
import it.krzeminski.snakeyaml.engine.kmp.exceptions.EmitterException;
import it.krzeminski.snakeyaml.engine.kmp.schema.CoreSchema;

import java.util.*;

Expand Down Expand Up @@ -151,6 +152,13 @@ void dumpCustomProperty() {
assertNull(settings.getCustomProperty(new KeyName("None")));
}

@Test
@DisplayName("Use Core schema by default")
void defaultSchema() {
DumpSettings settings = DumpSettings.builder().build();
assertEquals(CoreSchema.class, settings.schema.getClass());
}

static class KeyName implements SettingKey {

private final String keyName;
Expand Down