phoenixnap / springmvc-raml-plugin

Spring MVC - RAML Spec Synchroniser Plugin. A Maven plugin designed to Generate Server & Client code in Spring from a RAML API descriptor and conversely, a RAML API document from the SpringMVC Server implementation.
Apache License 2.0
136 stars 84 forks source link

Generate POJOs from unreferenced types doesn't work #233

Closed sasagonz closed 6 years ago

sasagonz commented 6 years ago

Hi.

We've specified a type to model an Error entity. And this type is used when we specify the error response body in API spec (for 400, 500, etc.) But the corresponding POJO is not being generated. We tried also using the configuration param "generateUnreferencedSchemas" without success. So, the question is, can be unreferenced types be generated? (or referenced in error response bodies)

Rule used: Spring4ControllerInterfaceRule

Regards.

stojsavljevic commented 6 years ago

It's a bug.

yuranos commented 6 years ago

@sasagonz , what version are you using? We had exact same problem, and I fixed it for the plugin. My config looks as follows:

            <plugin>
                <groupId>com.phoenixnap.oss</groupId>
                <artifactId>springmvc-raml-plugin</artifactId>
                <version>0.10.13</version>
                <configuration>
                    <ramlPath>src/main/resources/static/api.raml</ramlPath>
                    <outputRelativePath>target/generated-sources</outputRelativePath>
                    <addTimestampFolder>false</addTimestampFolder>
                    <basePackage>com.yuranos.documented.api</basePackage>
                    <generateUnreferencedSchemas>true</generateUnreferencedSchemas>
                    <seperateMethodsByContentType>false</seperateMethodsByContentType>
                    <rule>com.phoenixnap.oss.ramlapisync.generation.rules.Spring4ControllerInterfaceRule</rule>
                    <ruleConfiguration>
                        <simpleReturnTypes>true</simpleReturnTypes>
                        <useShortcutMethodMappings>true</useShortcutMethodMappings>
                    </ruleConfiguration>
                    <generationConfig>
                        <includeJsr303Annotations>true</includeJsr303Annotations>
                    </generationConfig>
                </configuration>
                <executions>
                    <execution>
                        <id>generate-springmvc-endpoints</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>generate-springmvc-endpoints</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
yuranos commented 6 years ago

https://github.com/phoenixnap/springmvc-raml-plugin/issues/203

sasagonz commented 6 years ago

I'm using same version than you and configuration is basically the same. Differences:

I'll try to change these values and I'll let you know if I get success.

sasagonz commented 6 years ago

Hi, after my lastests checks, I cannot reproduce this issue. I mean, Error model is not referenced by any other one and it is used only in error response bodies and now I see Error class generated successfully. So I think this bug can be closed as not reproducible.