question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

@ApiModelProperty example property does not support Map data types

See original GitHub issue

When the @ApiModelProperty.dataType = “Map”, the JSON output of the example is invalid

For example:

@ApiModelProperty(
            value = "IdP-to-SP attributes mapping. A string map of key/value pairs with keys corresponding to IdP attributes as the source " +
                    "and values corresponding to SP attributes as target.  May be omitted or partially-defined to use default mapping.",
            example =   "{'firstName': 'fname', 'lastName' : 'lname'}",
           dataType = "Map[String,String]",
            required = false)
    public Map<String, String> getAttributeMapping();

Produces:

  "attributeMapping": "{'firstName': 'fname', 'lastName' : 'lname'}"

However it should produce:

  "attributeMapping": {'firstName': 'fname', 'lastName' : 'lname'}

The attributeMapping field is incorrectly treated like a string and quoted.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
fehguycommented, Dec 25, 2016

Follow #1107

0reactions
mejmocommented, Dec 11, 2018

Was it solved?

Read more comments on GitHub >

github_iconTop Results From Across the Web

ApiModelProperty example property does not support Map ...
I have a Rest service like : @POST @Path("/{myUrl") @Consumes(MediaType.APPLICATION_JSON) public Response upsertSwitchingInfo(@NotNull ...
Read more >
Swagger @ApiParam vs @ApiModelProperty - Baeldung
The @ApiParam annotation is for the parameters of an API resource request, whereas @ApiModelProperty is for properties of the model.
Read more >
ApiModelProperty (swagger-annotations 1.5.0 API)
Adds and manipulates data of a model property. ... A sample value for the property. boolean, hidden ... Specifies if the parameter is...
Read more >
Generating REST API Documentation with Swagger
Swagger is a framework used for generating RESTful API ... name, data type, example values, and allowed values for the model properties.
Read more >
OpenAPI 3 Library for spring-boot
Is based on swagger-ui, to display the OpenAPI description. ... dependency enables the support of spring-boot-starter-data-rest types like: ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found