JSON schema validator.nullable doesn't work with ENUMs

Bug #1763824 reported by Morgan Fainberg
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Identity (keystone)
Fix Released
Medium
Morgan Fainberg
Ocata
Won't Fix
Medium
Unassigned
Pike
Fix Committed
Medium
Lance Bragstad
Queens
Fix Committed
Medium
Lance Bragstad
Rocky
Fix Released
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

Revision history for this message
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)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to keystone (master)

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

Changed in keystone:
status: Triaged → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to keystone (stable/queens)

Fix proposed to branch: stable/queens
Review: https://review.openstack.org/561353

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to keystone (stable/pike)

Fix proposed to branch: stable/pike
Review: https://review.openstack.org/561354

description: updated
Changed in keystone:
assignee: Morgan Fainberg (mdrnstm) → Lance Bragstad (lbragstad)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on keystone (stable/queens)

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

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on keystone (stable/pike)

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

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to keystone (master)

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
Revision history for this message
Morgan Fainberg (mdrnstm) wrote :

This also impacts ocata.

Revision history for this message
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"

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/keystone 14.0.0.0b1

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

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to keystone (stable/queens)

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)

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to keystone (stable/pike)

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)

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/keystone 13.0.1

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

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/keystone 12.0.1

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  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.