Closed InfoSec812 closed 9 years ago
Thanks a lot for a good reproduction sample. I will look in it asap.
Regards, Pavel
FYI, running the application is as simple as:
mvn exec:java
The RAML endpoint is mapped to: http://localhost:8180/rest/v1/raml
Thanks!
I think that the problem is in execution phase which was wrongly pointed to generate-sources in documentation (fixed it) I used 'process-classes' phase for your sample project ant the things that I got look at least casually correct: https://www.dropbox.com/s/cehyxdudnbrox6t/Archive.zip?dl=0
P.S. Please let me know if it still did not works for you. Regards, Pavel
Nope, still not working. I have pushed the changes up to my repo, but here's the RAML I am getting:
#%RAML 0.8
title: codepalousa-restlet-raml
baseUri: http://example.com
schemas:
- todo: !include schemas/todo.xsd
- todo-jsonschema: !include schemas/todo-jsonschema.json
/todo:
get:
post:
/{id}:
uriParameters:
id:
type: integer
get:
put:
delete:
This is not working for me either. Swagger annotations are not included in the output.
Ok, let me see what's going on
Well, we definitely had some bugs to fix. Now with 1.3.4-SNAPSHOT I obtain the following RAML for the example above:
#%RAML 0.8
title: Please type API title here
version: v1
baseUri: "http://localhost:8180/rest/v1"
protocols: [ HTTP ]
schemas:
- toDo-xml: !include schemas/toDo-xml-schema.xsd
- toDo: !include schemas/toDo-schema.json
- toDo-collection: !include schemas/toDo-collection-schema.json
/todo:
description: '@author <a href="https://github.com/InfoSec812">Deven Phillips</a>'
post:
description: Create a new ToDo entity
body:
application/xml:
schema: toDo-xml
example: !include examples/toDo-example.xml
application/json:
schema: toDo
example: !include examples/toDo-example.json
responses:
200:
body:
application/xml:
schema: toDo-xml
example: !include examples/toDo-example.xml
application/json:
schema: toDo
example: !include examples/toDo-example.json
400:
description: Invalid ID value
body:
application/xml:
application/json:
500:
description: SERVER ERROR
body:
application/xml:
application/json:
get:
description: Get all ToDo entities
responses:
200:
body:
application/xml:
application/json:
schema: toDo-collection
example: !include examples/toDo-collection-example.json
400:
description: Invalid ID value
body:
application/xml:
application/json:
500:
description: SERVER ERROR
body:
application/xml:
application/json:
/{id}:
uriParameters:
id:
description: The unique ID of the ToDo entity
get:
description: "Get ToDo entity specified by 'id'"
responses:
404:
description: NOT FOUND
body:
application/xml:
application/json:
200:
body:
application/xml:
schema: toDo-xml
example: !include examples/toDo-example.xml
application/json:
schema: toDo
example: !include examples/toDo-example.json
400:
description: Invalid ID value
body:
application/xml:
application/json:
500:
description: SERVER ERROR
body:
application/xml:
application/json:
put:
description: "Update/Modify ToDo entity specified by 'id'"
body:
application/xml:
schema: toDo-xml
example: !include examples/toDo-example.xml
application/json:
schema: toDo
example: !include examples/toDo-example.json
responses:
200:
body:
application/xml:
schema: toDo-xml
example: !include examples/toDo-example.xml
application/json:
schema: toDo
example: !include examples/toDo-example.json
400:
description: Invalid ID value
body:
application/xml:
application/json:
500:
description: SERVER ERROR
body:
application/xml:
application/json:
delete:
description: "Delete ToDo entity specified by 'id'"
responses:
202:
description: OK
200:
400:
description: Invalid ID value
500:
description: SERVER ERROR
Note that we do not support xml examples and xsd schemes for methods which have responseContainer
defined inside @ApiOperation
, becuse the root element name is undefined.
See https://groups.google.com/forum/#!topic/swagger-swaggersocket/QpwiDHT1qCU for details.
Regards, Konstantin.
Thanks. I'm tyring to see if it works but can't load the snapshot.
[ERROR] Plugin org.raml.plugins:jaxrs-raml-maven-plugin:1.3.4-SNAPSHOT or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.raml.plugins:jaxrs-raml-maven-plugin:jar:1.3.4-SNAPSHOT: Could not find artifact org.raml.plugins:jaxrs-raml-maven-plugin:pom:1.3.4-SNAPSHOT -> [Help 1]
Here is a snippet from my pom, and below that, my maven settings. Any help would be appreciated.
<plugin>
<groupId>org.raml.plugins</groupId>
<artifactId>jaxrs-raml-maven-plugin</artifactId>
<version>1.3.4-SNAPSHOT</version>
<configuration>
<sourceDirectory>${basedir}/src/main/java/web</sourceDirectory>
<outputFile>${project.build.directory}/test/jaxrs-raml/api-docs.raml</outputFile>
<removeOldOutput>true</removeOldOutput>
</configuration>
<executions>
<execution>
<goals>
<goal>generate-raml</goal>
</goals>
<phase>process-classes</phase>
</execution>
</executions>
</plugin>
<repository>
<id>mulesoft</id>
<url>https://repository-master.mulesoft.org/snapshots</url>
<layout>default</layout>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
It seems that you should use pluginRepository
instead of repository
For example, that's how I include the plugin from Sonatype:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<!--.....-->
<pluginRepositories>
<pluginRepository>
<id>oss-sonatype</id>
<name>oss-sonatype</name>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
<build>
<plugins>
<!--.....-->
<plugin>
<version>1.3.4-SNAPSHOT</version>
<groupId>org.raml.plugins</groupId>
<artifactId>jaxrs-raml-maven-plugin</artifactId>
<configuration>
<!--.....-->
</configuration>
<executions>
<execution>
<goals>
<goal>generate-raml</goal>
</goals>
<phase>test</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<!--.....-->
</dependencies>
</project>
Thanks! OK, now i've got the plugin loading. I get an NPE.
Caused by: java.lang.NullPointerException
at com.mulesoft.jaxrs.raml.annotation.model.ClassHierarchyVisitor.visit(ClassHierarchyVisitor.java:19)
at com.mulesoft.jaxrs.raml.annotation.model.WrapperMethodModel.getActualMethod(WrapperMethodModel.java:132)
at com.mulesoft.jaxrs.raml.annotation.model.WrapperMethodModel.hasAnnotation(WrapperMethodModel.java:48)
at com.mulesoft.jaxrs.raml.annotation.model.ResourceVisitor.visit(ResourceVisitor.java:333)
at com.mulesoft.jaxrs.raml.annotation.model.ResourceVisitor.visit(ResourceVisitor.java:236)
at com.mulesoft.jaxrs.raml.annotation.model.ResourceVisitor.visit(ResourceVisitor.java:373)
at com.mulesoft.jaxrs.raml.annotation.model.ResourceVisitor.visit(ResourceVisitor.java:236)
at org.raml.jaxrs.codegen.maven.JaxrsRamlCodegenMojo.execute(JaxrsRamlCodegenMojo.java:156)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
Ok, fixed it.
Sample Application can be found at:
https://github.com/InfoSec812/codepalousa-restlet-raml
Running: mvn clean compile generate-sources and the output RAML has not details about response codes and no links to schemas.