Changelogs » Format-oc



While porting the library to PHP I found numerous small bugs and removed some unnecessary code that caused complications.
- Removed the ability to add options to "any".... because it's "any"!
- Added to ability to add options for "uuid".
- Added tests for "base64" options.
- Added missing checks for min and max in ArrayNode.valid calls.
- Added missing type() method to ArrayNode.
- Added the optional() method to _BaseNode
- Renamed _BasicNode to _BaseNode as that's what it actually is.
- Renamed Parent.__requires() to Parent.requires() and made it get as well as set.
- Fixed a bug where OptionsNode were being built as Nodes in _child calls.
- Fixed bug that was storing the node definition under the key in toDict calls.
- Removed erroneous "base64" min/max check in Node.valid.
- Removed a warning if array type is not set, it defaults to "unique" and that's ok.


- Removed regexes from all but strings as they were unnecessary and added complexity to the code.
- Changed minmax, options, regex calls to public and made them both getters and setters.
- Several fixes for how Decimals/prices are validated/cleaned.
- Made .type() method only available for ArrayNodes and Nodes, and added new .class() method to do what the old .type() method did. Makes it much easier to figure out what a node actually is and how it works.


Previous versions had broken the ability to set __hash__ to true, as true is not a valid Node type. Now true will be treated as any valid string allowing for backwards compatibility with old definitions.

Now, rather than a simple True to set a Hash, a Node object, `{"__type__":"string", "__regex__":"^\d+$"}` or a simple string `"uuid"` is expected so that keys can be uniform and validated just like values


FormatOC now works seemlessly in both python2 and python3

A new error system uses validation_failures, a list of lists all errors, rather than just the last one, e.g.
node.validation_fail_name, node.validation_fail_value
node.validation_failures[0][0], node.validation_failures[0][1],
node.validation_failures[1][0], node.validation_failures[1][1],

Old PHP style docblocks have been completely replaced with proper python """ """  comments.