mirror of
https://github.com/Dannecron/spring-boot-demo.git
synced 2025-12-25 16:22:35 +03:00
move schema validation to separate package
This commit is contained in:
@@ -1,3 +0,0 @@
|
||||
package com.github.dannecron.demo.core.services.validation.exceptions
|
||||
|
||||
class SchemaNotFoundException: RuntimeException()
|
||||
4
edge-contracts/build.gradle.kts
Normal file
4
edge-contracts/build.gradle.kts
Normal file
@@ -0,0 +1,4 @@
|
||||
dependencies {
|
||||
implementation(rootProject.libs.spring.cloud.stream)
|
||||
implementation(rootProject.libs.json.schema.validator)
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.github.dannecron.demo.core.services.validation
|
||||
package com.github.dannecron.demo.edgecontracts.validation
|
||||
|
||||
import com.github.dannecron.demo.core.services.validation.exceptions.ElementNotValidException
|
||||
import com.github.dannecron.demo.core.services.validation.exceptions.SchemaNotFoundException
|
||||
import com.github.dannecron.demo.edgecontracts.validation.exceptions.ElementNotValidException
|
||||
import com.github.dannecron.demo.edgecontracts.validation.exceptions.SchemaNotFoundException
|
||||
import kotlinx.serialization.json.JsonElement
|
||||
|
||||
interface SchemaValidator {
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.github.dannecron.demo.core.services.validation
|
||||
package com.github.dannecron.demo.edgecontracts.validation
|
||||
|
||||
import com.github.dannecron.demo.core.services.validation.exceptions.ElementNotValidException
|
||||
import com.github.dannecron.demo.core.services.validation.exceptions.SchemaNotFoundException
|
||||
import com.github.dannecron.demo.edgecontracts.validation.exceptions.ElementNotValidException
|
||||
import com.github.dannecron.demo.edgecontracts.validation.exceptions.SchemaNotFoundException
|
||||
import io.github.optimumcode.json.schema.JsonSchema
|
||||
import io.github.optimumcode.json.schema.ValidationError
|
||||
import kotlinx.serialization.json.JsonElement
|
||||
@@ -1,8 +1,7 @@
|
||||
package com.github.dannecron.demo.core.config
|
||||
package com.github.dannecron.demo.edgecontracts.validation.config
|
||||
|
||||
import com.github.dannecron.demo.core.config.properties.ValidationProperties
|
||||
import com.github.dannecron.demo.core.services.validation.SchemaValidator
|
||||
import com.github.dannecron.demo.core.services.validation.SchemaValidatorImp
|
||||
import com.github.dannecron.demo.edgecontracts.validation.SchemaValidator
|
||||
import com.github.dannecron.demo.edgecontracts.validation.SchemaValidatorImp
|
||||
import org.springframework.context.annotation.Bean
|
||||
import org.springframework.context.annotation.Configuration
|
||||
import org.springframework.util.ResourceUtils
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.github.dannecron.demo.core.config.properties
|
||||
package com.github.dannecron.demo.edgecontracts.validation.config
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.github.dannecron.demo.core.services.validation.exceptions
|
||||
package com.github.dannecron.demo.edgecontracts.validation.exceptions
|
||||
|
||||
import io.github.optimumcode.json.schema.ValidationError
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
package com.github.dannecron.demo.edgecontracts.validation.exceptions
|
||||
|
||||
class SchemaNotFoundException: RuntimeException()
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.github.dannecron.demo.core.services.validation
|
||||
package com.github.dannecron.demo.edgecontracts.validation
|
||||
|
||||
import com.github.dannecron.demo.core.services.validation.exceptions.ElementNotValidException
|
||||
import com.github.dannecron.demo.core.services.validation.exceptions.SchemaNotFoundException
|
||||
import com.github.dannecron.demo.edgecontracts.validation.exceptions.ElementNotValidException
|
||||
import com.github.dannecron.demo.edgecontracts.validation.exceptions.SchemaNotFoundException
|
||||
import kotlinx.serialization.json.Json
|
||||
import org.junit.jupiter.params.ParameterizedTest
|
||||
import org.junit.jupiter.params.provider.Arguments
|
||||
@@ -91,6 +91,7 @@ class SchemaValidatorImpTest {
|
||||
)
|
||||
}
|
||||
|
||||
@Suppress("SameParameterValue")
|
||||
private fun getJsonSchema(resourcePath: String) = javaClass.classLoader
|
||||
.getResourceAsStream(resourcePath)!!
|
||||
.readAllBytes()
|
||||
Reference in New Issue
Block a user