swagger JSON产生空值,它停止了UI

时间:2015-10-20 02:46:01

标签: json swagger swagger-ui

我正在使用swaggerspring mvc -1.0.2和jackson-databind 2.6.3。为什么它会产生空值。停止它吗?。停止swagger UI。 JSON

                    {
                        "parameterType": {
                            "absoluteType": "array"
                        },
                        "name": "file",
                        "description": "Pass File as input",
                        "defaultValue": "",
                        "required": true,
                        "allowMultiple": false,
                        "allowableValues": null,
                        "paramType": "query",
                        "paramAccess": null
                    }

1 个答案:

答案 0 :(得分:1)

您需要将JSON映射器配置为不写空值:

http://docs.spring.io/spring-boot/docs/current/reference/html/howto-spring-mvc.html#howto-customize-the-jackson-objectmapper

添加特定的序列化选项就像这样:

spring.jackson.serialization-inclusion:non_null