Skip to content

Commit

Permalink
remove printlns
Browse files Browse the repository at this point in the history
  • Loading branch information
erosb committed Oct 24, 2023
1 parent 263b19a commit 63e5932
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 23 deletions.
1 change: 0 additions & 1 deletion src/main/kotlin/com/github/erosb/jsonsKema/JsonParser.kt
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,6 @@ class JsonParser {
}
return JsonNumber(value, location)
} catch (ex: NumberFormatException) {
println("$location : $str")
return JsonNumber(BigDecimal(str), location)
}
}
Expand Down
21 changes: 0 additions & 21 deletions src/main/kotlin/com/github/erosb/jsonsKema/SchemaLoader.kt
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ internal data class LoadingState(
) {

fun registerRawSchemaByAnchor(id: String, json: IJsonValue): Knot {
println("register raw schema: id=$id , baseURI=${baseURI}, json=$json")
val anchor = getAnchorByURI(id)
if (anchor.json !== null && anchor.json !== json) {
throw IllegalStateException("raw schema already registered by URI $id")
Expand All @@ -70,13 +69,6 @@ internal data class LoadingState(
fun nextUnresolvedAnchor(): Knot? = anchors.values.find { it.json === null }

fun getAnchorByURI(uri: String): Knot {
if (anchors.get(normalizeUri(uri)) === null) {
if (uri.equals("mem://input#/\$defs/ddd")) {
println("errorka")
}
println("create anchor $uri")
println()
}
return anchors.getOrPut(normalizeUri(uri)) { Knot(
lexicalContextBaseURI = URI(uri)
) }
Expand Down Expand Up @@ -198,7 +190,6 @@ class SchemaLoader(
enterScope(json) {
when (val id = json[Keyword.ID.value]) {
is IJsonString -> {
println("found \$id = $id (baseURI in scope: ${loadingState.baseURI})")
// baseURI is already resolved to child ID
loadingState.registerRawSchemaByAnchor(loadingState.baseURI.toString(), json)
}
Expand Down Expand Up @@ -256,7 +247,6 @@ class SchemaLoader(
} catch (e: java.lang.IllegalArgumentException) {
s = loadingState.baseURI.toString() + ref
}
println("createReferenceSchema baseURI=${loadingState.baseURI} ref=$ref")
val anchor = loadingState.getAnchorByURI(s)
return anchor.createReference(location, s)
}
Expand Down Expand Up @@ -310,30 +300,23 @@ class SchemaLoader(
do {
val knot: Knot? = loadingState.nextLoadableAnchor()
if (knot === null) {
println("no loadable anchor found; trying with next unresolved anchor")
val unresolved: Knot? = loadingState.nextUnresolvedAnchor()
if (unresolved === null) {
break
}
println("start resolving $unresolved")
val pair = resolve(unresolved.referenceSchemas[0])
unresolved.json = pair.first
unresolved.lexicalContextBaseURI = pair.second
println("\tbaseURI = ${unresolved.lexicalContextBaseURI}")
println("\tjson = ${unresolved.json}")
} else {
knot.underLoading = true

val origBaseURI = loadingState.baseURI

knot.lexicalContextBaseURI?.let {
println("SET baseURI := $it")
loadingState.baseURI = it
}
println("baseURI == ${loadingState.baseURI}")
val schema = doLoadSchema(knot.json!!)
loadingState.baseURI = origBaseURI
println("RESET baseURI := ${loadingState.baseURI}")
knot.resolveWith(schema)
knot.underLoading = false
}
Expand All @@ -342,7 +325,6 @@ class SchemaLoader(
}

private fun resolve(referenceSchema: ReferenceSchema): Pair<IJsonValue, URI> {
println("RESOLVE ${referenceSchema.ref}")
val ref = referenceSchema.ref
val uri = parseUri(ref)
val continingRoot: IJsonValue?
Expand Down Expand Up @@ -383,7 +365,6 @@ class SchemaLoader(
return@enterScope Pair(root, loadingState.baseURI)
}
val segment = unescape(segments.poll())
println("lookupNext segment $segment in $root ")
when (root) {
is IJsonObject<*, *> -> {
val child = root[segment]
Expand Down Expand Up @@ -417,7 +398,6 @@ class SchemaLoader(
?: DEFAULT_BASE_URI

return runWithChangedBaseURI(URI(baseURIofRoot)) {
println("START lookupNext baseURI: $baseURIofRoot , $pointer")
lookupNext(root, segments)
}
}
Expand Down Expand Up @@ -448,7 +428,6 @@ class SchemaLoader(
}

private fun createCompositeSchema(schemaJson: IJsonObject<*, *>): Schema {
println("createCompositeSchema for ${loadingState.baseURI} $schemaJson")
val subschemas = mutableSetOf<Schema>()
var title: IJsonString? = null
var description: IJsonString? = null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ class TestSuiteTest {
// "anchor.json",
// "ref.json",
// "id.json",
"refRemote.json",
// "refRemote.json",
).stream()

private val server = JettyWrapper("/test-suite/remotes")
Expand Down

0 comments on commit 63e5932

Please sign in to comment.