Json validation using patternProperties does now work - json

I use the Github library "json-schema" to validate JSON against a custom schema. But I am having trouble validating the following JSON against my defined schema.
JSON holding 2 news entries:
[{
"bodytext": "Lorem ipsum",
"datetime": "2018-01-29T13:18:56+0100",
"falMedia": {
"00000000519602e500007f310096b8e2": {
"alternative": null,
"description": "The description",
"link": "",
"pid": 6043,
"processedFile": {
"publicUrl": "image01.png"
},
"title": null,
"uid": 52925
},
"0000000051960a1700007f310096b8e2": {
"alternative": null,
"description": "Another description",
"link": "",
"pid": 6043,
"processedFile": {
"publicUrl": "images/picture01.jpg"
},
"title": null,
"uid": 52927
}
},
"falRelatedFiles": [ ],
"istopnews": true,
"pid": 6043,
"teaser": "A short lorem teaser",
"title": "The message title",
"uid": 51911
},
{
"bodytext": "Hello World",
"datetime": "2018-01-29T13:24:33+0100",
"falMedia": [ ],
"falRelatedFiles": [ ],
"istopnews": false,
"pid": 339,
"teaser": null,
"title": "Just a short message",
"uid": 51915
}]
This is my schema against which I try to validate:
{
"$schema": "http://json-schema.org/draft-04/schema",
"title": "FPÖ News",
"description": "Schema for FPÖ News articles accesed by the mobile apps",
"type": "array",
"items": {
"additionalProperties": false,
"properties": {
"bodytext": {
"type": "string"
},
"datetime": {
"type": "string"
},
"falMedia": {
"anyOf": [
{
"type": "object",
"patternProperties": {
"^[0-9abcde]*$": {
"type": "object",
"properties": {
"alternative": {
"type": ["null", "string"]
},
"description": {
"type": "string"
},
"link": {
"type": "string"
},
"pid": {
"type": "integer"
},
"processedFile": {
"type": "object",
"properties": {
"additionalProperties": false,
"publicUrl": {
"type": "string"
}
}
},
"title": {
"type": "string"
},
"uid": {
"type": "integer"
}
},
"additionalProperties": false
}
}
},
{
"type": "array"
}
]
},
"falRelatedFiles": {
"type": "array"
},
"istopnews": {
"type": "boolean"
},
"pid": {
"type": "integer"
},
"teaser": {
"type": ["string", "null"]
},
"title": {
"type": "string"
},
"uid": {
"type": "integer"
}
},
"required": [
"bodytext",
"datetime",
"istopnews",
"pid",
"teaser",
"title",
"uid"
]
}
}
It seems to me that everything underneath the part "patternProperties" is not concidered when validating.
My issue is, that the keys for the objects underneath "falMedia" are generated dynamically. Therefore I do not know these values. I thought about using the "patternProperties". But when I change the values of the "falMedia" entries in the "news" to something which (according to the supplied regex under patternProperties) is not valid, the library still says that everything is fine.
Am I missing out on something here?
Is my schema false?
I would greatly appriciate any help.
Thanks
Klaus

Your problem seems to be that your regex should be "^[0-9abcdef]*$" instead of "^[0-9abcde]*$". Because you're missing the "f", patternProperties doesn't match any of the values and therefore doesn't constraint the properties in "falMedia".

Related

How to use Parser Transformation for JSON data in IICS?

