swaggydoc | Swagger Documentation for Grails Controllers Plugin
kandi X-RAY | swaggydoc Summary
kandi X-RAY | swaggydoc Summary
This repository is not actively maintained. If you are interested in taking it over, please let me know.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of swaggydoc
swaggydoc Key Features
swaggydoc Examples and Code Snippets
Community Discussions
Trending Discussions on swaggydoc
QUESTION
I am developing demo REST Demo using Grails 3 with service Spring Security REST and Swagger Documentation. Following are the dependencies for spring security rest
org.grails.plugins:spring-security-rest:2.0.0.M2
org.grails.plugins:spring-security-rest-gorm:2.0.0.M2
where user has to login in order to to perform certain subset of operations. After adding Swagger Doc using following plugin and configuring to access all the expoosed APIs I am able to access all API's swagger doc with "localhost://applicationPath/api"
org.grails.plugins:swaggydoc-grails3:0.28.0
Unfortunately I don't have login endpoints listed among them. If I add my LoginController along with the apis endpoints controller than it is listing all the login apis but than access url becomes
APPLICATIONURL/api/v1/api/login
Which does not works well.
The problem is that part of that operations cannot be performed via Swagger UI built-in form (I find it really nice feature and would like make it work), because user is not logged in. Is there any solution to that problem? Can I define manually some endpoints in Swagger?
This is my sample code for registring any API with Swagger
...ANSWER
Answered 2017-Nov-16 at 07:08I created an API which calls "api/login" to have authentication
QUESTION
I have a problem with grailsVersion=3.3.0.M1 and gradleWrapperVersion=3.0. Whenever I run the project I get the following error.
|Resolving Dependencies. Please wait...
CONFIGURE SUCCESSFUL
Total time: 13.543 secs |Running application... 2017-05-29 22:08:46.634 ERROR --- [ main] o.s.boot.SpringApplication
: Application startup failedjava.lang.NoClassDefFoundError: org/springframework/boot/context/embedded/FilterRegistrationBean at asset.pipeline.AssetPipelineGrailsPlugin$_doWithSpring_closure1.doCall(AssetPipelineGrailsPlugin.groovy:105) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1426) at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93) at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325) at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:294) at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1027) at groovy.lang.Closure.call(Closure.java:414) at groovy.lang.Closure.call(Closure.java:408) at grails.spring.BeanBuilder.invokeBeanDefiningClosure(BeanBuilder.java:759) at grails.spring.BeanBuilder.beans(BeanBuilder.java:588) at grails.spring.BeanBuilder.invokeMethod(BeanBuilder.java:531) at org.grails.plugins.DefaultGrailsPlugin.doWithRuntimeConfiguration(DefaultGrailsPlugin.java:559) at org.grails.plugins.AbstractGrailsPluginManager.doRuntimeConfiguration(AbstractGrailsPluginManager.java:167) at grails.boot.config.GrailsApplicationPostProcessor.postProcessBeanDefinitionRegistry(GrailsApplicationPostProcessor.groovy:171) at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:118) at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:686) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:524) at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:737) at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:370) at org.springframework.boot.SpringApplication.run(SpringApplication.java:314) at grails.boot.GrailsApp.run(GrailsApp.groovy:83) at grails.boot.GrailsApp.run(GrailsApp.groovy:388) at grails.boot.GrailsApp.run(GrailsApp.groovy:375) at grails.boot.GrailsApp$run.call(Unknown Source) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:133) at mjmdashboardnext.Application.main(Application.groovy:8) Caused by: java.lang.ClassNotFoundException: org.springframework.boot.context.embedded.FilterRegistrationBean at java.net.URLClassLoader.findClass(URLClassLoader.java:381) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 33 common frames omitted
2017-05-29 22:08:46.749 ERROR --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Destroy method on bean with name 'grailsApplicationPostProcessor' threw an exception
java.lang.IllegalStateException: ApplicationEventMulticaster not initialized - call 'refresh' before multicasting events via the context: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@64c2b546: startup date [Mon May 29 22:08:08 NPT 2017]; root of context hierarchy at org.springframework.context.support.AbstractApplicationContext.getApplicationEventMulticaster(AbstractApplicationContext.java:404) at org.springframework.context.support.ApplicationListenerDetector.postProcessBeforeDestruction(ApplicationListenerDetector.java:97) at org.springframework.beans.factory.support.DisposableBeanAdapter.destroy(DisposableBeanAdapter.java:253) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroyBean(DefaultSingletonBeanRegistry.java:578) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingleton(DefaultSingletonBeanRegistry.java:554) at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingleton(DefaultListableBeanFactory.java:961) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingletons(DefaultSingletonBeanRegistry.java:523) at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingletons(DefaultListableBeanFactory.java:968) at org.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:1033) at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1009) at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:961) at org.springframework.boot.SpringApplication.handleRunFailure(SpringApplication.java:794) at org.springframework.boot.SpringApplication.run(SpringApplication.java:325) at grails.boot.GrailsApp.run(GrailsApp.groovy:83) at grails.boot.GrailsApp.run(GrailsApp.groovy:388) at grails.boot.GrailsApp.run(GrailsApp.groovy:375) at grails.boot.GrailsApp$run.call(Unknown Source) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:133) at mjmdashboardnext.Application.main(Application.groovy:8)
2017-05-29 22:08:46.765 ERROR --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Destroy method on bean with name 'org.springframework.boot.autoconfigure.internalCachingMetadataReaderFactory' threw an exception
java.lang.IllegalStateException: ApplicationEventMulticaster not initialized - call 'refresh' before multicasting events via the context: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@64c2b546: startup date [Mon May 29 22:08:08 NPT 2017]; root of context hierarchy at org.springframework.context.support.AbstractApplicationContext.getApplicationEventMulticaster(AbstractApplicationContext.java:404) at org.springframework.context.support.ApplicationListenerDetector.postProcessBeforeDestruction(ApplicationListenerDetector.java:97) at org.springframework.beans.factory.support.DisposableBeanAdapter.destroy(DisposableBeanAdapter.java:253) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroyBean(DefaultSingletonBeanRegistry.java:578) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingleton(DefaultSingletonBeanRegistry.java:554) at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingleton(DefaultListableBeanFactory.java:961) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingletons(DefaultSingletonBeanRegistry.java:523) at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingletons(DefaultListableBeanFactory.java:968) at org.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:1033) at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1009) at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:961) at org.springframework.boot.SpringApplication.handleRunFailure(SpringApplication.java:794) at org.springframework.boot.SpringApplication.run(SpringApplication.java:325) at grails.boot.GrailsApp.run(GrailsApp.groovy:83) at grails.boot.GrailsApp.run(GrailsApp.groovy:388) at grails.boot.GrailsApp.run(GrailsApp.groovy:375) at grails.boot.GrailsApp$run.call(Unknown Source) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:133) at mjmdashboardnext.Application.main(Application.groovy:8)
FAILURE: Build failed with an exception.
What went wrong: Execution failed for task ':bootRun'.
Process 'command 'C:\Program Files\Java\jdk1.8.0_121\bin\java.exe'' finished with non-zero exit value 1
Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Error | Failed to start server (Use --stacktrace to see the full trace)
Process finished with exit code 1
I have tried to upgrade my plugins in build.gradle but the error remains the same.
My build.gradle is as follows
...ANSWER
Answered 2017-May-30 at 16:33compile 'org.grails.plugins:spring-security-core:3.1.1'
QUESTION
I'm using swaggydoc plugin on my grails application to document the REST APIs. I have two versions of API, v0 and v1 and corresponding controllers with same name, one for each version like:
directory structure
and i have the Url mapping like "/my2api/v1"(controller:"api",namespace:'v1')
"/myapi/v0" (controller:"api", namespace:'v0')
and getting both versions of the API endpoints listed as /myapi/v0/activeContracts like here.
So my question is, how can I get the API end point listed with correct URLs with corresponding versions like /myapi/v0/activeContracts & /myapi/v1/activeContracts
as i mentioned I've tried the mapping but it ill just pickup the first the last mapping and assign it to both versions.
Any help would be greatly appreciated.
ANSWER
Answered 2017-Apr-13 at 10:02For people facing the same prob, I couldn't find a solution using swaggyDocs and also came across some post suggesting it doesn't support API versioning so ended up switching to Grails RestApiDoc which provides a lot more control (changing the API conf by just editing the json) than I was able to get on swaggyDocs. But please do post if someone knows a way to work it out in swaggyDoc.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install swaggydoc
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page