Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Definition schema class #135

Merged
merged 11 commits into from Aug 25, 2015

Conversation

funkyfuture
Copy link
Member

this includes a commit that improves DefinitionSchema and one that fixes an issue that came up in the doctests for the first time.

the purpose of these changes was to let DefinitionSchema behave like a proper dictionary
to allow safe runtime-manipulation of a schema.
if such manipulation raises an exception that is handled, the previous state is retained.

while working on it, i stumbled over some issues that are addressed.

to have more descriptive and unambigious names:

- renames ValidationError to DocumentError
- renames ERROR_SCHEMA_TYPE to ERROR_SCHEMA_TYPE_TYPE
  - ERROR_SCHEMA_CONSTRAINT_TYPE_TYPE would be more correct
- renames ERROR_SCHEMA_FORMAT to ERROR_SCHEMA_TYPE
- adds a ERROR_SCHEMA_CONSTRAINT_TYPE for constraints that are not defined as mapping

other:

- exceptions are inherited from Exception, so they are not caught by `except ValueError`
@funkyfuture funkyfuture force-pushed the definition_schema_class branch 2 times, most recently from 9e1fa72 to ac08315 Compare August 8, 2015 22:54
@funkyfuture
Copy link
Member Author

i added some commits to purge the in-code-backlog

well, more tests would be possible. :-/

@funkyfuture funkyfuture force-pushed the definition_schema_class branch 4 times, most recently from e5e4c36 to 0b8fc4f Compare August 9, 2015 21:30
@@ -51,6 +51,9 @@ matters, we can use it to validate all odd values:
>>> v.validate({'oddity': 9})
True

In a schema schema you can use space characters instead of underscores, e.g.
``{'oddity': {'is odd': 42'}}`` is an alias for ``{'oddity': {'is odd': 42'}}``.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

@nicolaiarocci
Copy link
Member

Nice. Would you also update CHANGES to reflect the change from ValidationError to DocumentError, and error constants which have changed names?

@funkyfuture
Copy link
Member Author

update: i added some rules related to normalization. @misja this might be of interest for you.

tomorrow or the day after i'll propably fully update CHANGES and add a trail-property to Validator. (and then i'll stop piling things up here.)

also removes an obsolete check when validating a dict for 'schema'-rule
@funkyfuture
Copy link
Member Author

a'ight, i added the last commits to this pr.
the trail-property is just added more as proof-of-concept , without much use of it. i will certainly use it when refactoring error-representation (#93). it may be useful for rules like dependencies on parent- / siblings-fields, or conditional validation like requested in #136.

@funkyfuture funkyfuture mentioned this pull request Aug 20, 2015
@nicolaiarocci nicolaiarocci merged commit d80e82f into pyeve:master Aug 25, 2015
@funkyfuture funkyfuture deleted the definition_schema_class branch October 6, 2015 15:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants