Comments (9)
When you first posted the changes with OpenApi30
weren't in any release yet. You can now try 1.4.2
.
from json-schema-validator.
Hi
I tried:
And json data is in invalid:
{ "event": { "commonEventHeader": { "version": "4", "vesEventListenerVersion": 7, "domain": "fault", "eventId": "stndDefined-gNB_Nokia000001", "eventName": "stndDefined-gNB-Nokia-PowerLost", "stndDefinedNamespace": "3GPP-FaultSupervision", "startEpochMicrosec": 1413378172000000, "lastEpochMicrosec": 1413378172000000, "reportingEntityName": "ibcx0001vm002oam001", "sourceName": "scfx0001vm002cap001", "sequence": 1, "priority": "High" }, "stndDefinedFields": { "schemaReference": "http://localhost:8080/external1#components/schemas/NotifyNewAlarm", "data": { "href": 1, "uri": "1", "notificationId": 1, "notificationType": "notifyNewAlarm", "eventTime": "xyz", "systemDN": "xyz", "probableCause": 1, "perceivedSeverity": "INDETERMINATE", "rootCauseIndicator": false, "specificProblem": "xyz", "correlatedNotifications": [], "backedUpStatus": true, "backUpObject": "xyz", "trendIndication": "MORE_SEVERE", "thresholdInfo": { "observedMeasurement": "new", "observedValue": 123 }, "stateChangeDefinition": { }, "monitoredAttributes": { "newAtt": "new" }, "proposedRepairActions": "xyz", "additionalText": "xyz", "additionalInformation": { "addInfo": "new" }, "alarmId": 1, "alarmType": "COMMUNICATIONS_ALARM_INVALID" }, "stndDefinedFieldsVersion": "1.0" } } }
but there are no errors.
from json-schema-validator.
I can't tell what is the file you are loading for the schema. You will need to supply a junit reproducer if you really think there is an issue.
from json-schema-validator.
from json-schema-validator.
This is schema used:
from json-schema-validator.
While I see an issue with a schema location with a #
in the fragment and a possible issue with discriminators, I don't see your issue. You will need to supply a more complete reproduction of the issue.
package com.networknt.schema;
import org.junit.jupiter.api.Test;
import com.networknt.schema.SpecVersion.VersionFlag;
import com.networknt.schema.oas.OpenApi30;
public class Issue1069Test {
@Test
void test() {
JsonSchema schema = JsonSchemaFactory
.getInstance(VersionFlag.V202012,
builder -> builder.metaSchema(OpenApi30.getInstance())
.defaultMetaSchemaIri(OpenApi30.getInstance().getIri()))
.getSchema(SchemaLocation.of(
"https://forge.3gpp.org/rep/sa5/MnS/-/raw/Integration_Rel16_SA5_155_YAML/OpenAPI/TS28532_FaultMnS.yaml#/components/schemas/NotifyNewAlarm"),
SchemaValidatorsConfig.builder().build());
String inputData = "{\r\n"
+ " \"event\": {\r\n"
+ " \"commonEventHeader\": {\r\n"
+ " \"version\": \"4\",\r\n"
+ " \"vesEventListenerVersion\": 7,\r\n"
+ " \"domain\": \"fault\",\r\n"
+ " \"eventId\": \"stndDefined-gNB_Nokia000001\",\r\n"
+ " \"eventName\": \"stndDefined-gNB-Nokia-PowerLost\",\r\n"
+ " \"stndDefinedNamespace\": \"3GPP-FaultSupervision\",\r\n"
+ " \"startEpochMicrosec\": 1413378172000000,\r\n"
+ " \"lastEpochMicrosec\": 1413378172000000,\r\n"
+ " \"reportingEntityName\": \"ibcx0001vm002oam001\",\r\n"
+ " \"sourceName\": \"scfx0001vm002cap001\",\r\n"
+ " \"sequence\": 1,\r\n"
+ " \"priority\": \"High\"\r\n"
+ " },\r\n"
+ " \"stndDefinedFields\": {\r\n"
+ " \"schemaReference\": \"http://localhost:8080/external1#components/schemas/NotifyNewAlarm\",\r\n"
+ " \"data\": {\r\n"
+ " \"href\": 1,\r\n"
+ " \"uri\": \"1\",\r\n"
+ " \"notificationId\": 1,\r\n"
+ " \"notificationType\": \"notifyNewAlarm\",\r\n"
+ " \"eventTime\": \"xyz\",\r\n"
+ " \"systemDN\": \"xyz\",\r\n"
+ " \"probableCause\": 1,\r\n"
+ " \"perceivedSeverity\": \"INDETERMINATE\",\r\n"
+ " \"rootCauseIndicator\": false,\r\n"
+ " \"specificProblem\": \"xyz\",\r\n"
+ " \"correlatedNotifications\": [],\r\n"
+ " \"backedUpStatus\": true,\r\n"
+ " \"backUpObject\": \"xyz\",\r\n"
+ " \"trendIndication\": \"MORE_SEVERE\",\r\n"
+ " \"thresholdInfo\": {\r\n"
+ " \"observedMeasurement\": \"new\",\r\n"
+ " \"observedValue\": 123\r\n"
+ " },\r\n"
+ " \"stateChangeDefinition\": {},\r\n"
+ " \"monitoredAttributes\": {\r\n"
+ " \"newAtt\": \"new\"\r\n"
+ " },\r\n"
+ " \"proposedRepairActions\": \"xyz\",\r\n"
+ " \"additionalText\": \"xyz\",\r\n"
+ " \"additionalInformation\": {\r\n"
+ " \"addInfo\": \"new\"\r\n"
+ " },\r\n"
+ " \"alarmId\": 1,\r\n"
+ " \"alarmType\": \"COMMUNICATIONS_ALARM_INVALID\"\r\n"
+ " },\r\n"
+ " \"stndDefinedFieldsVersion\": \"1.0\"\r\n"
+ " }\r\n"
+ " }\r\n"
+ "}";
System.out.println(schema.validate(inputData, InputFormat.JSON, OutputFormat.HIERARCHICAL));
}
}
{
"valid" : false,
"evaluationPath" : "",
"schemaLocation" : "https://forge.3gpp.org/rep/sa5/MnS/-/raw/Integration_Rel16_SA5_155_YAML/OpenAPI/TS28532_FaultMnS.yaml#/components/schemas/NotifyNewAlarm",
"instanceLocation" : "",
"details" : [ {
"valid" : false,
"evaluationPath" : "/components/schemas/NotifyNewAlarm/allOf/0/$ref",
"schemaLocation" : "https://forge.3gpp.org/rep/sa5/MnS/-/raw/Integration_Rel16_SA5_155_YAML/OpenAPI/TS28623_ComDefs.yaml#/components/schemas/NotificationHeader",
"instanceLocation" : "",
"errors" : {
"required" : [ "required property 'href' not found", "required property 'notificationId' not found", "required property 'notificationType' not found", "required property 'eventTime' not found", "required property 'systemDN' not found" ]
}
}, {
"valid" : false,
"evaluationPath" : "/components/schemas/NotifyNewAlarm/allOf/1",
"schemaLocation" : "https://forge.3gpp.org/rep/sa5/MnS/-/raw/Integration_Rel16_SA5_155_YAML/OpenAPI/TS28532_FaultMnS.yaml#/components/schemas/NotifyNewAlarm/allOf/1",
"instanceLocation" : "",
"errors" : {
"required" : [ "required property 'alarmId' not found", "required property 'alarmType' not found", "required property 'probableCause' not found", "required property 'perceivedSeverity' not found" ]
}
} ]
}
from json-schema-validator.
@justin-tay I think it could be what I add to SchemaLocation.of()
I use file:/C:/Users/userid/..../
Is this what I should use in the first mentioned method or is there an alternative to my locally stored file?
from json-schema-validator.
I have tried with both a file
and classpath
iri and see no issue.
from json-schema-validator.
thx
from json-schema-validator.
Related Issues (20)
- Add an option to toggle debug message HOT 1
- Impossible to construct a SchemaLocation containing a json pointer with an escaped fragment
- Impossible to construct a SchemaLocation containing a json pointer with an escaped fragment HOT 1
- EmailValidator limits the user length to be <= 64 HOT 2
- JsonSchemaFactory.builder().defaultMetaSchemaIri() and new Version4().getInstance().getIri()
- Unknown keyword warning when using meta schema from file HOT 17
- [Bug] IRI References with URL encoded '[' and ']' incorrectly fail validation HOT 1
- How to handle loading of relative refs HOT 2
- "http://" should be considered as a valid iri-reference HOT 1
- Downgrade maven-source-plugin to 3.2.1
- Resolve javadoc warning messages
- `JsonSchema.getSubSchema()` fails with JsonPointer containing a number HOT 2
- Possible performance improvement: JsonNodePath.hashCode() HOT 3
- How to generate the json structure acording to the schema? HOT 2
- oneOf with discriminator does not verify json correctly HOT 4
- The location of the `module-info.class` in the jar file is wrong HOT 1
- anyOf and OneOf unhelpful error messages HOT 2
- Exponential algorithm in BaseJsonValidator.hasAdjacentKeywordInEvaluationPath HOT 13
- Validation error for "id" field in referenced schema HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from json-schema-validator.