Fix UUID json serialization#289
Merged
Merged
Conversation
Avoid issues to detect correct packages and allow relative imports
saaj
approved these changes
Dec 5, 2025
Contributor
saaj
left a comment
There was a problem hiding this comment.
Unifying to UUIDs is a good change.
* origin: Align isort check ignore blame to sort import Sort import on the codebase Add isort Ignore blame for black format applied to codebase Update python version for publishing Drop python 3.8 and 3.9 Remove sqlalchemy 1.3 Make it flake8 compatible Apply black format to the codebase Add black to the project and CI
This was referenced Dec 8, 2025
This was referenced Dec 8, 2025
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix #243
UUID json serialization
Solution
The problem is that by default the JSON encoder can not transform
UUIDclass to JSON. I introducedUuidJSONEncoderthat will invokestron it when making the HTTP answer.Testing issue
The tests did not catch the issue as it was mocked already using string UUID. I updated the mocked fixtures to be UUID as when coming from the DB.
Types
opentaxii.taxii2.entitiesdocumentedstrtypes. Instead, I updated to UUID when the TAXII2 specs expect anidentifierOpenTAXII2PersistenceAPImethod interfaces also highlight when a UUID is expectedapi_root_idandjob_idfromopentaxii.server.TAXII2ServerURL path to UUID. It makes less divergence with UUID used elsewhere. Only the path parametercollection_id_or_aliascan not be converted to UUID as it could also be an alias that is a string.Technical improvements
Typing
opentaxii/andtestsalthough some files are excluded as there were too many issues to fixTest package
tests/was not a package and used pytest magic to find root modules for tests. It started to create a conflict formypyas there were 2utilsmodules. I added a__init__.pywhere missing and updatingutilsandfixturesimports.