Skip to content

Increase deprecation level to warning #252

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

Merged
merged 1 commit into from
Feb 8, 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 @@ -48,7 +48,7 @@ public interface JsonSchemaLoader {

@Deprecated(
message = "This method will be removed in a future release. Please use the alternative that accepts Uri type",
level = DeprecationLevel.WARNING,
level = DeprecationLevel.ERROR,
replaceWith =
ReplaceWith(
imports = ["com.eygraber.uri.Uri"],
Expand All @@ -67,7 +67,7 @@ public interface JsonSchemaLoader {

@Deprecated(
message = "This method will be removed in a future release. Please use the alternative that accepts Uri type",
level = DeprecationLevel.WARNING,
level = DeprecationLevel.ERROR,
replaceWith =
ReplaceWith(
imports = ["com.eygraber.uri.Uri"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import io.github.optimumcode.json.schema.ErrorCollector
import io.github.optimumcode.json.schema.ExperimentalApi
import io.github.optimumcode.json.schema.internal.wrapper.JsonWrapper
import io.github.optimumcode.json.schema.model.AbstractElement
import kotlinx.serialization.json.JsonElement

Expand Down Expand Up @@ -36,24 +35,15 @@
element: AbstractElement,
context: ExternalAssertionContext,
errorCollector: ErrorCollector,
): Boolean =
// TODO: remove it after two minor/major release
validate(element.unwrap(), context, errorCollector)
): Boolean = throw NotImplementedError("please override the method in your implementation")

Check warning on line 38 in json-schema-validator/src/commonMain/kotlin/io/github/optimumcode/json/schema/extension/ExternalAssertion.kt

View check run for this annotation

Codecov / codecov/patch

json-schema-validator/src/commonMain/kotlin/io/github/optimumcode/json/schema/extension/ExternalAssertion.kt#L38

Added line #L38 was not covered by tests

// TODO: increase level to error in the next release
@Deprecated(
message = "override validate(AbstractElement, ExternalAssertionContext, ErrorCollector) instead",
level = DeprecationLevel.WARNING,
level = DeprecationLevel.ERROR,
)
public fun validate(
element: JsonElement,
context: ExternalAssertionContext,
errorCollector: ErrorCollector,
): Boolean = throw UnsupportedOperationException()
}

internal fun AbstractElement.unwrap(): JsonElement =
when (this) {
is JsonWrapper -> unwrap()
else -> error("unsupported element type: ${this::class.simpleName}")
}
): Boolean = throw UnsupportedOperationException("please use validate method with AbstractElement parameter")
}
Loading