Skip to content

Required attribute of properties defined as stringArray #221

@MonsJovis

Description

@MonsJovis

I marked properties of one of my schema objects as required.

"definitions": {
    "Credentials": {
    "title": "Credentials",
    "properties": {
        "client_id": {
        "type": "string",
        "required": true
    },
    "client_secret": {
        "type": "string",
        "required": true
    },
    "username": {
        "type": "string",
        "required": true
    },
    "password": {
        "type": "string",
        "required": true
    }
}

The validator says the value of required has to be a stringArray:

[ {
  "level" : "error",
  "schema" : {
    "loadingURI" : "http://json-schema.org/draft-04/schema#",
    "pointer" : "/definitions/stringArray"
  },
  "instance" : {
    "pointer" : "/definitions/Credentials/properties/client_id/required"
  },
  "domain" : "validation",
  "keyword" : "type",
  "message" : "instance type (boolean) does not match any allowed primitive type (allowed: [\"array\"])",
  "found" : "boolean",
  "expected" : [ "array" ]
} ]

So I'm wondering why the required attribute of properties is defined as stringArray?

"required": {
     "$ref": "http://json-schema.org/draft-04/schema#/definitions/stringArray"
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions