Fully qualified names for static nested classes produce semantically incorrect component names with the '$' sign
Fully qualified names for static nested classes contain the $ sign (standard Java convention) the resulting component names created using this naming are incorrect according to the OpenAPI specification:
The component names can consist of the following characters only: A..Z a..z 0..9 . _ -
For example the class with a field with a type of the static nested class like this:
public class MyMainClass {
private String name;
private MyStaticNestedClass address;
private static class MyStaticNestedClass {
private String postalCode;
}
}
will produce OpenAPI component names like this:
{
"com.example.MyMainClass": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"address": {
"$ref": "#/components/schemas/com.example.MyMainClass$MyStaticNestedClass"
}
}
},
"com.example.MyMainClass$MyStaticNestedClass": {
"type": "object",
"properties": {
"postalCode": {
"type": "string"
}
}
}
}
As you can see the name of the component com.example.MyMainClass$MyStaticNestedClass contains the $ sign which is not allowed according to the OpenAPI naming requirements. The Swagger Editor will show you these validation errors:
Component names can only contain the characters A-Z a-z 0-9 - . _ $ref values must be RFC3986-compliant percent-encoded URIs
Perhaps a simple replacement of all $ signs with _ in component names will fix this problem.