Avro
  1. Avro
  2. AVRO-1284

Python: validation should be a method of Schema objects

    Details

    • Type: Improvement Improvement
    • Status: Patch Available
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: 1.8.0
    • Component/s: python
    • Labels:

      Description

      In Python, validation of a datum by the schema was done in avro.io.validate function.
      The avro.io.validate function is a complex, recursively-called switch statement.

      Instead of calling a two-argument avro.io.validate with a Schema object and a datum, it is easier to understand and extend if they are one-argument methods on the schema.

      I (Jeremy) have written a patch that implements validate methods on Schema objects. This patch will form the prerequisite for AVRO-1265 (see "easier to extend" above).

        Activity

        Doug Cutting made changes -
        Fix Version/s 1.8.0 [ 12323299 ]
        Fix Version/s 1.7.5 [ 12324096 ]
        Jeremy Kahn made changes -
        Status Open [ 1 ] Patch Available [ 10002 ]
        Hide
        Jeremy Kahn added a comment -

        Seems to be a working fix. tests pass.

        Show
        Jeremy Kahn added a comment - Seems to be a working fix. tests pass.
        Jeremy Kahn made changes -
        Labels patch
        Jeremy Kahn made changes -
        Status In Progress [ 3 ] Open [ 1 ]
        Jeremy Kahn made changes -
        Hide
        Jeremy Kahn added a comment -

        The validation-as-method-backwards-compatible patch maintains the functional behavior of avro.io.validate by calling the method indirectly, in case users are calling avro.io.validate.

        Prefer this patch to the simpler validation-as-method patch.

        Show
        Jeremy Kahn added a comment - The validation-as-method-backwards-compatible patch maintains the functional behavior of avro.io.validate by calling the method indirectly, in case users are calling avro.io.validate . Prefer this patch to the simpler validation-as-method patch.
        Jeremy Kahn made changes -
        Attachment validation-as-method.patch [ 12575433 ]
        Jeremy Kahn made changes -
        Field Original Value New Value
        Status Open [ 1 ] In Progress [ 3 ]
        Jeremy Kahn created issue -

          People

          • Assignee:
            Jeremy Kahn
            Reporter:
            Jeremy Kahn
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:

              Development