kongchen / swagger-maven-plugin

JAX-RS & SpringMVC supported maven build plugin, helps you generate Swagger JSON and API document in build phase.
http://kongchen.github.io/swagger-maven-plugin/
Apache License 2.0
761 stars 451 forks source link

Plugin not rendering `ExtensionProperty` as a JSON/YAML value #870

Open ghost opened 3 years ago

ghost commented 3 years ago

The swagger maven plugin doesn't adhere to the parseValue flag in the ExtensionProperty annotation. The docs suggest the following:

If set to true, field value will be parsed and serialized as JSON/YAML

API definition

 @ApiOperation(value = "create a user",
            response = User.class,
            extensions = {
                    @Extension(name = "x-authorities", properties = {
                            @ExtensionProperty(name = "roles",
                                    value = "[\"user_create\", \"user_admin\"]",
                                    parseValue = true)
                    })
            })

But when the final extension property is rendered it is a string in the swagger.json file.

"x-authorities": {
                    "roles": "[\"user_create\", \"user_admin\"]"
                }

Is this the intended behavior or am I missing something while configuring the plugin?