Ask a Question

Auto generating schemas for resources when I don't want it to

New Contributor

Auto generating schemas for resources when I don't want it to

I have a question about swagger openapi 3.0.3.


I generate a bunch of resources like this:


$ref: './methods/customers/customerId/siteId/systemId/system.yaml'

which links to:


description: 'describe a system'
summary: 'describe a system'

description: 'system description'
$ref: "../../../../../schemas/SystemInfo.yaml"

which links to a schema whose actual contentents aren't very important.  What's important is that when the swagger output gets generated, I end up with two objects in the Schemas:

  • - One is named "SystemInfo" which is what I expect
  • - One is named just "system" but I didn't ask for this, it just appeared

Sometimes I'll have several paths/methods that return SystemInfo.  In that case, it makes SystemInfo, system, system_1, system_2, ... 


I can't figure out why it's doing this or how to inhibit it.  In what situations would a 'schema' object be automatically generated?







Hi @wz2b ,


This is not my expertise. Could you expand on what you're seeing the duplicates? Is it in the Java POJO, or in the generated OpenAPI output? 

There are some options to control filtering and mapping, which can be found here: .


New Contributor

I'm not an expert, either . I'm using this [Official Jetbrains Plugin](  It doesn't seem to give you much in the way of generation options.  I'm not actually trying to generate any code (yet) - just documentation and the live test features - but maybe I should try to generate code and see if that helps me figure out where these extra objects are coming from.


The names of the objects do seem to line up with the paths.  If I generate an object /xyz it will make an object /xyz even if the Response type is my own type.  It generates mine, plus its own that is empty.  It's strange.



@wz2b , there is also the official SwaggerHub plugin on IntelliJ (if you want to see if there is a difference, ) but I don't think either of the IDE plugins is where the issues are. 


Are you writing the YAML yourself, or using code annotations in Java? 


Showing results for 
Search instead for 
Did you mean: