Skip to content

Releases: Grokzen/pykwalify

1.8.0

30 Dec 22:33
Compare
Choose a tag to compare

1.8.0 (Dec 30, 2020)

General changes:

  • Dropped support for python 3.5 and below, including 2.7
  • ruamel.yaml is now the default and preffered yaml parser
  • Dropped support for pyyaml parser
  • Update minimum version of ruamel.yaml to 0.16.0
  • Update minimum version of python-dateutil to 2.8.0

CLI changes:

  • Added new cli argument "--encoding ENCODING" that specifies what encoding to open data and schema files with

Changed behaviour:

  • Enum error strings now output all possible values for easier debugging
  • Removed deprecated imp module. Dynamic imports imght be affected

New features:

  • Implement new type email that uses a relative simple regex to validate email addresses according to RFC 5322 Official Standard
  • Implement new type url that uses a relative simple regex to validate url:s according to RFC 1808
  • Add new argument "schema_file_obj" to Core class. Allows to pass in StringIO or similar interfaced objects to use for validation.
  • Add new argument "data_file_obj" to Core class. Allows to pass in StringIO or similar interfaced objects to use for validation.

Bug/issues fixed:

  • Fixed a regression from 1.6.1 where ruamel.yaml safe_load would break for all built-in custom python tags.
    All normal python tags should now be possible to use again.
  • Fixed an issue with regex values that was not converted to str() before regex mapping was attempted.
    This should validate things like integers and objects that support str() conversion better.

1.7.0

03 Oct 15:49
Compare
Choose a tag to compare

IMPORTANT LICENSE UPDATE IMPORTANT

  • In this release there was a line removed from the license file. It was modified in the following commit
    (cc4e31b Wed Oct 3 16:20:59 2018 +0200) and will be the main reason for
    the 1.7.0 release. All commits and tags and releases (1.6.1 and all releases before it) prior to this commit will
    use the old license that includes the change done in the above mentioned commit. Only release 1.7.0 and commits past
    this point will use the new/updated license file.

General changes:

  • Dropped support for python 3.3 and 3.4

1.6.1

13 Mar 22:10
Compare
Choose a tag to compare

New keywords:

  • Added support for keyword nullable. It is now possible to allow for a key not to be empty, when required keyword is not used.
  • Added support for keyword class. It will not cause any validation errors, but serves to make kwalify schemas compatible that uses that keywork.

Bug fixes:

  • Improved compatibility with unicodes to validate as strings.

Changed behaviour:

  • Propergate json and yaml loading errors when used from the cli to the user for easier debugging.

General changes:

  • Allow ruamel.yaml versions up to 0.16
  • License is now bundled with the built release.

1.6.0

22 Jan 22:36
Compare
Choose a tag to compare

New keywords:

  • Add support for keyword example. It does nothing and have no validation done on it.
  • Add support for keyword version. It does nothing and have no validation done on it.
  • Add support for keyword date and added support keyword format. This can be used to validate many different types of datetime objects.
  • Add support for keyword length. It is very similar to range but works primarily string types.
  • Add support for keyword assert. It works by running the python code assert and check if any exception is raised.
    This feature is considered dangerouns becuase there is only simple logic to prevent escaping out from validation.

Bug fixes:

  • Fixed a bug where regexes marked as 'required' in a map were matched as strings, rather than regexes.
  • Fixed a bug where the type validation did not work when schema specefied a sequence of map objects. It now outputs a proper ...is not a dict... error instead.
  • Fixed a bug in unique validation when a key that it tried to lookup in the data would not exists.
    Now it just ignores that it did not find any value becuase a missing value do not impact validation.
  • Fixed a bug with keyword ident when the rule value was verified to be a boolean. It now only accepts boolean values as expected.
  • Fixed a bug where if allowempty was specefied in a mapping type inside a sequence type then it would not properly validate.
  • Fixed a bug where loaded extensions would not allways work in complex & nested objects.
  • Fixed a major bug in very nested seq schemas where if the schema expected another seq but the value was something else it would not raise it as a validation error.
    This has now been fixed and now raises the proper error.
  • Fixed a bug where include directive would not work in all cases when used inside a key in a mapping block.

New features:

  • It is now possible to specify a default rule when using a mapping.
    The rule will be used whenever no other key could be found.
    This is a port of a missing feature from original kwalify implementation.
  • Added new helper method keywords to Rule class that can output all active keywords for any Rule object.
    This helps when debugging code to be able to easily dump what all active keywords for any Rule object.
  • Added new cli flag --strict-rule-validation that will validate that all used keywords in all Rule objects only uses the rules that is supported by each defined type.
    If you only use a Core object then set strict_rule_validation=True when creating the Core object instance.
    This feature is opt-in in this releaes but will be mandatory in releases >= 1.7.0.
  • Added new cli flag --fix-ruby-style-regex that will trim slashes from ruby style regex/patterns.
    When using this flag the first and last / will be trimmed of the pattern before running validation.
    If you only use a Core object then set fix_ruby_style_regex=True when creating the Core object instance.
    Default behaviour will still be that you should use python style regex values but this flag can help in some cases when you can't change the schema.
  • Added new cli flag --allow-assertions that will enable the otherwise blocked keyword assert.
    This flag was introduced so that pykwalify would not assert assertions without user controll.
    Default behaviour will be to raise a CoreError is assertion is used but not allowed explicitly.
    If you only use a Core object then set allow_assertions=True when creating the Core object instance.

