Skip to content

Commit e6721e6

Browse files
committed
Fix distinct string formats
1 parent cb99f57 commit e6721e6

File tree

4 files changed

+12
-2
lines changed

4 files changed

+12
-2
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Changelog
22

3+
#### 0.17.4 - 2020-08-26
4+
- fixed string schemas with different `format` keywords (#63)
5+
36
#### 0.17.3 - 2020-07-17
47
- improved handling of overlapping `items` keywords (#58)
58

src/hypothesis_jsonschema/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
The only public API is `from_schema`; check the docstring for details.
44
"""
55

6-
__version__ = "0.17.3"
6+
__version__ = "0.17.4"
77
__all__ = ["from_schema"]
88

99
from ._from_schema import from_schema

src/hypothesis_jsonschema/_canonicalise.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
TYPE_SPECIFIC_KEYS = (
3636
("number", "multipleOf maximum exclusiveMaximum minimum exclusiveMinimum"),
3737
("integer", "multipleOf maximum exclusiveMaximum minimum exclusiveMinimum"),
38-
("string", "maxLength minLength pattern contentEncoding contentMediaType"),
38+
("string", "maxLength minLength pattern format contentEncoding contentMediaType"),
3939
("array", "items additionalItems maxItems minItems uniqueItems contains"),
4040
(
4141
"object",

tests/test_canonicalise.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,13 @@ def test_canonicalises_to_expected(schema, expected):
273273
([{"type": "integer"}, {"type": "number"}], {"type": "integer"}),
274274
([{"multipleOf": 0.25}, {"multipleOf": 0.5}], {"multipleOf": 0.5}),
275275
([{"multipleOf": 0.5}, {"multipleOf": 1.5}], {"multipleOf": 1.5}),
276+
(
277+
[
278+
{"type": "string", "format": "color"},
279+
{"type": "string", "format": "date-fullyear"},
280+
],
281+
None,
282+
),
276283
(
277284
[
278285
{"type": "integer", "multipleOf": 4},

0 commit comments

Comments
 (0)