cancel
Showing results for 
Search instead for 
Did you mean: 

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

SOLVED
Highlighted
New Contributor

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?

1 ACCEPTED SOLUTION

Accepted Solutions
Moderator

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

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.

4 REPLIES 4
Moderator

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

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?

New Contributor

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

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

 

Moderator

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

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.

New Contributor

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

Thanks so much.  I should have realized that earlier, but I thought there was a chance you might have seen something like this before.

New Here?
Join us and watch the welcome video:
API Testing Mistake #2
APITestingMistake#2
Top Kudoed Authors