Changed behaviour:

  • Removed the force of UTF-8 encoding when importing pykwalify package. It caused issues with jypiter notebooks on python 2.7.x
    Added documentation in Readme regarding the suggested solution to use PYTHONIOENCODING=UTF-8 if the default solution do not work.
  • Validation do no longer continue to process things like pattern, regex, timestamp, range and other additional checks
    if the type check fails. This can cause problems where previous errors will now initially be silenced when the typecheck for
    that value fails, but reappear again when the type check is fixed. (sbrunner)
  • Catches TypeError when doing regex validation. That happens when the value is not a parsable string type.
  • Checking that the value is a valid dict object is now done even if the mapping keyword is not specefied in the schema.
    This makes that check more eager and errors can apear that previously was not there.
  • Changed the sane default type if that key is not defined to be str. Before this, type had to be defined every time and the default type did not work as expected.
    This is a major change and can cause validation to either fail or to stop failing depending on the case.
  • Changed validation for if a value is required and a value in a list for example is None. It now adds a normal validation errors instead of raising a CoreError.
  • Value for keyword desc now MUST be a string or a RuleError will be raised.
  • Value for keyword example now MUST be a string or a RuleError will be raised.
  • Value for keyword name now MUST be a string or a RuleError will be raised.

General changes:

  • Ported alot of testcases directly from Kwalify test data (test-validator.yaml -> 30f.yaml & 43s.yaml) so that this lib can have greater confidence that rules is implemented in the same way as Kwalify.
  • Refactored test_core_files method to now accept test files with multiple of documents. The method now tries to read all documents from each test file and run each document seperatly.
    It now alos reports more detailed about what file and document that fails the test to make it easier to track down problems.
  • Major refactoring of test files to now be grouped based on what they are testing instead of a increased counter that do not represent anything.
    It will be easier to find out what keywords lack tests and what keywords that have enough tests.

1.5.2

12 Nov 20:45
Compare
Choose a tag to compare
  • Convert all documentation to readthedocs
  • True/False is no longer considered valid integer
  • python3 'bytes' objects is now a valid strings and text type
  • The regular PyYaml support is now deprecated in favor of ruamel.yaml, see the following link for more details about
    PyYaml being deprecated https://bitbucket.org/xi/pyyaml/issues/59/has-this-project-been-abandoned
    PyYaml will still be possible to use in the next major release version (1.6.0) but removed in release (1.7.0) and forward.
  • ruamel.yaml is now possible to install with the following command for local development pip install -e '.[ruamel]'
    and for production, use pip install 'pykwalify[ruamel]'
  • ruamel.yaml is now used before PyYaml if installed on your system
  • Fixed a bug where scalar type was not validated correctly.
  • Unpin all dependencies but still maintain a minimum versions of each lib
  • Allowed mixing of regex and normal keywords when matching a string (jmacarthur)

1.5.1

06 Mar 12:57
Compare
Choose a tag to compare
  • Improvements to documentation (scottclowe).
  • Improved code linting by reworking private variables in Rule class to now be properties and updated
    all code that used the old way.
  • Improved code linting by reworking all Log messages to render according to pep standard.
    (By using %s and passing in variables as positional arguments)
  • Fix bug when validating sequence and value should only be unicode escaped when a string
  • Improve validation of timestamps.
  • Improve float validation to now accept strings that is valid ints that uses scientific notation, "1e-06" for example.
  • Update travis to test against python 3.6

1.5.0

30 Sep 21:41
Compare
Choose a tag to compare
  • float / number type now support range restrictions
  • ranges on non number types (e.g. seq, string) now need to be non negative.
  • Fixed encoding bug triggered when both regex matching-rule 'any' and 'all' found keyword that
    failed regex match. Added failure unit tests to cover regex matching-rule 'any' and 'all' during
    failed regex match. Updated allowed rule list to include matching-rule 'all'.
  • Changed _validate_mappings method from using re.match to re.search. This fixes bug related to
    multiple keyword regex using matching-rule 'any'. Added success unit tests to test default, 'any',
    and 'all' matching-rule.

1.4.1

31 Aug 11:25
Compare
Choose a tag to compare
  • Added tests to sdist to enable downstream packaging to run tests. No code changes in this release.

1.4.0

04 Aug 07:15
Compare
Choose a tag to compare
  • Dropped support for python 3.2 becuase of unicode literals do not exists in python 3.2.
  • Fixed logging & raised exceptions when using unicode characters inside schemas/data/filenames.
  • Reworked all RuleError exceptions to now have better exception messages.
  • RuleError exceptions now have a unique 'error_key' that can make it easier to identify what error it is.
  • Paths for RuleErrors have been moved inside the exception as a variable.
  • Rewrote all SchemaConflict exceptions to be more human readable.

1.3.0

13 Jul 22:35
Compare
Choose a tag to compare
  • Rewrote most of the error messages to be more human readable. See docs/Upgrade Instructions.md
    for more details.
  • It is now possible to use the exceptions that was raised for each validation error. It can be
    found in the variable c.validation_errors_exceptions. They contain more detailed information
    about the error.