Skip to content
This repository has been archived by the owner on Aug 8, 2018. It is now read-only.

Default value of properties #212

Open
celicoo opened this issue Mar 13, 2018 · 0 comments
Open

Default value of properties #212

celicoo opened this issue Mar 13, 2018 · 0 comments

Comments

@celicoo
Copy link

celicoo commented Mar 13, 2018

I'm using the following model to validate the body of one of my endpoints

{
	"type": "object",
	"required": ["parsingRules"],
	"additionalProperties": false,
	"properties": {
		"parsingRules": {
			"type": "object",
			"required": ["rules"],
			"additionalProperties": false,
			"properties": {
				"delimiter": {
					"type": "object",
					"additionalProperties": false,
					"default": {},
					"properties": {
						"flags": {
							"type": "string",
							"default": "g",
							"pattern": "^(?:([gimuy])(?!.*\\1))*$"
						},
						"pattern": {
							"type": "string",
							"default": "([\\S\\s]+)",
							"format": "regex",
							"pattern": "^.{1,}?$"
						}
					}
				},
				"rules": {
					"type": "array",
					"minItems": 1,
					"items": {
						"type": "object",
						"required": ["name", "pattern"],
						"additionalProperties": false,
						"properties": {
							"name": {
								"type": "string",
								"pattern": "^.{1,}?$"
							},
							"flags": {
								"type": "string",
								"default": "",
								"pattern": "^(?:([gimuy])(?!.*\\1))*$"
							},
							"pattern": {
								"type": "string",
								"format": "regex",
								"pattern": "^.{1,}?$"
							},
							"type": {
								"type": "string",
								"default": "System.String",
								"enum": [
									"System.Boolean",
									"System.Byte",
									"System.Char",
									"System.DBNull",
									"System.DateTime",
									"System.Double",
									"System.Int16",
									"System.Int32",
									"System.Int64",
									"System.SByte",
									"System.Single",
									"System.String",
									"System.Text",
									"System.Text.StringBuilder",
									"System.UInt16",
									"System.Uint32",
									"System.Uint64",
									"Sytem.Decimal"
								]
							}
						}
					}
				}
			}
		}
	}
}

And the validator is ignoring the default properties. Is this normal?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant