springfox / springfox-grails-integration

SpringFox integration with Grails 3.x
Apache License 2.0
19 stars 12 forks source link

can't create new objects in test app #13

Closed rdmueller closed 7 years ago

rdmueller commented 7 years ago

example: http://localhost:8080/swagger-ui.html#!/genre/saveGenreUsingPOST

I always get a Internal Server Error:

Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: -1
        at java.lang.String.substring(String.java:1967)
        at grails.views.resolve.TemplateResolverUtils.fullTemplateNameForClass(TemplateResolverUtils.groovy:23)
        at grails.views.ResolvableGroovyTemplateEngine.resolveTemplate(ResolvableGroovyTemplateEngine.groovy:226)
        at grails.plugin.json.view.api.internal.DefaultGrailsJsonViewHelper.process(DefaultGrailsJsonViewHelper.groovy:543)
        at grails.plugin.json.view.api.internal.DefaultGrailsJsonViewHelper$_renderDefault_closure1.doCall(DefaultGrailsJsonViewHelper.groovy:182)
        at grails.plugin.json.view.api.internal.DefaultGrailsJsonViewHelper$3$_writeTo_closure1.doCall(DefaultGrailsJsonViewHelper.groovy:220)
        at grails.plugin.json.builder.StreamingJsonBuilder$StreamingJsonDelegate.cloneDelegateAndGetContent(StreamingJsonBuilder.java:721)
        at grails.plugin.json.builder.StreamingJsonBuilder$StreamingJsonDelegate.cloneDelegateAndGetContent(StreamingJsonBuilder.java:713)
        at grails.plugin.json.builder.StreamingJsonBuilder.call(StreamingJsonBuilder.java:208)
        at grails.plugin.json.view.api.internal.DefaultGrailsJsonViewHelper$3.writeTo(DefaultGrailsJsonViewHelper.groovy:211)
        at grails.plugin.json.view.JsonViewTemplate.json(JsonViewTemplate.groovy:126)
        at springfox_grails_contract_tests_object__object_gson.run(springfox_grails_contract_tests_object__object_gson:5)
        at grails.plugin.json.view.JsonViewTemplate.doWrite(JsonViewTemplate.groovy:35)
        at grails.views.AbstractWritableScript.writeTo(AbstractWritableScript.groovy:40)
        ... 28 common frames omitted
rdmueller commented 7 years ago

this can be resolved by removing the _object.gson view template...

dilipkrish commented 7 years ago

Not sure if that will always be the solution.. there is some problem still I think.

I pushed a clean demo out to https://github.com/springfox/springfox-grails-demo.

dilipkrish commented 7 years ago

It might be because its just a mashup of all the things I wanted to test :)

dilipkrish commented 7 years ago

Deployed the demo to heroku https://immense-escarpment-17128.herokuapp.com

rdmueller commented 7 years ago

at least, after removing the template and thus using the default view, the app worked for me and I couldn't create a new bug...