swagger JSON produces null value it stops UI

房东的猫 提交于 2019-12-24 19:00:22

问题


I am using swaggerspring mvc -1.0.2 and jackson-databind 2.6.3.why it produce null value.how stop it?.it stopping 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:


You need to configure your JSON mapper to not write null values:

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

And adding the specific serialization option is like such:

spring.jackson.serialization-inclusion:non_null


来源:https://stackoverflow.com/questions/33227114/swagger-json-produces-null-value-it-stops-ui

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!