jimblackler / jsonschemafriend

A JSON Schema loader and validator, delivered as a Java library.
Apache License 2.0
49 stars 23 forks source link

Schemas validation fails when expected to pass #97

Open richard-stokes-tfs opened 1 month ago

richard-stokes-tfs commented 1 month ago

Tested version: 0.12.4

When attempting to validate this schema with the example listed inside it will fail stating Expected: [object] Found: [string] when it should pass according to https://www.jsonschemavalidator.net/

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": " File Manifest",
  "description": "A manifest of the file",
  "examples": [
    {
      "specificationTitle": "type 1",
      "specificationVersion": "1.0.0",
      "implementationTitle": "implement name",
      "implementationVersion": "1.0.0",
      "applicationTitle": "application name",
      "applicationVersion": "1.0.0"
    }
  ],
  "$defs": {
    "specification": {
      "type": "string",
      "description": "",
      "enum": [ "type 1",
                "type 2",
                "type 3"]
    }
  },
  "type": "object",
  "properties": {
    "specificationTitle": {
      "$ref": "#/$defs/specification"
      },
    "specificationVersion2": {
      "description": "The version of the specification following x.y.z format",
      "type": "string",
      "pattern": "^\\d+\\.\\d+\\.\\d+$"
    },
    "specificationVersion": {
      "description": "The version of the specification following x.y.z format",
      "type": "string",
      "pattern": "^\\d+\\.\\d+\\.\\d+$"
    },
    "implementationTitle": {
      "description": "The name of the code which created the file",
      "type": "string"
    },
    "implementationVersion": {
      "description": "The version of the implementation that created the file following x.y.z format",
      "type": "string",
      "pattern": "^\\d+\\.\\d+\\.\\d+$"
    },
    "applicationTitle": {
      "description": "The name of the application that created the file",
      "type": "string"
    },
    "applicationVersion": {
      "description": "The version of the application that created the file following x.y.z format",
      "type": "string",
      "pattern": "^\\d+\\.\\d+\\.\\d+$"
    }
  },
  "required":  ["specificationTitle",
                "specificationVersion",
                "implementationTitle",
                "implementationVersion",
                "applicationTitle",
                "applicationVersion"]
}