JSON schema validator.nullable doesn't work with ENUMs

Bug #1763824 reported by Morgan Fainberg on 2018-04-13
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Identity (keystone)
Medium
Morgan Fainberg
Ocata
Medium
Unassigned
Pike
Medium
Lance Bragstad
Queens
Medium
Lance Bragstad
Rocky
Medium
Morgan Fainberg

Bug Description

JSON Schema validator.nullable only sets null in the types list. This works except when an enum is set (such as the case with boolean) [0].

The fix is to make validator.nullable() smart enough to add to the ENUM if ENUM is set as well as type.

[0] https://github.com/openstack/keystone/blob/56237b709ef901fabfd9e8ba744bbcc4cebf8b9b/keystone/common/validation/__init__.py#L33-L43

Morgan Fainberg (mdrnstm) wrote :

This impacts, primarily the resource-options code, but could impact any schema that NULL is expected as well as another type such as boolean.

Changed in keystone:
status: New → Triaged
importance: Undecided → Medium
assignee: nobody → Morgan Fainberg (mdrnstm)

Fix proposed to branch: master
Review: https://review.openstack.org/561348

Changed in keystone:
status: Triaged → In Progress
description: updated
Changed in keystone:
assignee: Morgan Fainberg (mdrnstm) → Lance Bragstad (lbragstad)

Change abandoned by Morgan Fainberg (<email address hidden>) on branch: stable/queens
Review: https://review.openstack.org/561353

Change abandoned by Morgan Fainberg (<email address hidden>) on branch: stable/pike
Review: https://review.openstack.org/561354

Reviewed: https://review.openstack.org/561348
Committed: https://git.openstack.org/cgit/openstack/keystone/commit/?id=78adf4b40fb88e371101ed065ac1d15063d8d86e
Submitter: Zuul
Branch: master

commit 78adf4b40fb88e371101ed065ac1d15063d8d86e
Author: Morgan Fainberg <email address hidden>
Date: Fri Apr 13 13:34:31 2018 -0700

    Fix json schema nullable to add None to ENUM

    The JSON Schema validation implementation of nullable(), which makes
    values possible to be null was not adding None to the enum if it exists.
    This causes validation to fail on ``None`` especially in the case of
    keystone's boolean parameter_type implementation. ``nullable()`` now
    adds ``None`` to the enum if the enum exists.

    Closes-Bug: #1763824
    Change-Id: I176fa90df63049661413c445554dba9b7d87272a

Changed in keystone:
status: In Progress → Fix Released
Morgan Fainberg (mdrnstm) wrote :

This also impacts ocata.

Morgan Fainberg (mdrnstm) wrote :

However, due to near EOL on ocata, there is no plan for the re-work backport of this fix. Ocata is explicitly being marked as "wont fix"

This issue was fixed in the openstack/keystone 14.0.0.0b1 development milestone.

Reviewed: https://review.openstack.org/561353
Committed: https://git.openstack.org/cgit/openstack/keystone/commit/?id=7bd6454e4721d1ff4935ad36e30e5420ad10e70e
Submitter: Zuul
Branch: stable/queens

commit 7bd6454e4721d1ff4935ad36e30e5420ad10e70e
Author: Morgan Fainberg <email address hidden>
Date: Fri Apr 13 13:34:31 2018 -0700

    Fix json schema nullable to add None to ENUM

    The JSON Schema validation implementation of nullable(), which makes
    values possible to be null was not adding None to the enum if it exists.
    This causes validation to fail on ``None`` especially in the case of
    keystone's boolean parameter_type implementation. ``nullable()`` now
    adds ``None`` to the enum if the enum exists.

    Closes-Bug: #1763824
    Change-Id: I176fa90df63049661413c445554dba9b7d87272a
    (cherry picked from commit 78adf4b40fb88e371101ed065ac1d15063d8d86e)

Reviewed: https://review.openstack.org/561354
Committed: https://git.openstack.org/cgit/openstack/keystone/commit/?id=22af1d9f35c86e9c5bca288c2996be5c19e3cd61
Submitter: Zuul
Branch: stable/pike

commit 22af1d9f35c86e9c5bca288c2996be5c19e3cd61
Author: Morgan Fainberg <email address hidden>
Date: Fri Apr 13 13:34:31 2018 -0700

    Fix json schema nullable to add None to ENUM

    The JSON Schema validation implementation of nullable(), which makes
    values possible to be null was not adding None to the enum if it exists.
    This causes validation to fail on ``None`` especially in the case of
    keystone's boolean parameter_type implementation. ``nullable()`` now
    adds ``None`` to the enum if the enum exists.

    Closes-Bug: #1763824
    Change-Id: I176fa90df63049661413c445554dba9b7d87272a
    (cherry picked from commit 78adf4b40fb88e371101ed065ac1d15063d8d86e)

This issue was fixed in the openstack/keystone 13.0.1 release.

This issue was fixed in the openstack/keystone 12.0.1 release.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers