← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1413209] [NEW] Inconsistent metadef property validation

 

Public bug reported:

Let's say I want to create property:

"property": {
	"type": "string",
	"title": "property",
	"description": "property description ",
	"test-key": "test-value",
}

If I use POST call to create this property I'll get an error that "test-
key" is not valid property because additional properties are not
allowed. However, if I use POST call to create object with this property
inside:

{
	"name": "My Object",
	"description": "object1 description.",
	"properties": {
		"property1": {
			"type": "integer",
			"title": "property",
			"description": "property description",
			"test-key": "test-value",
		}
	}
}

it will create new object with property that contains unknown key. This
happens because properties are validated in a different way than
properties inside objects.

The problem is because "additionalProperties" option is not explicitly
set in property schema. If this option isn't set, it will be attached to
the root level of json schema (default value is False and it applies
ONLY to the same level). For property schema it works because everything
is on the same level, however, in object schema properties are nested
inside "definitions", so the option does not apply (different levels in
tree).

** Affects: glance
     Importance: Undecided
     Assignee: Pawel Koniszewski (pawel-koniszewski)
         Status: New

** Changed in: glance
     Assignee: (unassigned) => Pawel Koniszewski (pawel-koniszewski)

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to Glance.
https://bugs.launchpad.net/bugs/1413209

Title:
  Inconsistent metadef property validation

Status in OpenStack Image Registry and Delivery Service (Glance):
  New

Bug description:
  Let's say I want to create property:

  "property": {
  	"type": "string",
  	"title": "property",
  	"description": "property description ",
  	"test-key": "test-value",
  }

  If I use POST call to create this property I'll get an error that
  "test-key" is not valid property because additional properties are not
  allowed. However, if I use POST call to create object with this
  property inside:

  {
  	"name": "My Object",
  	"description": "object1 description.",
  	"properties": {
  		"property1": {
  			"type": "integer",
  			"title": "property",
  			"description": "property description",
  			"test-key": "test-value",
  		}
  	}
  }

  it will create new object with property that contains unknown key.
  This happens because properties are validated in a different way than
  properties inside objects.

  The problem is because "additionalProperties" option is not explicitly
  set in property schema. If this option isn't set, it will be attached
  to the root level of json schema (default value is False and it
  applies ONLY to the same level). For property schema it works because
  everything is on the same level, however, in object schema properties
  are nested inside "definitions", so the option does not apply
  (different levels in tree).

To manage notifications about this bug go to:
https://bugs.launchpad.net/glance/+bug/1413209/+subscriptions


Follow ups

References