← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1413209] Re: Inconsistent metadef property validation

 

Reviewed:  https://review.openstack.org/343012
Committed: https://git.openstack.org/cgit/openstack/glance/commit/?id=8b4f955a7ad356bc15f0ff450fc0dea42b2451af
Submitter: Zuul
Branch:    master

commit 8b4f955a7ad356bc15f0ff450fc0dea42b2451af
Author: Ryan Selden <ryanx.seldon@xxxxxxxxx>
Date:   Fri Jul 15 17:52:28 2016 +0000

    Properly validate metadef objects
    
    Metadef objects were not being properly
    validated when they had 1 or more properties.
    
    This adds validation for any and all properties
    attached to a metadef object being created.
    
    Additionally, invalid metadef objects resulted in a
    500 internal server error rather than a 400 bad request,
    this fixes that so that the error is useful.
    
    Change-Id: I6e6d97d54660710cf829a603b0741a23d248146b
    Closes-Bug: #1413209
    Co-Authored-By: Rebecca Finn <rebeccaX.finn@xxxxxxxxx>


** Changed in: glance
       Status: In Progress => Fix Released

-- 
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 Glance:
  Fix Released

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


References