Forum Discussion

Tom-Caruso's avatar
Tom-Caruso
New Contributor
6 years ago

Definition not created for Map<<String,Object>>

I'm new to Swagger and I have a problem with a definition file generated for one of our services.  The endpoint returns a List<Map<String,Object>> where the Object represents columns in a database record.  The Swagger definition file defines the response object as:

 

"responses":{
"200":{
"description":"OK",
"schema":{
"type":"array",
"items":{
"$ref":"#/definitions/Map«string,object»"
}
}
},
"401":{
"description":"Unauthorized"
},
"403":{
"description":"Forbidden"
},
"404":{
"description":"Not Found"
}
},

 

The $ref definition is not found in the definition file and the file fails validation when validated with swagger-cli. The error message is:

Error resolving $ref pointer "example.json#/definitions/Map«string,object»".
Token "Map«string,object»" does not exist.

 

Our site admins will not allow definition files that fail this validation to our local SwaggerHub, so this is holding up publishing the API.  Does anyone have ideas how to solve this problem and why that token is not created?

  • Yes, thank you. The thing is, Springfox is not one of our libraries, and we don't know it well enough to provide support for it. It does use our swagger-core annotations, but the parsing of the annotations is done soley by Springfox. There should be a solution for your use case though, so I'd suggest filing a ticket with the project, and hopefully they can help you out.

  • It sounds like you're generating the definition from the code. Which library do you use to generate the definition? Which development language and framework?

    • Tom-Caruso's avatar
      Tom-Caruso
      New Contributor

      Hi,

      Yes, we are generating the definitions from existing Java code in the Spring Boot framework.  Since this is a Spring app, we are using springfox-swagger-ui and springfox-swagger2, both are version 2.9.2.  I got around the validation issues by manually editing the files until they pass validation, but I'd rather not do this all the time.

       

      Is this enough information for you?

      Tom

       

      • RonRatovsky's avatar
        RonRatovsky
        Staff

        Yes, thank you. The thing is, Springfox is not one of our libraries, and we don't know it well enough to provide support for it. It does use our swagger-core annotations, but the parsing of the annotations is done soley by Springfox. There should be a solution for your use case though, so I'd suggest filing a ticket with the project, and hopefully they can help you out.