I am new to IICS and I have JSON data as below, which I would to parse in csv file. I am using this link as a reference to achieve this transformation. I created valid mapping in IICS.The mapping runs fine. However, when I see my jobs I am receiving below error.I went to the path mentioned and opened the Events.cme file in Notepad but cannot make of what file is talking about (Note: in belwo output I deleted few of the numbers)
Not sure what is wrong ? Do I need to save my JSON data file as txt file ?
Any help will be appreciated! Thanks in advance!
ERROR after running the mapping
[ERROR] Failed to process data: File C:/IICSLabFiles/test.json doesn't exist or isn't readable- for more information see file://C:/PROGRA~1/Informatica Cloud Secure Agent/apps/Data_Integration_Server/data/CMReports/Tmp/2022-06-01/HierarchyParser_h2r_udt_8gns3_ONLY_H2R_XMAP_/Events.cme
Opening Events.cme file in notepad produces following
<B#80010%#>
!~109146~165266~~10.2.2.65()
<B#80032%#>
</B#8032%#>
<m -- XMap%m>
!~103149~1654220266~~Pages\/page_m_1.cmv%Pages\/page_m_1.json
<B#80037%XML#>
!~1031~1654220266~~Pages\/Input_of_m_1.cmv%Pages\/Input_of_m_1.json
<LocalFile>
!~309025~16542266~~C:\/IICSLabFiles\/test.json
</LocalFile>
!~103205~16540266~~C:\/IICSLabFiles\/test.json
!~3033~1654220266~~
</B#8007%XML#>
</m -- XMap>
</B#80010%#>
JSON Data that is saved in test.json (with File type as JSON File):
{
"current_page": 1,
"first_page_url": "https://covid-api.com/api/regions?per_page=20&page=1",
"last_page_url": "https://covid-api.com/api/regions?per_page=20&page=50",
"next_page_url": "https://covid-api.com/api/regions?per_page=20&page=2",
"prev_page_url": null,
"per_page": "20",
"last_page": 50,
"from": 1,
"path": "https://covid-api.com/api/regions",
"to": 20,
"total": 997,
"data": [
{
"iso": "CHN",
"name": "China"
},
{
"iso": "TWN",
"name": "Taipei and environs"
},
{
"iso": "USA",
"name": "US"
},
{
"iso": "JPN",
"name": "Japan"
},
{
"iso": "THA",
"name": "Thailand"
},
{
"iso": "KOR",
"name": "Korea, South"
},
{
"iso": "SGP",
"name": "Singapore"
},
{
"iso": "PHL",
"name": "Philippines"
},
{
"iso": "MYS",
"name": "Malaysia"
},
{
"iso": "VNM",
"name": "Vietnam"
},
{
"iso": "AUS",
"name": "Australia"
},
{
"iso": "MEX",
"name": "Mexico"
},
{
"iso": "BRA",
"name": "Brazil"
},
{
"iso": "COL",
"name": "Colombia"
},
{
"iso": "FRA",
"name": "France"
},
{
"iso": "NPL",
"name": "Nepal"
},
{
"iso": "CAN",
"name": "Canada"
},
{
"iso": "KHM",
"name": "Cambodia"
},
{
"iso": "LKA",
"name": "Sri Lanka"
},
{
"iso": "CIV",
"name": "Cote d'Ivoire"
}
]
}
**JSON SCHEMA that is saved in Hierarchy schema (with file type as JSON FILE) **
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"current_page": {
"type": "integer"
},
"first_page_url": {
"type": "string"
},
"last_page_url": {
"type": "string"
},
"next_page_url": {
"type": "string"
},
"prev_page_url": {
"type": "null"
},
"per_page": {
"type": "string"
},
"last_page": {
"type": "integer"
},
"from": {
"type": "integer"
},
"path": {
"type": "string"
},
"to": {
"type": "integer"
},
"total": {
"type": "integer"
},
"data": {
"type": "array",
"items": [
{
"type": "object",
"properties": {
"iso": {
"type": "string"
},
"name": {
"type": "string"
}
},
"required": [
"iso",
"name"
]
},
{
"type": "object",
"properties": {
"iso": {
"type": "string"
},
"name": {
"type": "string"
}
},
"required": [
"iso",
"name"
]
},
{
"type": "object",
"properties": {
"iso": {
"type": "string"
},
"name": {
"type": "string"
}
},
"required": [
"iso",
"name"
]
},
{
"type": "object",
"properties": {
"iso": {
"type": "string"
},
"name": {
"type": "string"
}
},
"required": [
"iso",
"name"
]
},
{
"type": "object",
"properties": {
"iso": {
"type": "string"
},
"name": {
"type": "string"
}
},
"required": [
"iso",
"name"
]
},
{
"type": "object",
"properties": {
"iso": {
"type": "string"
},
"name": {
"type": "string"
}
},
"required": [
"iso",
"name"
]
},
{
"type": "object",
"properties": {
"iso": {
"type": "string"
},
"name": {
"type": "string"
}
},
"required": [
"iso",
"name"
]
},
{
"type": "object",
"properties": {
"iso": {
"type": "string"
},
"name": {
"type": "string"
}
},
"required": [
"iso",
"name"
]
},
{
"type": "object",
"properties": {
"iso": {
"type": "string"
},
"name": {
"type": "string"
}
},
"required": [
"iso",
"name"
]
},
{
"type": "object",
"properties": {
"iso": {
"type": "string"
},
"name": {
"type": "string"
}
},
"required": [
"iso",
"name"
]
},
{
"type": "object",
"properties": {
"iso": {
"type": "string"
},
"name": {
"type": "string"
}
},
"required": [
"iso",
"name"
]
},
{
"type": "object",
"properties": {
"iso": {
"type": "string"
},
"name": {
"type": "string"
}
},
"required": [
"iso",
"name"
]
},
{
"type": "object",
"properties": {
"iso": {
"type": "string"
},
"name": {
"type": "string"
}
},
"required": [
"iso",
"name"
]
},
{
"type": "object",
"properties": {
"iso": {
"type": "string"
},
"name": {
"type": "string"
}
},
"required": [
"iso",
"name"
]
},
{
"type": "object",
"properties": {
"iso": {
"type": "string"
},
"name": {
"type": "string"
}
},
"required": [
"iso",
"name"
]
},
{
"type": "object",
"properties": {
"iso": {
"type": "string"
},
"name": {
"type": "string"
}
},
"required": [
"iso",
"name"
]
},
{
"type": "object",
"properties": {
"iso": {
"type": "string"
},
"name": {
"type": "string"
}
},
"required": [
"iso",
"name"
]
},
{
"type": "object",
"properties": {
"iso": {
"type": "string"
},
"name": {
"type": "string"
}
},
"required": [
"iso",
"name"
]
},
{
"type": "object",
"properties": {
"iso": {
"type": "string"
},
"name": {
"type": "string"
}
},
"required": [
"iso",
"name"
]
},
{
"type": "object",
"properties": {
"iso": {
"type": "string"
},
"name": {
"type": "string"
}
},
"required": [
"iso",
"name"
]
}
]
}
},
"required": [
"current_page",
"first_page_url",
"last_page_url",
"next_page_url",
"prev_page_url",
"per_page",
"last_page",
"from",
"path",
"to",
"total",
"data"
]
}
Source connection Setup
Path_text file contains following information
Path
C:/IICSLabFiles/test.json
The error message "C:/IICSLabFiles/test.json doesn't exist or isn't readable" suggests you try reading local file. Is this the path to the file located on Secure Agent running the mapping or is it the path to a file stored on your laptop? What is your Source definition?
Keep in mind that you design the mapping on your laptop where you have access to files stored on your laptop - but once you execute, it gets processed by Secure Agent (that can be a different machine, cloud-hosted, etc.). In this case it seems the Secure Agent cannot access the file at the given location.
It's also possible to have Secure Agent installed on your machine and run the process on the laptop where you actually have been designing the mapping. In such case please make sure there are no typos in the path, no leading or trailing empty spaces. And if it's a Windows-based Secure Agent, verify the paths as the one you use has froward slashes while Windows uses backslashes usually:
C:/IICSLabFiles/test.json
vs
C:\IICSLabFiles\test.json

