Skip to content

Commit

Permalink
Use Core Schema by default as recommended by the YAML specification
Browse files Browse the repository at this point in the history
  • Loading branch information
Vampire committed Feb 12, 2025
1 parent a829841 commit 482a6ac
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
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()

/**
* 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

0 comments on commit 482a6ac

Please sign in to comment.