mulesoft-labs / raml-for-jax-rs

This project is all about two way transformation of JAX-RS-annotated Java code to RAML API description and back.
Other
296 stars 181 forks source link

'version' not appending in jax-rs @Path #442

Open kumarrajnumber opened 4 years ago

kumarrajnumber commented 4 years ago

Hi,

'version' is not appending in jax-rs generated classes @Path

my raml file, rename it to .raml https://github.com/mulesoft-labs/raml-for-jax-rs/files/4598660/api.txt

I was expecting @Path("/v1/user") instead it created without version in path @Path("/user") Even 'baseUri' is ignored. It would be difficult if RAML provider changes the api version to v2. Suggestions please.

output:

@Path("/user")
public interface User {
  /**
   */
  @POST
  @Path("/activation")
  @Consumes("application/json")
  PostUserActivationResponse postUserActivation(
      @NotNull @Valid UserActivationPostApplicationJson entity);

  class PostUserActivationResponse extends ResponseDelegate {....}

pom.xml

<?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"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.company.project</groupId>
    <artifactId>Simulator</artifactId>
    <version>1.0-SNAPSHOT</version>
    <dependencies>
        <dependency>
            <groupId>javax.ws.rs</groupId>
            <artifactId>javax.ws.rs-api</artifactId>
            <version>2.1.1</version>
        </dependency>
        <dependency>
            <groupId>javax.validation</groupId>
            <artifactId>validation-api</artifactId>
            <version>2.0.1.Final</version>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.raml.jaxrs</groupId>
                <artifactId>raml-to-jaxrs-maven-plugin</artifactId>
                <version>3.0.7</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                    </execution>
                </executions>
                <dependencies>
                    <dependency>
                        <groupId>org.raml.jaxrs</groupId>
                        <artifactId>feature-plugins</artifactId>
                        <version>3.0.5</version>
                    </dependency>
                </dependencies>
                <configuration>
                    <ramlFile>${project.basedir}\src\main\resources\api.raml
                    </ramlFile>
                    <resourcePackage>com.project.company.resources</resourcePackage>
                    <modelPackage>com.project.company.model</modelPackage>
                    <supportPackage>com.project.company.support</supportPackage>
                    <outputDirectory>${project.basedir}/src/main/java</outputDirectory>
                    <jsonMapper>jackson2</jsonMapper>
                    <generateTypesWith>jsr303</generateTypesWith>
                    <jsonMapperConfiguration>
                        <includeAdditionalProperties>false</includeAdditionalProperties>
                    </jsonMapperConfiguration>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.0</version>
                <configuration>
                    <source>11</source>
                    <target>11</target>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>
jpbelang commented 4 years ago

The version field is current only for documentation purposes, as it is not uniform to have the version in the URL (I for one prefer to have in the content-type, for example). I'm currently working on 4.0, and will keep in mind a plugin for this purpose.