Can't understand this JSON schema from the Swish QR Code API

I'm trying to use an API but the documentation is really bad. I got this JSON schema but I don't understand it. What am I supposed to include in the request?
url: https://mpc.getswish.net/qrg-swish/api/v1/prefilled
I have tried this but it doesn't work:
{
"payee":{
"editable":{
"editable":"false"
},
"swishString":{
"value":"0721876507"
}
},
"size":600,
"border":20,
"transparent":false,
"format":"png"
}
Here's the JSON schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Swish pre-filled qr code generator",
"description": "REST interface to get a QR code that the Swish app will interpret as a pre filled code",
"definitions": {
"editable": {
"description ": "Controls if user can modify this value in Swish app or not",
"type": "object",
"properties": {
"editable": {
"type": "boolean",
"default": false
}
}
},
"swishString": {
"type": "object",
"properties": {
"value": {
"type": "string",
"maxLength": 70
}
},
"required": [
"value"
]
},
"swishNumber": {
"type": "object",
"properties": {
"value": {
"type": "number"
}
},
"required": [
"value"
]
}
},
"type": "object",
"properties": {
"format": {
"enum": [
"jpg",
"png",
"svg"
]
},
"payee": {
"description": "Payment receiver",
"allOf": [
{
"$ref": "#/definitions/editable"
},
{
"$ref": "#/definitions/swishString"
}
]
},
"amount": {
"description": "Payment amount",
"allOf": [
{
"$ref": "#/definitions/editable"
},
{
"$ref": "#/definitions/swishNumber"
}
]
},
"message": {
"description": "Message for payment",
"allOf": [
{
"$ref": "#/definitions/editable"
},
{
"$ref": "#/definitions/swishString"
}
]
},
"size": {
"description": "Size of the QR code. The code is a square, so width and height are the same. Not required is the format is svg",
"value": "number",
"minimum": 300
},
"border": {
"description": "Width of the border.",
"type": "number"
},
"transparent": {
"description": "Select background color to be transparent. Do not work with jpg format.",
"type": "boolean"
}
},
"required": [
"format"
],
"anyOf": [
{
"required": [
"payee"
]
},
{
"required": [
"amount"
]
},
{
"required": [
"message"
]
}
],
"additionalProperties": false,
"maxProperties": 5
}
The API should return a QR code.
To be honest, I have not taken the time to learn JSON schema, but your example should probably look something like this:
{
"payee": {
"value": "0721876507",
"editable": false
},
"size": 600,
"border": 20,
"transparent": false,
"format": "png"
}
There are other parameters you may choose to utilize:
{
"payee": {
"value": "1239006032",
"editable": false
},
"message": {
"value": "LIV",
"editable": true
},
"amount": {
"value": 100,
"editable": true
},
"format": "png",
"size": 300,
"border": 0,
"transparent": true
}
Honestly, I think the developers behind the Swish APIs are trying to look smart by complicating things. They should, of course, have provided example JSON data instead of forcing consumers to understand their JSON schema. Also, I believe their published schema is wrong. The second example I provided works even though it doesn't validate according to the JSON schema ("Object property count 7 exceeds maximum count of 5").
Here is a minimal and pretty useless request that returns a valid QR-code
{
"format": "png",
"size": 300
}
And here is a more usable example that works
{
"format": "png",
"size": 300,
"transparent": false,
"amount": {
"value": 999.99,
"editable": true
},
"payee": {
"value": "0701000000",
"editable": false
},
"message": {
"value": "Hello",
"editable": false
}
}

