The to_json_schema() method now has the 'required_fields' incorrectly
placed outside of the 'data_key' dict. This patch moves it inside that
dict.
Change-Id: Id50a75bc27198576b615c4e76c046a53008d20bc
Closes-Bug: #1608870
Now that there is a passing gate job, we can claim support for
Python 3.5 in the classifier. This patch also adds the convenience
py35 venv.
Change-Id: I846a4e8cd80e4330203120e782c9071070abb0cb
This implements the get_schema method of common Field and FieldType classes.
This method will be used by the to_json_schema method in Versioned objects
to partially generate the schema of the object's fields.
Fields implemented in this patch: string, enum, integer, float, boolean, list
This also fixes check for default value for Field.
Implements blueprint json-schema-for-versioned-object
Change-Id: Ibd84cb4e33c375044611c6ffa137ee67d21a93e5
This adds a method that generates a versioned object's fields
in json schema. In addition, each field would also generate
its respective json schema property.
Implements blueprint json-schema-for-versioned-object
Change-Id: I5914606e4db79a15b573cfc4a6b9b8807199e402
ObjectVersionChecker.get_hashes() already support extra data collection
for fingerprint generation via the extra_data_func parameter.
However this cannot be used from test_hashes().
Nova versioned notification work depends on this extra data gathering
support. See nova bug #1595575
Change-Id: I7f4d0f37e638de6fcef7211280cedd7d1f09ab74
Closes-Bug: #1595552
Include the full path to the module in the error message
for both the expected and actual object.
Change-Id: I2b5ff3afdbc622a66ba9f78cf8ed61d892694793
Closes-Bug: 1592625
There is a difference when __eq__ is called and not called
in python 2.7 and 3.4. In python 3.4, when an object is
compared to something else, e.g. obj != None, the __eq__
is called to do the comparison, whereas in python 2.7,
it does not. The following patch allows
ComparableVersionedObject to be used in python 3.4 by
checking if the object has obj_to_primitive() as an
attribute.
Change-Id: I9b989bb07505842651bc73c2ccc1552b14307a68
Closes-Bug: #1469864
Because it isn't inherently clear what register_if(False) does on top of
a class, a functionally equivalent objectify decorator is added to make
things a little more readable.
The register_if() decorator was also cleaned up a little bit to reuse
the register() decorator. Unit tests were also added for the register()
functions to ensure none of the functionality is changing.
Change-Id: I0bec8e7e587b81dc0484a7b39f0cf57308d3b3d4
This fixes a bug that I found while making another change, along with
a test that exercises the code that pokes it.
Change-Id: Ibb1ca5e171c6329a46a5d853a3ab8613f58d067f
A recent patch exposed valid_values via property, and cocerced the
result to a tuple to convey the immutable nature of them. This was
a good thought, but unfortunately breaks __repr__ stability, which
we use in the fixture to calculate the object hashes.
We could make the __repr__ dig into the raw types on the field
instead of using the property, but this is probably not the best and
smallest change at this point. If we can get everyone to start using
tuples for their value_values list, then we could land a change to
coerce and enforce that. Right now, we just need to fix the
unexpected regression.
Change-Id: I09b78e7f816fc26c69a3e9435c9d92d5acb5821b
safe_utils.getcallargs was written to support python2.6 which did not
have inspect.getcallargs. Now that support for python2.6 has been
dropped it should be replaced with inspect.getcallargs.
Note:The interface that safe_utils.getcallargs provides did not match
inspect.getcallargs around the handling of the self parameter needing to
be passed in. It should be brought inline with inspect.getcallargs so
that it can be dropped. Nova fixed in 2910d75b28afd909af3b4ac392729ac3d5e64b65.
Change-Id: I2fbec0cc4d43b2fc424460b176bf26700f05f44a
This is useful for consuming projects to cary on the context in base
class without duplicating it in their own base classes.
Change-Id: I28f49740b82a3063709c3c239b5199e901ad898e
When comparing objects to dicts, if a field is unset on both, they
should still be counted as equal. If something is unset on one, but not
on the other, they should be counted as unequal. In any of these
situations, if the field is set in allow_missing, all of the equality
checks should just be skipped.
Change-Id: I3e5143bc872ab4cb645d09c7e969fd1cf9c7985c
Closes-Bug: #1566398