-
-
Notifications
You must be signed in to change notification settings - Fork 12
/
HISTORY
375 lines (284 loc) · 11.9 KB
/
HISTORY
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
2.10
====
Changes
-------
- Remove simplejson as a fallback. Is no longer required with Python 3.8 plus and
has worse performance that the builtin json module.
- Simplify the internals of the Resource metaclass to make it easier to understand
and maintain. Greater sharing of code between Resource and AnnotatedResource
This change has not effect on the public API.
Removes some compatibility code with versions prior to Python 3.8.
- Support shadowing of fields on a resource. To enabled this feature set the
``allow_field_shadowing`` meta option to ``True``. This allows for fields to be
overridden on a resource.
ResourceObjects now includes a shadow_fields listing all fields shadowed by this
resource.
Bugfix
------
- ResourceOptions.abstract flag was not being set for abstract AnnotatedResrouces.
2.9
===
Changes
-------
- Add support for delayed resolution of types for composite fields. This
allows for tree structures to be defined.
Use ``DictAs.delayed(lambda: CurrentResource)`` to define a composite field that
uses the current resource as the type for the dict.
2.8.1
=====
Changes
-------
- Add beta contrib package for generating a JSON Schema from an Odin resource.
2.8
===
Changes
-------
- Change behaviour of create_resource_from_dict to not raise Validation errors
from ``field.to_python`` when ``full_clean`` is ``False``.
Allows for invalid documents to still be loaded with invalid data to allow
for correction of data and to prevent data loss.
- Introduce Pre-commit, PyUpgrade, isort, ruff and black.
2.7
===
Bug fixes
---------
- TypedDictField now includes a prepare method to ensure types are cast correctly for serailisation.
2.6
===
- Redesign of TraversalPath to make it more useful. Provides more information about the path to allow
it to be used in more ways that just for fetching a value from a document.
2.5
===
- Add ValidationErrorCollection helper for simplifying collection of errors in custom validation code.
- Change behaviour of to_python method on a CompositeField to not do a full clean.
This is not required as this should be completed during the validation stage.
This prevents double validation and solves the issue of resources not being populated at all if
any contained field contains an error.
2.4
===
- Add contrib.rich to provide pre-built rich integration for rendering ``ValidationErrors`` as a tree
- Improve ValidationError
- Add ``for_field`` class method to simplify creating an exception related to a specific field.
- Improve type annotations
- Improve error handling of Validator rendering in sphinx contrib.
- Improve description of validators for documentation.
- Improve type annotations in validators.
- Updates to documentation
- Add decorators to docs
- Additional docs for validators
- Additional docs for Sphinx extension
2.3.1
=====
Bug fix
-------
- ResourceOptions.composite_fields filtered composite field by Resource instead of ResourceBase.
2.3
===
- Add meta option to specify how to format field names for serialisation. For example
support being able to specify camelCase.
- Updates to documentation
- Add field_name_format meta option to docs
- Document odin.utils
2.2
===
- Fix a bug where annotated resource fields failed to get resolved.
- Fix issues where functools.cached_property does not work on annotated resources as __set_name__
was not being called.
- Updates to documentation
- Introduce integration example for mapping Django models
- Flesh out mapping documentation
- Fix missing link to dict_codec reference.
2.1
===
Annotated Resources
-------------------
- Final fields are now mapped to ConstantField and require a default value.
- Fix issue where the Toml codec did not recognise annotated resources in dump and dumps functions.
Breaking changes
----------------
- Virtual fields ConstantField and CalculatedField now require keyword arguments for options.
2.0
===
- Annotated Resources!
- Use annotations to define your resources including Aliases for Email, URL's and UUID's
- Drop support for Python <3.8, officially tested on Python 3.8+
- Removed a number of dependencies that where only required for Python <3.8 eg
(enum, six etc)
- Removed deprecated features:
- odin.csv_codec.ResourceReader
- odin.serializers.DatetimeEcmaFormat
- Improvements to typing and utilising of modern Python features
- Fix bug in toml_codec that prevented the use of the include_type_field option.
- Invalid choices now generate a ValueError exception
- New fields for builtin Python types
- odin.PathField
- odin.RegexField
- Use builtin datatime.timezone.utc instead of custom UTC instance
1.8.1
=====
- Change composite field to pass the resource the field is defined with rather
than the name of the field, this allows namespace and typing to work correctly.
1.8.0
=====
- Allow types to be resolved by assuming a types names space (simplifies
specification of types where the full name space can be assumed)
- Inherit a custom type_field (this could cause unexpected side effects,
although unlikely as this is a required change)
1.7.3
=====
- Fix bug where __classcell__ was not passed into super_new during metaclass
construction. This causes a RuntimeError with Python 3.8+ if the metaclass is
subclassed.
1.7.2
=====
- Fix an edge case bug where validators are not executed against empty list/dict
fields.
- Ensure that all validate and run_validators are executed on all entries in a
typed list field
1.7.1
=====
- Tweak to generation of sphinx choices so TypedLists use choices from type.
- Fix issue in Sphinx plugin where ``choices_doc_text`` was not used to format
choice values.
- Add TypedDictField to docs
1.7.0
=====
- Migrate from collections.Iterable to typing.Iterable to remove a warning
- Add user defined metadata to Resource.Meta object
- Add a reserved word guard, starting with fields (using fields causes
clean_fields to go into a infinite recursion loop)
1.6.2
=====
- Migrate string formatting from % to "".format
- Apply black code style on all code
- Improve some type hints
- Add a Text block to XML Codec
1.6.1
=====
- Fix poetry config error that restricted Python versions > 3!
1.6.0
=====
- Remove encoding option for msgpack (this has been removed from msgpack itself)
- Correct some typing inconsistencies (EnumField was the most obvious fix)
- Package is now managed by poetry
- Migrate to GitHub Actions
- Static analysis and Coverage reporting now handled by SonarCloud.
- Toml Codec
1.5.2
=====
- Relax overly tight dependency specification. Removed pyup.io it is not suitable
for packages.
1.5
===
- Improvements to sphinx autodoc generation
- Improvements to enum support
1.0b2
=====
- Added a redesigned CSV codec Reader to address issues with handling row-by-row
processing and handling of row-level errors.
- Removed filter-query (moved to feature branch)
0.10b9
======
- Added support for MultiPartField field type. A virtual field that allows for
the easy generation of key values composed of several other fields.
- Documentation updates and some initial type hints added (using :type... style)
- Allow a virtual field to be identified as a key
- Introduce a common base class for ALL field types, this allows them to be identified
separately via hash (for sorting and keys)
- Tweaked the new string.empty option so by default it behaves in the same way as
it was previously defined (eg null assumes empty)
0.10b
=====
- Possible breaking change with date and time serializers, they no longer apply
a timezone as this is expected to be managed by date and time fields.
- Added getmeta tool for getting meta data.
- Changes to Resource/Meta options to allow for them to be overridden.
- Fixes regarding ResourceBase/Resource changes
0.9
===
- Fixed bug preparing naive date and time values.
0.9a0
=====
- Support for multipart keys.
- Support for naive dates and times.
- Boolean fields now accept y/n as truthy
- Change of Resource iterable base class
0.8.2
=====
- Migrated all tests to py.test
- Support for Python 2.6 for _most_ features (some contrib features are not supported
see docs for detail)
0.8.1
=====
- Bug fix for compatibility.deprecated decorator. Was breaking baldr when handling
classes.
- Some documentation fixes.
0.8
===
- Added key_fields to resource meta options. This allows definition of which field(s)
are used to uniquely identify the resource.
- Added support to TraversalPath (and ResourceTraversalIterator) for using key_fields,
both generating and traversing a Resource tree.
- CodecDecodeError and CodecEncodeError now inherit off CodecError.
- TraversalPath now raises multiple error types InvalidPathError, NoMatchError,
and MultipleMatchesError
- Some additional tweaks to inspect tool, as of now is still only available to
Python 3.
- Additional test cases.
0.7
===
- Python 3.5 added for Travis CI test runner
- Added empty flag to ListOf and DictOf files to validate if fields is allowed to
be empty
- Added key_choices to DictOf field to allow allow keys to be validated
- Added TypedDictField this is a analog of the TypedListField but for dict objects
- Project is now owned by the python-odin group
- Initial work on combined string serialisation framework. This is to unify text
serialisation support between the various codecs so additional serialises only
need to be registered in a central location.
- Added DictCodec, this is codec for converting between a dict structure and resource
structure. As Resource.to_dict is explicitly designed to not act in a recursively
this codec fills in a gap where a developer my require a nested dict to be generated.
- Initial implementation of resource filtering. Filtering allows for a filter expression
to be defined and used to filter a list of resources or ensure a particular resource
matches the expression. Expressions are easy to define and read and allow for
filtering against sub-resources etc.
- Added caching to the results of mapping operations. Previously iterating through
a mapping multiple times caused the mapping to be re-run. This has been made the
default behaviour, if the previous behaviour is desired the MappingResult class
can be provided to Mapping.apply instead of CachingMappingResult.
- ResourceAdapter.apply_to now caches Meta object of matching resources types, previously
a new meta object was created for each resource.
- ResourceAdapterOptions.virtual_fields is now filtered using include/exclude options.
- More tests, more docs
- Various bug fixes.
0.6
===
Odin
----
- Changed the generated type name for mapping factory to ensure a more unique name.
- Pass through excluded_fields when generating types in mapping factory.
- Added ignored fields parameter to be provided to Resource.convert_to method.
- Added included fields parameter to the Mapping.update method
- Updated the ResourceAdapter interface to match that of a normal Resource, can
now be used in place of a Resource with any codec.
- Added ResourceAdapter.apply_to method that simplifies applying a resource adapter
to a list of Resources.
- Updated create_resource_from_dict to accept a list and return a list of resources.
- Fixed bug in auto-mapping generation of MapListOf fields to set the to_list flag
correctly
- Added forward_mapping_factory a shortcut version of mapping_factory when only
a forward mapping is required.
- Added the assign (similar to the define shortcut) shortcut for defining an assignment
mapping
- Fixed a bug where performing a full clean on a Resource that was created via a
mapping would fail when a MappingResult object was encountered.
- Added ResourceOptions.element_field_map for use in XML codecs
- Added container flag and ResourceOptions.container_fields for XML style codecs
- Large number of documentation updates
- Fixed bug where Mapping.loop_idx was not being updated correctly, after 2 levels
of nesting the wrong index was being updated.
Sphinx Integration
------------------
- Add max length into resource documentation
- Added description to validators that can be used in sphinx documentation