JSON schema with data containing external data

Say I have a JSON object which looks like this:
{
"identifier": "carModels",
"friendlyName": "Car Models",
"dataType": "int",
"isRequired": false,
"format": null,
"selectableOptions": {
"url": "http://some-service-resources/carmodels",
"displayPropertyName": "value1",
"valuePropertyName": "name",
"selectMode": "single"
}
}
I can easily use an online tool to create the JSON schema which looks like this:
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"identifier": {
"type": "string"
},
"friendlyName": {
"type": "string"
},
"dataType": {
"type": "string"
},
"isRequired": {
"type": "boolean"
},
"format": {
"type": "null"
},
"selectableOptions": {
"type": "object",
"properties": {
"url": {
"type": "string"
},
"displayPropertyName": {
"type": "string"
},
"valuePropertyName": {
"type": "string"
},
"selectMode": {
"type": "string"
}
},
"required": [
"url",
"displayPropertyName",
"valuePropertyName",
"selectMode"
]
}
},
"required": [
"identifier",
"friendlyName",
"dataType",
"isRequired",
"format",
"selectableOptions"
]
}
This schema, and data, however, does not give the full picture. It does not contain a definition of car models, retrievable from http://some-service-resources/carmodel, nor does it contain the possible options for selectableOptions.selectMode, which could be single or multiple.
How does one handle this?

In json schema, how to chain definitions?

