Skip to content
This repository was archived by the owner on Feb 12, 2022. It is now read-only.

RAML-to-JAXRS CLI tool not generating model files in 2.1.x #296

Closed
JimPartin opened this issue Aug 15, 2017 · 8 comments
Closed

RAML-to-JAXRS CLI tool not generating model files in 2.1.x #296

JimPartin opened this issue Aug 15, 2017 · 8 comments

Comments

@JimPartin
Copy link

JimPartin commented Aug 15, 2017

trying to use ramltojaxrs cli tool on a 0.8 raml file. It will generate resources based on the -r flag (using 2.1.0 and 2.1.1), but will not generate any model files with the -m flag. Keeps crashing with errors. The -s flag also fails.

The older 1.3.x tool seems to have no problem.

Also tested with the RAML 1.0 torture test API.raml in the project, it also fails attempting to generate models.

Command:

java -jar raml-to-jaxrs-cli-2.1.1-SNAPSHOT-jar-with-dependencies.jar -d ./tmp -m org.foo.bar.models ./myRaml.raml

error:
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Exception in thread "main" java.lang.NullPointerException
at com.squareup.javapoet.ClassName.(ClassName.java:52)
at com.squareup.javapoet.ClassName.(ClassName.java:43)
at com.squareup.javapoet.ClassName.get(ClassName.java:177)
at org.raml.jaxrs.generator.ResponseSupport.buildSupportClasses(ResponseSupport.java:53)
at org.raml.jaxrs.generator.CurrentBuild.generate(CurrentBuild.java:113)
at org.raml.jaxrs.generator.RamlScanner.handle(RamlScanner.java:116)
at org.raml.jaxrs.generator.RamlScanner.handle(RamlScanner.java:72)
at org.raml.jaxrs.generator.RamlScanner.handle(RamlScanner.java:55)
at org.raml.jaxrs.ramltojaxrs.Main.main(Main.java:75)

myRaml.raml:

#%RAML 0.8
title: thing1-oe-data-services-stuffs
baseUri: http://foo.bar.baz/thing1/oe/services/data/v1/stuffs

schemas:
- w00t: !include schemas/w00t-schema.json
- errorSchema: !include schemas/error-schema.json

/{var1}/op2/{var2}/op3/{var3}/op4/{var4}/op5/{op5}:
	get:
		description: la li lu le lo
		responses:
			200:
				body:
					application/json:
						schema: w00t
			404:
				body:
					application/json:
						schema: errorSchema

w00t-schema.json:

{
	"$schema": "http://json-schema.org/draft-04/schema#",
	"title": "w00t",
	"description": "la li lu le lo",
	"type": "object",
	"properties": {
		"someId": {
			"type": "integer"
		},
		"someInt": {
			"type": "integer"
		},
		"aString": {
			"type": "string"
		},
		"anotherString": {
			"type": "string"
		},
		"blah": {
			"type": "string"
		},
		"anotherInt": {
			"type": "integer"
		}
	},
	"required": ["someId", "someInt","aString", "anotherString","blah"]
}

error-schema.json:

{
	"$schema": "http://json-schema.org/draft-04/schema#",
	"title": "Error",
	"description": "A Error Detail",
	"type": "object",
	"properties": {
		"code": {
			"type": "string"
		},
		"message": {
			"type": "string"
		}
	},
	"required": ["code", "message"]
}
@tarabola
Copy link

tarabola commented Sep 8, 2017

hello,

any solution?

@jpbelang
Copy link
Contributor

jpbelang commented Sep 8, 2017

Could you try with -r and -m ? I might not default correctly.

@tarabola
Copy link

tarabola commented Sep 8, 2017

got the same

C:\EA\API\RAML\raml-for-jax-rs\raml-to-jaxrs\raml-to-jaxrs-cli>java -jar ./target/raml-to-jaxrs-cli-2.1.0-jar-with-dependencies.jar -d /tmp -r foo.bar ../examples/maven-examples/raml-defined-example/src/main/resources/dealerRestful.raml
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Exception in thread "main" java.lang.NullPointerException
        at org.raml.jaxrs.generator.v08.V08Finder.typesInBodies(V08Finder.java:106)
        at org.raml.jaxrs.generator.v08.V08Finder.resourceTypes(V08Finder.java:81)
        at org.raml.jaxrs.generator.v08.V08Finder.resourceTypes(V08Finder.java:78)
        at org.raml.jaxrs.generator.v08.V08Finder.resourceTypes(V08Finder.java:78)
        at org.raml.jaxrs.generator.v08.V08Finder.resourceTypes(V08Finder.java:78)
        at org.raml.jaxrs.generator.v08.V08Finder.findTypes(V08Finder.java:59)
        at org.raml.jaxrs.generator.CurrentBuild.constructClasses(CurrentBuild.java:259)
        at org.raml.jaxrs.generator.RamlScanner.handle(RamlScanner.java:106)
        at org.raml.jaxrs.generator.RamlScanner.handle(RamlScanner.java:72)
        at org.raml.jaxrs.generator.RamlScanner.handle(RamlScanner.java:55)
        at org.raml.jaxrs.ramltojaxrs.Main.main(Main.java:75)

@jpbelang
Copy link
Contributor

jpbelang commented Sep 8, 2017

Could you try with the code on release/2.1.1 ? I fixed this issue:

#265

Which looks a lot like yours.

@tarabola
Copy link

tarabola commented Sep 8, 2017

you forgot posti-smartship from maven-examples´s pom

@tarabola
Copy link

tarabola commented Sep 8, 2017

so, I removed posti-smartship module and finally it´s ok.

But still warnning

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.

@JimPartin
Copy link
Author

Thanks, I'll check after his this hurricane blows through.

@jpbelang
Copy link
Contributor

jpbelang commented Sep 8, 2017

Hoping you are hypnotized by CNN and not in the path of the hurricane. If you are, a sincere good luck.

@jstoiko jstoiko closed this as completed Dec 7, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants