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
295 stars 181 forks source link

No JAX-RS endpoints generated from a RAML 1.0 specification #224

Closed KevinMitchell closed 7 years ago

KevinMitchell commented 7 years ago

Hi,

I'm trying the release/2.0.0 branch of raml-for-jax-rs and ran the raml-to-jaxrs-cli jar passing it a RAML 1.0 specification. It appeared to run without error, but only generated interfaces and classes for the types, plus a ResponseDelegate source. There was no code generated for any of the RAML methods. So is there some command-line argument I'm missing when I'm invoking the raml-to-jaxrs-cli jar, is there some annotations I need to add to the RAML to trigger the generation, or is the implementation still "work-in-progress"?

Thanks,

Kevin

jstoiko commented 7 years ago

what <value/> have you set for <configureTypesFor/> in your pom.xml?

KevinMitchell commented 7 years ago

Ah, that perhaps explains it. So I can see in the examples directory there are pom files for the examples, and I can see these have the configureTypesFor entries. But I was trying to convert my raml using the cli project. So do I still need to have the same project structure as the other examples, and the cli project is just a convenient way of invoking this? I'd been assuming it would just be an option on the command line. But I'll try copying an existing example project structure, and try that.

Thanks

jstoiko commented 7 years ago

you can pass that option to the CLI using the -e argument: https://github.com/mulesoft-labs/raml-for-jax-rs/blob/release/2.0.0/raml-to-jaxrs/raml-to-jaxrs-cli/src/main/java/org/raml/jaxrs/ramltojaxrs/Main.java#L57

sorry it wasn't clear. this needs to be documented!

KevinMitchell commented 7 years ago

I added -e jackson to the CLI, and now get annotations on the classes generated from the RAML types. But I still don't get any code corresponding to the RAML resources. For example, if I define

/foo:
  get:
    responses:
      200:
        body:
          application/json:
            type: string

I was expecting to get a class generated for Foo, with an @Path annotation etc. But there was no sign of one. So is there something else I'm missing from the CLI?

jpbelang commented 7 years ago

Hi, are you running with the CLI ? java -jar .../raml-to-jaxrs/raml-to-jaxrs-cli/target/raml-to-jaxrs-cli-2.0.0-RC2-SNAPSHOT-jar-with-dependencies.jar -e jackson -d /tmp -r singlepackage types_user_defined.raml

Should generate files in /tmp/singlepackage.

If you are running through maven, the files are genrated in target/generated-sources/raml-jaxrs.

KevinMitchell commented 7 years ago

I've just moved to the maven version and it works fine for me there. But thanks for the help.