I'm trying to build a json schema with "chained" definition.
For the given schema :
{
"$schema": "http://json-schema.org/schema#",
"id": "http://toto/filter-schema#",
"title": "filter schema definition",
"type": "object",
"description": "filter data",
"definitions": {
"timeFilters": {
"type": "object",
"oneOf": [
{
"properties": {
"since": {
"type": "string",
"format": "date-time",
"description": "sends only items that have been modified AFTER this"
}
},
"additionalProperties": false,
"required": [
"since"
]
},
{
"properties": {
"from": {
"type": "string",
"format": "date-time",
"description": "return only data that have a validity date AFTER this"
},
"to": {
"type": "string",
"format": "date-time",
"description": "return only data that have a validity date BEFORE this"
}
},
"additionalProperties": false,
"required": [
"from",
"to"
]
}
]
},
"objectFilters": {
"type": "object",
"properties": {
"objectFilters": {
"type": "array",
"description": "the array of object filter",
"minItems": 1,
"uniqueItems": true,
"items": [
{
"type": "object",
"additionalProperties": false,
"properties": {
"targetClass": {
"type": "string",
"description": "the target class"
},
"targetAttribute": {
"type": "string",
"description": "the target attribute"
},
"test": {
"type": "string",
"description": "the test on the attribute value"
}
}
}
]
}
},
"additionalProperties": false
}
},
"anyOf": [
{
"additionalProperties": false
},
{
"$ref": "#/definitions/timeFilters",
"additionalProperties": false
},
{
"$ref": "#/definitions/objectFilters",
"additionalProperties": false
}
]
}
this schema is validating
{
"since": "2016-02-17T01:02:03.1Z"
}
and
{
"from": "2016-02-17T01:02:03.1Z",
"to": "2016-02-17T01:02:03.1Z",
}
and
{
"objectFilters": [
{
"targetClass": "test",
"targetAttribute": "test",
"test": "test"
}
]
}
and even
{}
but not
{
"since": "2016-02-17T01:02:03.1Z",
"objectFilters": [
{
"targetClass": "test",
"targetAttribute": "test",
"test": "test"
}
]
}
How can make it validating the last json ?
I have tried to add a new definition to the "anyOf", something like this :
{
"$ref": "#/definitions/timeFilters",
"$ref": "#/definitions/objectFilters",
"additionalProperties": false
}
but it does not work.
I use the draft v4.
EDIT :
Also tried
{
"$ref": "#/definitions/timeFilters",
"additionalProperties": {
"$ref": "#/definitions/objectFilters",
"additionalProperties": false
}
}
not working either
The behavior of additionalProperties can get confusing when combining schemas. I suggest a different approach. It's easier to declare all your properties upfront and then declare the required properties constraints separately.
The dependencies keyword works well in this case.
http://json-schema.org/latest/json-schema-validation.html#anchor70
{
"$schema": "http://json-schema.org/schema#",
"id": "http://toto/filter-schema#",
"title": "filter schema definition",
"description": "filter data",
"type": "object",
"properties": {
"since": {
"type": "string",
"format": "date-time",
"description": "sends only items that have been modified AFTER this"
},
"from": {
"type": "string",
"format": "date-time",
"description": "return only data that have a validity date AFTER this"
},
"to": {
"type": "string",
"format": "date-time",
"description": "return only data that have a validity date BEFORE this"
},
"objectFilters": {
"type": "array",
"description": "the array of object filter",
"minItems": 1,
"uniqueItems": true,
"items": [
{
"type": "object",
"additionalProperties": false,
"properties": {
"targetClass": {
"type": "string",
"description": "the target class"
},
"targetAttribute": {
"type": "string",
"description": "the target attribute"
},
"test": {
"type": "string",
"description": "the test on the attribute value"
}
}
}
]
}
},
"additionalProperties": false,
"dependencies": {
"since": {
"not": { "required": ["from"] }
},
"from": ["to"],
"to": ["from"]
}
}

Swagger - Invalid JSON errors

