Repository navigation
Mockgun: support currency, timecode, uuid, color, password, image and jsonb fields - #466
Open
patrickwolf wants to merge 1 commit into
Open
patrickwolf wants to merge 1 commit into
patrickwolf wants to merge 1 commit into
Conversation
… jsonb fields Writing to a field of one of these types raised "Handling for Flow Production Tracking type ... is not implemented", so a schema read from a real site could not be written to. They are now validated by the Python type the server takes, and filtered and sorted like the type that holds the same values. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
patrickwolf
force-pushed
the
mockgun-more-field-types
branch
from
November 16, 2026 17:45
09c49ef to
6f11d01
Compare
This branch has not been deployed
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.
Problem
Writing to a field of type
currency,timecode,uuid,color,password,imageorjsonbraisesMost real sites have such fields, so a schema read from a real site with
generate_schemacannot be written to. The schema shipped intests/mockgunalready hascolor,uuid,passwordandimagefields.Change
_validate_entity_datachecks these types against the Python type the server takes:currencyan int or a float,timecodean int,jsonba dict, the others a string (animagefield holds a URL)._get_field_typereports them as the type that holds the same values (currency→float,timecode→number,uuid/color/password→text), so filters andorderwork on them.schema_field_readstill reports the real type.Tests
TestMoreFieldTypes: write and filter acolorand animagefield, and a wrong Python type is still rejected.Merge order
Independent of the other Mockgun PRs (default value types, limit and page, upload), but each of them also adds its test class at the end of
tests/test_mockgun.py, and "limit and page" also adds a constant next to this one's below the imports ofmockgun.py. Whichever is merged later needs a rebase that keeps both sides.