Comments (5)
It's hard to say with that snippet; I'd need to know what you think should fail validation that isn't (or vice versa). Could I see the complete schema (paricularly as $ref works differently between different schema versions) and some example data?
from jsonschemafriend.
Thanks for responding so promptly. I guess, I did not explain my problem clearly enough. I am not trying to validate an instance JSON document - I am trying to parse a schema to look for certain features. Here is a more complete version of the schema:
So, I am loading the sub schemas and trying to iterate through them -
Map<URI, Schema> subSchemas = schema.getSubSchemas();
Set uris = subSchemas.keySet();
Iterator itr1 = uris.iterator();
while (itr1.hasNext())
{
......
Schema s = subSchemas.get(key);
..
s.getExplicitTypes().......
}
What I am seeing is that for all the sub schemas below, barring the composite ones - "ResidenceAddress" and "SubjectPropertyAddress" - the getExplicitTypes() call is returning "object" - which is correct, but for the two composite objects the value being returned is null. Am I not using the library correctly? What am I missing?
{
"$schema": "https://json-schema.org/draft-07/schema#",
"title": "",
"description": "",
"type": "object",
"properties": {
"Application": {
"type": "object",
"description": "Application",
"properties": {
"Borrowers": {
"$ref": "#/definitions/Borrowers"
}
}
}
},
"definitions": {
"Borrower": {
"type": "object",
"properties": {
"ResidenceAddress": {
"$ref": "#/definitions/ResidenceAddress"
}
}
},
"Borrowers": {
"type": "array",
"items": {
"$ref": "#/definitions/Borrower"
},
"minItems": 1,
"maxItems": 2
},
"BaseAddress": {
"type": "object",
"properties": {
"addressLineText": {
"$ref": "#/definitions/String50"
},
"addressUnitIdentifier": {
"$ref": "#/definitions/String50"
},
"cityName": {
"$ref": "#/definitions/String50"
},
"postalCode": {
"$ref": "#/definitions/String50"
}
}
},
"ResidenceAddress": {
"allOf": [
{
"$ref": "#/definitions/BaseAddress"
},
{
"properties": {
"stateCode": {
"$ref": "#/definitions/ResidenceStateCodeType"
}
}
}
],
"required": [
"addressLineText",
"cityName",
"postalCode",
"stateCode"
]
},
"SubjectPropertyAddress": {
"allOf": [
{
"$ref": "#/definitions/BaseAddress"
},
{
"properties": {
"countyName": {
"$ref": "#/definitions/String50"
},
"stateCode": {
"$ref": "#/definitions/SubjectPropertyStateCodeType"
}
}
}
],
"required": [
"stateCode"
]
},
"String50": {
"type": "string",
"maxLength": 50
},
"ResidenceStateCodeType": {
"type": "string",
"enum": [
"AA",
"BB"
]
},
"SubjectPropertyStateCodeType": {
"type": "string",
"enum": [
"CC",
"DD"
]
}
}
}
Thanks again for building this very useful library. Regards.
from jsonschemafriend.
Hi sorry I haven't had time to investigate this yet.
from jsonschemafriend.
from jsonschemafriend.
for all the sub schemas below, barring the composite ones - "ResidenceAddress" and "SubjectPropertyAddress" - the getExplicitTypes() call is returning "object" - which is correct, but for the two composite objects the value being returned is null. Am I not using the library correctly? What am I missing?
You miss the "type": "object" definition in schema.
@jimblackler - issue can be closed
from jsonschemafriend.
Related Issues (20)
- update to commons-collections4
- Issue in Android 5 HOT 1
- string date-time format HOT 1
- Support for custom error message in schema
- Support for JSON Schema simplification? HOT 3
- com.ibm.icu:icu4j is too heavy
- Failing to load draft-07 type schemas (probably lower ones too) HOT 1
- net.jimblackler.usejson.SyntaxError: JSON5: invalid end of input at 1:1 HOT 15
- Performance and functional comparison HOT 1
- Incorrect handling of format-assertions
- Set module name HOT 2
- type: integer does not match specification HOT 2
- The $ref is not resolved when referred schema is located in non-standard keywords HOT 1
- Schema with a wrong pointers to subschema passes the validation HOT 2
- SchemaStore enters infinite loop when $schema returns no content HOT 2
- Add support for custom formats
- 该库不支持安卓26以前的版本,请慎用。(This library does not support versions prior to Android 26, please use with caution.) HOT 1
- Support for custom types when document to be validated passed via a Map HOT 7
- Regular expression validation with CachedRegExPatternSupplier
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 jsonschemafriend.