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

Validate custom type/property name formats #384

Merged
merged 18 commits into from
Apr 3, 2020
Merged

Conversation

clenk
Copy link
Contributor

@clenk clenk commented Apr 3, 2020

  • Extends the class hierarchy to check version for validating property name format.
  • Uses TypeProperty to validate type name format.
  • Cleans up core.py by moving some base classes to base.py, making them private, and renaming core.py to parsing.py.
  • Cleans up some inconsistencies with the custom type builder and registration functions.

Builds off of @rpiazza's work in #375, fixes #365, fixes #368.

rpiazza and others added 18 commits March 19, 2020 10:40
Renamed STIXDomainObject -> _DomainObject.
Renamed STIXRelationshipObject -> _RelationshipObject.
And pin medallion version for testing.
TypeProperty uses a fixed value, so check() was never called. This way
also runs the check at object registration time because the wrapper
creates an instance of TypeProperty and doesn't have to wait for the
object to be instantiated so clean() can be called.
Also fix some tests.
Made them consistent with _register_observable_extension, by:
- moving validation logic there from _custom_*_builder functions
- using a new function for ensuring properties are dict-like
- using the library default spec version instead of None

Fix #371, fix #372, fix #373.
@emmanvg emmanvg added this to the 1.4.0 milestone Apr 3, 2020
@clenk clenk merged commit df92770 into master Apr 3, 2020
@emmanvg emmanvg deleted the 365-versioned-classes branch April 3, 2020 21:33
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.

Custom property names must match [a-z0-9_] Type and property names must begin with a letter
3 participants