Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
7dc6105
Add schema-test-suite repository as submodule
OptimumCode Jul 25, 2023
c283dee
Move schema test suites
OptimumCode Jul 26, 2023
616e33f
Implement test suites base. Add test suite for draft7
OptimumCode Jul 26, 2023
62370a0
Init submodules
OptimumCode Jul 26, 2023
646a59b
Correct the equailty check for numbers
OptimumCode Jul 26, 2023
9dbc2a7
Correct enum assertion to correctly work with numbers
OptimumCode Jul 26, 2023
2613504
Correct type to correctly treat numbers with zero fraction part as in…
OptimumCode Jul 26, 2023
09d449d
Handle engineering number format
OptimumCode Jul 26, 2023
27fcd20
Treat numbers with zero fraction as valid integers
OptimumCode Jul 26, 2023
6a9107a
Correct unique items assertion to correctly work with numbers
OptimumCode Jul 26, 2023
c6b2ce3
Correct multipleOf assertion to work with small numbers
OptimumCode Jul 26, 2023
a91d079
Correct number comparison
OptimumCode Jul 26, 2023
26d43d4
Reformat code. Correct detekt errors
OptimumCode Jul 26, 2023
dd1d149
Fix incorrect precision computation
OptimumCode Jul 26, 2023
ff1ce0a
Use linked maps to keep reproducable order
OptimumCode Jul 27, 2023
e62c586
Exclude unsupported functionality from test-suites
OptimumCode Jul 27, 2023
640f122
Add proper support for unicode characters
OptimumCode Jul 27, 2023
9fa6d4d
Load all if-then-else assertions because they might be referenced
OptimumCode Jul 27, 2023
e501479
Correct work with empty path segment in JSON pointer
OptimumCode Jul 27, 2023
f5174a6
Add quotation for special characters when adding segment to pointer
OptimumCode Jul 27, 2023
2fc0a7b
Correct uri resolution
OptimumCode Jul 28, 2023
a8ab2e6
Add resolution for test suites for nodejs test run
OptimumCode Jul 28, 2023
8b2156c
Remove todo comment. Create an issue for that instead
OptimumCode Jul 28, 2023
b667649
Correct test name to correctly work on windows
OptimumCode Jul 28, 2023
a663df4
Correct formatting
OptimumCode Jul 28, 2023
ea6828a
Use chars instead of string for quotation
OptimumCode Jul 28, 2023
7036f8a
Add note about test suite compliance
OptimumCode Jul 28, 2023
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Reformat code. Correct detekt errors
  • Loading branch information
OptimumCode committed Jul 26, 2023
commit 26d43d4d6ceb3540119d794c96e3a3be1110bc4d
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ private class UniqueItemsAssertion(
objectPath = context.objectPath,
message = "array contains duplicate values: ${
duplicates?.joinToString(
prefix = "[",
postfix = "]",
separator = ",",
)
prefix = "[",
postfix = "]",
separator = ",",
)
}",
),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import kotlinx.serialization.json.JsonElement
import kotlinx.serialization.json.JsonPrimitive
import kotlinx.serialization.json.doubleOrNull
import kotlinx.serialization.json.longOrNull
import kotlin.math.absoluteValue
import kotlin.math.floor
import kotlin.math.log10
import kotlin.math.max
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import kotlinx.serialization.json.JsonNull
import kotlinx.serialization.json.JsonObject
import kotlinx.serialization.json.JsonPrimitive
import kotlinx.serialization.json.booleanOrNull
import kotlinx.serialization.json.double
import kotlinx.serialization.json.jsonArray
import kotlinx.serialization.json.jsonObject
import kotlinx.serialization.json.jsonPrimitive
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ internal fun parseNumberParts(element: JsonPrimitive): NumberParts? {

private const val E_SMALL_CHAR: Char = 'e'
private const val E_BIG_CHAR: Char = 'E'
private const val TEN: Double = 10.0

/**
* This function should be used only if you are certain that the [element] is a number
Expand All @@ -32,7 +33,7 @@ internal fun numberParts(element: JsonPrimitive): NumberParts {
var precision = 0
var fractionalPart = rem(1.0).absoluteValue
while (fractionalPart % 1.0 > 0) {
fractionalPart *= 10.0
fractionalPart *= TEN
precision += 1
}
NumberParts(toLong(), fractionalPart.toLong(), precision)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
package io.github.optimumcode.json.schema.assertions.number

import io.github.optimumcode.json.pointer.JsonPointer
import io.github.optimumcode.json.schema.ErrorCollector
import io.github.optimumcode.json.schema.ErrorCollector.Companion
import io.github.optimumcode.json.schema.JsonSchema
import io.github.optimumcode.json.schema.ValidationError
import io.github.optimumcode.json.schema.base.KEY
import io.kotest.assertions.throwables.shouldThrow
import io.kotest.core.spec.style.FunSpec
import io.kotest.core.test.TestScope
import io.kotest.matchers.collections.shouldContainExactly
import io.kotest.matchers.collections.shouldHaveSize
import io.kotest.matchers.shouldBe
Expand Down Expand Up @@ -169,7 +166,7 @@ class JsonSchemaMultipleOfValidationTest : FunSpec() {
schemaPath = JsonPointer("/multipleOf"),
objectPath = JsonPointer.ROOT,
message = "$it is not a multiple of 0.0001",
)
),
)
}
}
Expand Down