{"action":"closed","issue":{"url":"https://api.github.com/repos/epoberezkin/ajv/issues/18","labels_url":"https://api.github.com/repos/epoberezkin/ajv/issues/18/labels{/name}","comments_url":"https://api.github.com/repos/epoberezkin/ajv/issues/18/comments","events_url":"https://api.github.com/repos/epoberezkin/ajv/issues/18/events","html_url":"https://github.com/epoberezkin/ajv/issues/18","id":91935856,"number":18,"title":"Errors for 'required' validation should include missing property","user":{"login":"cdmcnamara","id":1103780,"avatar_url":"https://avatars.githubusercontent.com/u/1103780?v=3","gravatar_id":"","url":"https://api.github.com/users/cdmcnamara","html_url":"https://github.com/cdmcnamara","followers_url":"https://api.github.com/users/cdmcnamara/followers","following_url":"https://api.github.com/users/cdmcnamara/following{/other_user}","gists_url":"https://api.github.com/users/cdmcnamara/gists{/gist_id}","starred_url":"https://api.github.com/users/cdmcnamara/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cdmcnamara/subscriptions","organizations_url":"https://api.github.com/users/cdmcnamara/orgs","repos_url":"https://api.github.com/users/cdmcnamara/repos","events_url":"https://api.github.com/users/cdmcnamara/events{/privacy}","received_events_url":"https://api.github.com/users/cdmcnamara/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/epoberezkin/ajv/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-06-29T23:38:44Z","updated_at":"2015-06-30T23:31:26Z","closed_at":"2015-06-30T23:31:26Z","body":"Hi, I'm trying to get some clarity on a potential issue I'm seeing. In running the following:\r\n```\r\nconst ajv = Ajv({verbose: false, allErrors: true});\r\n\r\najv.addSchema([\r\n   require('./schemas/Currency.json'),\r\n   require('./schemas/PositiveFloatString.json'),\r\n   require('./schemas/Amount.json'),\r\n   require('./schemas/Party.json'),\r\n])\r\n\r\nfunction isValid(object, schemaName) {\r\n  return ajv.validate(schemaName, object);\r\n}\r\n\r\nfunction validate(object, schemaName) {\r\n  if (!isValid(object, schemaName)) {\r\n    return {\r\n      isValid: false,\r\n      errors: ajv.errors\r\n    };\r\n  }\r\n  return {\r\n    isValid: true\r\n  };\r\n}\r\n\r\nconsole.log(validator.validate({\r\n        entity: 'acct:conner@ropple.com',\r\n        amount: {\r\n          currency: 'USD'\r\n        }\r\n      }, 'Party'));\r\n```\r\nI get the following:\r\n```\r\n{ \r\n  isValid: false,\r\n  errors: [{ \r\n    keyword: 'required',\r\n     dataPath: '.amount',\r\n     message: 'properties value, currency are required' \r\n  }]\r\n}\r\n```\r\nIdeally I would like to see something more along the lines of:\r\n```\r\n{ \r\n  isValid: false,\r\n  errors: [{ \r\n    keyword: 'required',\r\n    dataPath: '.amount.value',\r\n    message: 'property value is required' \r\n  }]\r\n}\r\n```\r\nI was wondering if this was an issue with my implementation / schemas or if it is a shortcoming of ajv?\r\n\r\nThanks in advance.\r\n\r\nMy schemas are as follows:\r\nParty.json\r\n```\r\n{\r\n  \"$schema\": \"http://json-schema.org/draft-04/schema#\",\r\n  \"id\": \"Party\",\r\n  \"title\": \"Party\",\r\n  \"description\": \"Represents a single party to a payment.\",\r\n  \"type\": \"object\",\r\n  \"properties\": {\r\n    \"name\": {\r\n      \"$ref\": \"Account\"\r\n    },\r\n    \"amount\": {\r\n      \"description\": \"How much this party will send or receive in the payment.\",\r\n      \"$ref\": \"Amount\"\r\n    }\r\n  },\r\n  \"additionalProperties\": false,\r\n  \"required\": [\"name\", \"amount\"]\r\n}\r\n```\r\nAmount.json\r\n```\r\n{\r\n  \"$schema\": \"http://json-schema.org/draft-04/schema#\",\r\n  \"id\": \"Amount\",\r\n  \"title\": \"Amount\",\r\n  \"type\": \"object\",\r\n  \"properties\": {\r\n    \"value\": {\r\n      \"$ref\": \"PositiveFloatString\"\r\n    },\r\n    \"currency\": {\r\n      \"type\": \"string\",\r\n      \"$ref\": \"Currency\"\r\n    }\r\n  },\r\n  \"additionalProperties\": false,\r\n  \"required\": [\"value\", \"currency\"]\r\n}\r\n```\r\nPositiveFloatString.json\r\n```\r\n{\r\n  \"$schema\": \"http://json-schema.org/draft-04/schema#\",\r\n  \"id\": \"PositiveFloatString\",\r\n  \"title\": \"PositiveFloatString\",\r\n  \"description\": \"A string representation of a floating point number\",\r\n  \"type\": \"string\",\r\n  \"pattern\": \"^[+]?[0-9]*[.]?[0-9]+([eE][-+]?[0-9]+)?$\"\r\n}\r\n```\r\nCurrency.json\r\n```\r\n{\r\n  \"$schema\": \"http://json-schema.org/draft-04/schema#\",\r\n  \"id\": \"Currency\",\r\n  \"title\": \"Currency\",\r\n  \"type\": \"string\",\r\n  \"pattern\": \"^(([a-zA-Z0-9]{3})|([a-fA-F0-9]{40}))$\"\r\n}\r\n```"}}