fix:incorrect validMsg when required property doesn't assigned field of 'title' and 'titleEn' (#157)
This commit is contained in:
@@ -19,7 +19,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.networknt</groupId>
|
<groupId>com.networknt</groupId>
|
||||||
<artifactId>json-schema-validator-i18n-support</artifactId>
|
<artifactId>json-schema-validator-i18n-support</artifactId>
|
||||||
<version>1.0.39_4</version>
|
<version>1.0.39_5</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
51
fizz-common/src/test/java/we/util/JsonSchemaUtilsTest.java
Normal file
51
fizz-common/src/test/java/we/util/JsonSchemaUtilsTest.java
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
package we.util;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import we.schema.util.I18nUtils;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.*;
|
||||||
|
|
||||||
|
class JsonSchemaUtilsTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void validateRequiredPropertyWithoutAssignedTitleAndTitleEn() {
|
||||||
|
I18nUtils.setContextLocale(new Locale("zh"));
|
||||||
|
try {
|
||||||
|
List<String> validateList = JsonSchemaUtils.validate(
|
||||||
|
"{\n" +
|
||||||
|
" \"properties\": {\n" +
|
||||||
|
" \"library\": {\n" +
|
||||||
|
" \"type\": \"object\",\n" +
|
||||||
|
" \"required\": [\n" +
|
||||||
|
" \"person\"\n" +
|
||||||
|
" ],\n" +
|
||||||
|
" \"properties\": {\n" +
|
||||||
|
" \"person\": {\n" +
|
||||||
|
" \"type\": \"string\"\n" +
|
||||||
|
" }\n" +
|
||||||
|
" }\n" +
|
||||||
|
" }\n" +
|
||||||
|
" },\n" +
|
||||||
|
" \"required\": [\n" +
|
||||||
|
" \"library\"\n" +
|
||||||
|
" ],\n" +
|
||||||
|
" \"type\": [\n" +
|
||||||
|
" \"object\",\n" +
|
||||||
|
" \"null\"\n" +
|
||||||
|
" ]\n" +
|
||||||
|
"}",
|
||||||
|
"{\n" +
|
||||||
|
" \"library\":{\n" +
|
||||||
|
" }\n" +
|
||||||
|
"}");
|
||||||
|
assertNotNull(validateList);
|
||||||
|
assertEquals(1, validateList.size());
|
||||||
|
assertEquals("person不能为空", validateList.get(0));
|
||||||
|
} finally {
|
||||||
|
I18nUtils.removeContextLocale();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.networknt</groupId>
|
<groupId>com.networknt</groupId>
|
||||||
<artifactId>json-schema-validator-i18n-support</artifactId>
|
<artifactId>json-schema-validator-i18n-support</artifactId>
|
||||||
<version>1.0.39_4</version>
|
<version>1.0.39_5</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
@@ -4,7 +4,7 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>com.networknt</groupId>
|
<groupId>com.networknt</groupId>
|
||||||
<artifactId>json-schema-validator-i18n-support</artifactId>
|
<artifactId>json-schema-validator-i18n-support</artifactId>
|
||||||
<version>1.0.39_4</version>
|
<version>1.0.39_5</version>
|
||||||
<description>POM was created from install:install-file</description>
|
<description>POM was created from install:install-file</description>
|
||||||
<name>JsonSchemaValidator</name>
|
<name>JsonSchemaValidator</name>
|
||||||
<properties>
|
<properties>
|
||||||
@@ -3,10 +3,10 @@
|
|||||||
<groupId>com.networknt</groupId>
|
<groupId>com.networknt</groupId>
|
||||||
<artifactId>json-schema-validator-i18n-support</artifactId>
|
<artifactId>json-schema-validator-i18n-support</artifactId>
|
||||||
<versioning>
|
<versioning>
|
||||||
<release>1.0.39_4</release>
|
<release>1.0.39_5</release>
|
||||||
<versions>
|
<versions>
|
||||||
<version>1.0.39_4</version>
|
<version>1.0.39_5</version>
|
||||||
</versions>
|
</versions>
|
||||||
<lastUpdated>20210420061309</lastUpdated>
|
<lastUpdated>20210430081305</lastUpdated>
|
||||||
</versioning>
|
</versioning>
|
||||||
</metadata>
|
</metadata>
|
||||||
|
|||||||
Reference in New Issue
Block a user