I'm just starting with Swagger UI and I'm trying to understand how it works.
So far I've entered some JSON (manually) and this is the result:
{
"swagger": "2.0",
"info": {
"version": "1.0.0",
"title": "PhakeApps API",
"contact": {
"name": "PhakeApps API team",
"url": "http://phakeapps.com/"
},
"license": {
"name": "Creative Commons 4.0 International",
"url": "http://creativecommons.org/licenses/by/4.0/"
}
},
"host": "api.phakeapps.com",
"basePath": "/v1",
"schemes": [
"http"
],
"produces": [
"application/json"
],
"consumes": [
"application/json"
],
"paths": {
"/places/search": {
"post": {
"tags": [
"Places"
],
"description": "Search for (a) place(s) <br /><br /> <b>id</b> - The ID of the request. <br /> <b>api_key</b> - API Key for the platform the request is sent. <i>Currently, not required.</i> <br /> <b>Params</b> - Required. <i>See model & model schema.</i>",
"operationId": "PlacesSearch",
"produces": [
"application/json"
],
"consumes": [
"application/json"
],
"parameters": [
{
"name": "request",
"in": "body",
"paramType": "body",
"description": "Object containing the <u>id</u>, <u>api_key</u> and certain <u>params</u>.",
"required": true,
"schema": {
"$ref": "#/definitions/Search"
}
}
],
"responses": {
"200": {
"description": "Success",
"schema": {
"$ref": "#/definitions/PlacesResult"
}
},
"403": {
"description": "Validation error or Server Failure",
"schema": {
"$ref": "#/definitions/Error"
}
}
}
}
}
},
"definitions": {
"PlacesResult": {
"required": [
"data",
"id",
"code"
],
"properties": {
"data": {
"$ref": "#/definitions/Places"
},
"id": {
"type": "integer",
"format": "int32"
},
"code": {
"type": "integer",
"format": "int32"
}
}
},
"Places": {
"required": [
"places"
],
"properties": {
"places": {
"$ref": "#/definitions/Place"
}
}
},
"City": {
"required": [
"id",
"name"
],
"properties": {
"id": {
"type": "string"
},
"name": {
"type": "string"
}
}
},
"Neighbourhood": {
"required": [
"id",
"name"
],
"properties": {
"id": {
"type": "string"
},
"name": {
"type": "string"
}
}
},
"Cuisine": {
"required": [
"id",
"name"
],
"properties": {
"id": {
"type": "string"
},
"name": {
"type": "string"
}
}
},
"Place": {
"required": [
"id",
"name",
"city",
"neighbourhood",
"address",
"cuisine",
"price",
"photos_cnt",
"lat",
"lng",
"is_fav"
],
"properties": {
"id": {
"type": "string"
},
"name": {
"type": "string"
},
"city": {
"type": "array",
"items": {
"$ref": "#/definitions/City"
}
},
"neighbourhood": {
"type": "array",
"items": {
"$ref": "#/definitions/Neighbourhood"
}
},
"address": {
"type": "string"
},
"cuisine": {
"type": "array",
"items": {
"$ref": "#/definitions/Cuisine"
}
},
"price": {
"type": "integer",
"format": "int32"
},
"photos_cnt": {
"type": "integer",
"format": "int32"
},
"lat": {
"type": "double"
},
"lng": {
"type": "double"
},
"is_fav": {
"type": "boolean"
}
}
},
"Search": {
"required": [
"id",
"api_key",
"params"
],
"properties": {
"id": {
"type": "integer",
"format": "int64"
},
"api_key": {
"type": "string"
},
"params": {
"$ref": "#/definitions/SearchParams"
}
}
},
"SearchParams": {
"required": [
"user_id",
"city_id",
"people",
"dt",
"locale"
],
"properties": {
"user_id": {
"type": "string",
"default": "956dda4c21c72e48f5f17a7cd783a0f7"
},
"city_id": {
"type": "string",
"default": "4ec4b3e6098c9d23c925b0c2451eb06a"
},
"people": {
"type": "integer",
"format": "int32",
"minimum": 1,
"default": 2
},
"dt": {
"type": "integer",
"format": "int32",
"default": "1427742000"
},
"locale": {
"type": "string",
"default": "bg"
},
"place_id": {
"type": "string",
"default": "0"
},
"neighborhood_id": {
"type": "string",
"default": "0"
},
"cuisine_id": {
"type": "string",
"default": "0"
},
"kids_place": {
"type": "boolean",
"default": false
},
"price": {
"type": "integer",
"format": "int64",
"default": 1
},
"outdoors": {
"type": "boolean",
"default": false
}
}
},
"Error": {
"required": [
"code",
"data"
],
"properties": {
"code": {
"type": "integer",
"format": "int32"
},
"data": {
"type": "array",
"items": {
"type": "array"
}
}
}
}
}
}
However, swagger's validator says it's not valid. The error I get is this
[
{
"level": "error",
"domain": "validation",
"keyword": "anyOf",
"message": "instance failed to match at least one required schema among 2",
"schema": {
"loadingURI": "http://json-schema.org/draft-04/schema#",
"pointer": "/properties/type"
},
"instance": {
"pointer": "/definitions/Place/properties/lat/type"
}
}
]
Note that it works as expected (so far). It displays the data (models and models' structure) properly. Make requests and retrieves responses. Yet the validator says it's not valid. (The yellow badge saying 'Invalid', not the red one that says 'Error').
What am I missing?
Your spec is indeed not valid. In your Place definition, you use "type": "double" to describe the type of the lat (and also lng) property, but such a type does not exist.
If you want to describe a numeric value of 'double' size, you should change the definition as follows:
"lng": {
"type": "number",
"format": "double"
}
Do that everywhere you use the double type, and it should resolve that issue.