diff --git a/marshmallow_jsonschema/base.py b/marshmallow_jsonschema/base.py index a8fb726..b75f1ca 100644 --- a/marshmallow_jsonschema/base.py +++ b/marshmallow_jsonschema/base.py @@ -54,7 +54,7 @@ set: {"type": "array"}, tuple: {"type": "array"}, float: {"type": "number", "format": "float"}, - int: {"type": "number", "format": "integer"}, + int: {"type": "integer"}, bool: {"type": "boolean"}, Enum: {"type": "string"}, } diff --git a/tests/test_dump.py b/tests/test_dump.py index ca3f316..50b9fa3 100644 --- a/tests/test_dump.py +++ b/tests/test_dump.py @@ -130,7 +130,7 @@ class TestSchema(Schema): nested_def = dumped["definitions"]["TestNamedNestedSchema"] nested_dmp = dumped["definitions"]["TestSchema"]["properties"]["nested"] assert nested_dmp["type"] == "object" - assert nested_def["properties"]["foo"]["format"] == "integer" + assert nested_def["properties"]["foo"]["type"] == "integer" def test_list(): @@ -198,7 +198,7 @@ class DictSchema(Schema): assert "additionalProperties" in nested_json item_schema = nested_json["additionalProperties"] - assert item_schema["type"] == "number" + assert item_schema["type"] == "integer" def test_dict_with_nested_value_field(): @@ -531,9 +531,8 @@ class TestSchema(Schema): assert dumped["definitions"]["TestSchema"]["properties"]["foo"] == { "enum": [v for v in mapping.values()], "enumNames": [k for k in mapping.keys()], - "format": "integer", "title": "foo", - "type": "number", + "type": "integer", } @@ -695,7 +694,7 @@ class TestSchema(Schema): "type": "object", "properties": { "field_1": {"type": "string", "title": "field_1"}, - "field_2": {"type": "number", "title": "field_2", "format": "integer"}, + "field_2": {"type": "integer", "title": "field_2"}, }, "additionalProperties": False, } diff --git a/tests/test_validation.py b/tests/test_validation.py index 4cac729..c8222bd 100644 --- a/tests/test_validation.py +++ b/tests/test_validation.py @@ -198,4 +198,4 @@ class TestSchema(Schema): foo_property = dumped["definitions"]["TestSchema"]["properties"]["foo"] assert {"title": "", "type": "string"} in foo_property["anyOf"] - assert {"title": "", "type": "number", "format": "integer"} in foo_property["anyOf"] + assert {"title": "", "type": "integer"} in foo_property["anyOf"]