jazzband / jsonmodels

jsonmodels is library to make it easier for you to deal with structures that are converted to, or read from JSON.
http://jsonmodels.readthedocs.org/en/latest/
BSD 3-Clause "New" or "Revised" License
334 stars 51 forks source link

Added new field: DictField #141

Closed robertofd1995 closed 3 years ago

robertofd1995 commented 3 years ago

The new field allows storing a dictionary without having to be constrained to a given schema. The schema type is "object", according to JSON schema

My use case and why I implemented and tested this:

I am creating some new models in my project and we usually save some fields that need to be store for extra purposes but it doesn't' make sense to create a field for each of these fields. In my case for a video/audio codec handler.

It has been tested and I also added an example of the field in the documentation.

Thanks for the effort in creating this cool library, if there is any issue let me know.

@beregond please take a look and if possible let me know once it will be published into pip so I can update my project. Thansk

codecov[bot] commented 3 years ago

Codecov Report

Merging #141 (6a209d0) into master (9ac8966) will not change coverage. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            master      #141   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            8         8           
  Lines          746       752    +6     
  Branches       155       157    +2     
=========================================
+ Hits           746       752    +6     
Impacted Files Coverage Δ
jsonmodels/builders.py 100.00% <100.00%> (ø)
jsonmodels/fields.py 100.00% <100.00%> (ø)
jsonmodels/parsers.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 9ac8966...6a209d0. Read the comment docs.

beregond commented 3 years ago

Hey @robertofd1995 - thanks! will take a look, we definitely need some schemaless fields here

robertofd1995 commented 3 years ago

Hi @beregond is there any reason for not merging this?

I saw the other ticket, in which you mention the PRs that fix this, but given that the other right now is breaking the CI pipeline and this one isn't, I would say is better to have at least this merge as the beginning of maybe a more elaborated version, before it get's out of date.

Kind regards, Roberto

beregond commented 3 years ago

Hey @robertofd1995 - yes, this is the best candidate for DictField right now - I'll push this to release as fast as possible :slightly_smiling_face: