forked from springdoc/springdoc.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
4660 lines (4628 loc) · 205 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="generator" content="Asciidoctor 2.0.15">
<meta name="author" content="OpenAPI 3 Library for spring-boot By Badr NASS LAHSEN">
<title>OpenAPI 3 Library for spring-boot</title>
<meta name="author" content="OpenAPI 3 Library for spring-boot By Badr NASS LAHSEN">
<title>OpenAPI 3 Library for spring-boot</title>
<meta property="og:title" content="OpenAPI 3 Library for spring-boot" />
<meta property="og:locale" content="en_US" />
<meta name="description" content="OpenAPI 3 Library for spring boot projects. Is based on swagger-ui, to display the OpenAPI description.Generates automatically the OpenAPI file." />
<meta property="og:description" content="Library for OpenAPI 3 with spring boot projects. Is based on swagger-ui, to display the OpenAPI description.Generates automatically the OpenAPI file." />
<link rel="canonical" href="http://springdoc.org/" />
<meta property="og:url" content="http://springdoc.org/" />
<meta property="og:site_name" content="OpenAPI 3 Library for spring-boot" />
<meta property="og:image" content="https://springdoc.org/img/banner-logo.svg" />
<meta name="author" content="Library for OpenAPI 3 with spring-boot By Badr NASS LAHSEN">
<title>springdoc-openapi v2.6.0</title>
<link rel="stylesheet" href="css/site.css">
<style>
#header #revnumber {
display: none
}
</style>
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-1GEGWXWNH4"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-1GEGWXWNH4');
</script>
<script src="js/setup.js"></script><script defer src="js/site.js"></script>
</head>
<body class="book toc2 toc-left"><div id="banner-container" class="container" role="banner">
<div id="banner" class="contained" role="banner">
<div id="switch-theme">
<input type="checkbox" id="switch-theme-checkbox" />
<label for="switch-theme-checkbox">Dark Theme</label>
</div>
</div>
</div>
<div id="tocbar-container" class="container" role="navigation">
<div id="tocbar" class="contained" role="navigation">
<button id="toggle-toc"></button>
</div>
</div>
<div id="main-container" class="container">
<div id="main" class="contained">
<div id="doc" class="doc">
<div id="header">
<h1>springdoc-openapi v2.7.0</h1>
<div id="toc" class="toc2">
<div id="toctitle">Table of Contents</div>
<ul class="sectlevel1">
<li><a href="#Introduction">1. Introduction</a></li>
<li><a href="#getting-started">2. Getting Started</a></li>
<li><a href="#modules">3. Springdoc-openapi Modules</a>
<ul class="sectlevel2">
<li><a href="#general-overview">3.1. General overview</a></li>
<li><a href="#spring-webmvc-support">3.2. Spring WebMvc support</a></li>
<li><a href="#spring-webflux-support">3.3. Spring WebFlux support</a></li>
<li><a href="#spring-hateoas-support">3.4. Spring Hateoas support</a></li>
<li><a href="#spring-data-rest-support">3.5. Spring Data Rest support</a></li>
<li><a href="#spring-security-support">3.6. Spring Security support</a></li>
<li><a href="#actuator-support">3.7. Actuator support</a></li>
<li><a href="#spring-cloud-function-web-support">3.8. Spring Cloud Function Web support</a></li>
<li><a href="#kotlin-support">3.9. Kotlin support</a></li>
<li><a href="#groovy-support">3.10. Groovy support</a></li>
<li><a href="#javadoc-support">3.11. Javadoc support</a></li>
</ul>
</li>
<li><a href="#features">4. Springdoc-openapi Features</a>
<ul class="sectlevel2">
<li><a href="#adding-api-information-and-security-documentation">4.1. Adding API Information and Security documentation</a></li>
<li><a href="#error-handling-for-rest-using-controlleradvice">4.2. Error Handling for REST using @ControllerAdvice</a></li>
<li><a href="#disabling-the-springdoc-openapi-endpoints">4.3. Disabling the <code>springdoc-openapi</code> endpoints</a></li>
<li><a href="#disabling-the-swagger-ui">4.4. Disabling the swagger-ui</a></li>
<li><a href="#swagger-ui-configuration">4.5. Swagger-ui configuration</a></li>
<li><a href="#selecting-the-rest-controllers-to-include-in-the-documentation">4.6. Selecting the Rest Controllers to include in the documentation</a></li>
<li><a href="#spring-webfluxwebmvc-fn-with-functional-endpoints">4.7. Spring-webflux/WebMvc.fn with Functional Endpoints</a></li>
<li><a href="#integration-with-wildfly">4.8. Integration with WildFly</a></li>
</ul>
</li>
<li><a href="#properties">5. Springdoc-openapi Properties</a>
<ul class="sectlevel2">
<li><a href="#springdoc-openapi-core-properties">5.1. springdoc-openapi core properties</a></li>
<li><a href="#swagger-ui-properties">5.2. swagger-ui properties</a></li>
</ul>
</li>
<li><a href="#plugins">6. Springdoc-openapi Plugins</a>
<ul class="sectlevel2">
<li><a href="#maven-plugin">6.1. Maven plugin</a></li>
<li><a href="#gradle-plugin">6.2. Gradle plugin</a></li>
</ul>
</li>
<li><a href="#demos">7. Springdoc-openapi Demos</a>
<ul class="sectlevel2">
<li><a href="#springdoc-applications-demos">7.1. springdoc applications demos</a></li>
<li><a href="#source-code-of-the-demo-applications">7.2. Source code of the Demo Applications</a></li>
</ul>
</li>
<li><a href="#migrating-from-springdoc-v1">8. Migrating from springdoc-openapi v1</a></li>
<li><a href="#migrating-from-springfox">9. Migrating from SpringFox</a></li>
<li><a href="#other-resources">10. Other resources</a>
<ul class="sectlevel2">
<li><a href="#additional-resources-to-get-started">10.1. Additional resources to get started</a></li>
<li><a href="#dependencies-repository">10.2. Dependencies repository</a></li>
</ul>
</li>
<li><a href="#sponsor">11. Sponsor</a>
<ul class="sectlevel2">
<li><a href="#benefits-of-being-a-bronze-sponsor">11.1. Benefits of being a bronze sponsor</a></li>
<li><a href="#benefits-of-being-a-silver-sponsor">11.2. Benefits of being a silver sponsor</a></li>
<li><a href="#benefits-of-being-a-gold-sponsor">11.3. Benefits of being a gold sponsor</a></li>
</ul>
</li>
<li><a href="#thanks">12. Special Thanks</a></li>
<li><a href="#faq">13. F.A.Q</a>
<ul class="sectlevel2">
<li><a href="#how-can-i-define-multiple-openapi-definitions-in-one-spring-boot-project">13.1. How can I define multiple OpenAPI definitions in one Spring Boot project?</a></li>
<li><a href="#how-can-i-configure-swagger-ui">13.2. How can I configure Swagger UI?</a></li>
<li><a href="#how-can-i-filter-the-resources-documented-in-the-output-specification-by-the-provided-group">13.3. How can I filter the resources documented in the output specification by the provided group?</a></li>
<li><a href="#how-can-i-disableenable-swagger-ui-generation-based-on-env-variable">13.4. How can I disable/enable Swagger UI generation based on env variable?</a></li>
<li><a href="#how-can-i-control-the-default-expansion-setting-for-the-operations-and-tags-in-the-swagger-ui">13.5. How can I control the default expansion setting for the operations and tags, in the Swagger UI ,</a></li>
<li><a href="#how-can-i-change-the-layout-of-the-swagger-ui">13.6. How can I change the layout of the <code>swagger-ui</code>?</a></li>
<li><a href="#how-can-i-sort-endpoints-alphabetically">13.7. How can I sort endpoints alphabetically?</a></li>
<li><a href="#how-can-i-disable-the-try-it-out-button">13.8. How can I disable the try it out button?</a></li>
<li><a href="#how-can-i-add-reusable-enums">13.9. How can I add Reusable Enums ?</a></li>
<li><a href="#how-can-i-apply-enumasref-true-to-all-enums">13.10. How can i apply <code>enumAsRef = true</code> to all enums ?</a></li>
<li><a href="#how-can-i-explicitly-set-which-paths-to-filter">13.11. How can I explicitly set which paths to filter?</a></li>
<li><a href="#how-can-i-explicitly-set-which-packages-to-scan">13.12. How can I explicitly set which packages to scan?</a></li>
<li><a href="#how-can-i-set-swagger-properties-programmatically">13.13. How can I set Swagger properties programmatically?</a></li>
<li><a href="#how-can-i-ignore-some-field-of-model">13.14. How can I ignore some field of model ?</a></li>
<li><a href="#how-can-i-ignore-authenticationprincipal-parameter-from-spring-security">13.15. How can I ignore <code>@AuthenticationPrincipal</code> parameter from spring-security ?</a></li>
<li><a href="#is-there-a-gradle-plugin-available">13.16. Is there a Gradle plugin available?</a></li>
<li><a href="#how-can-i-hide-a-parameter-from-the-documentation">13.17. How can I hide a parameter from the documentation ?</a></li>
<li><a href="#is-parameters-annotation-supported">13.18. Is <code>@Parameters</code> annotation supported ?</a></li>
<li><a href="#does-springdoc-openapi-support-jersey">13.19. Does <code>springdoc-openapi</code> support Jersey?</a></li>
<li><a href="#can-springdoc-openapi-generate-api-only-for-restcontroller">13.20. Can <code>springdoc-openapi</code> generate API only for <code>@RestController</code>?</a></li>
<li><a href="#are-the-following-validation-annotations-supported-notempty-notblank-positiveorzero-negativeorzero">13.21. Are the following validation annotations supported : <code>@NotEmpty</code> <code>@NotBlank</code> <code>@PositiveOrZero</code> <code>@NegativeOrZero</code>?</a></li>
<li><a href="#how-can-i-map-pageable-spring-data-commons-object-to-correct-url-parameter-in-swagger-ui">13.22. How can I map <code>Pageable</code> (spring-data-commons) object to correct URL-Parameter in Swagger UI?</a></li>
<li><a href="#how-can-i-generate-enums-in-the-generated-description">13.23. How can I generate enums in the generated description?</a></li>
<li><a href="#how-can-i-deploy-springdoc-openapi-starter-webmvc-ui-behind-a-reverse-proxy">13.24. How can I deploy <code>springdoc-openapi-starter-webmvc-ui</code> behind a reverse proxy?</a></li>
<li><a href="#is-jsonview-annotations-in-spring-mvc-apis-supported">13.25. Is <code>@JsonView</code> annotations in Spring MVC APIs supported?</a></li>
<li><a href="#adding-springdoc-openapi-starter-webmvc-ui-dependency-breaks-my-publicindex-html-welcome-page">13.26. Adding <code>springdoc-openapi-starter-webmvc-ui</code> dependency breaks my <code>public/index.html</code> welcome page</a></li>
<li><a href="#how-can-i-test-the-swagger-ui">13.27. How can I test the Swagger UI?</a></li>
<li><a href="#how-can-i-customise-the-openapi-object">13.28. How can I customise the OpenAPI object ?</a></li>
<li><a href="#how-can-i-return-an-empty-content-as-response">13.29. How can I return an empty content as response?</a></li>
<li><a href="#how-are-endpoints-with-multiple-consuming-media-types-supported">13.30. How are endpoints with multiple consuming media types supported?</a></li>
<li><a href="#how-can-i-get-yaml-and-json-openapi-in-compile-time">13.31. How can I get yaml and json (OpenAPI) in compile time?</a></li>
<li><a href="#what-are-the-ignored-types-in-the-documentation">13.32. What are the ignored types in the documentation?</a></li>
<li><a href="#how-can-i-disable-ignored-types">13.33. How can i disable ignored types:</a></li>
<li><a href="#how-do-i-add-authorization-header-in-requests">13.34. How do I add authorization header in requests?</a></li>
<li><a href="#differentiation-to-springfox-project">13.35. Differentiation to Springfox project</a></li>
<li><a href="#how-do-i-migrate-to-openapi-3-with-springdoc-openapi">13.36. How do I migrate to OpenAPI 3 with springdoc-openapi</a></li>
<li><a href="#how-can-i-set-a-global-header">13.37. How can I set a global header?</a></li>
<li><a href="#are-callbacks-supported">13.38. Are Callbacks supported?</a></li>
<li><a href="#how-can-i-define-securityscheme">13.39. How can I define SecurityScheme ?</a></li>
<li><a href="#how-can-i-hide-an-operation-or-a-controller-from-documentation">13.40. How can I hide an operation or a controller from documentation ?</a></li>
<li><a href="#how-to-configure-global-security-schemes">13.41. How to configure global security schemes?</a></li>
<li><a href="#can-i-use-spring-property-with-swagger-annotations">13.42. Can I use spring property with swagger annotations?</a></li>
<li><a href="#how-is-server-url-generated">13.43. How is server URL generated ?</a></li>
<li><a href="#how-can-i-disable-springdoc-openapi-cache">13.44. How can I disable springdoc-openapi cache?</a></li>
<li><a href="#how-can-i-expose-the-mvc-api-docs-endpoints-without-using-the-swagger-ui">13.45. How can I expose the mvc api-docs endpoints without using the <code>swagger-ui</code>?</a></li>
<li><a href="#how-can-i-disable-springdoc-openapi-endpoints">13.46. How can I disable <code>springdoc-openapi</code> endpoints ?</a></li>
<li><a href="#how-can-i-hide-schema-of-the-the-response">13.47. How can I hide Schema of the the response ?</a></li>
<li><a href="#what-is-the-url-of-the-swagger-ui-when-i-set-a-different-context-path">13.48. What is the URL of the <code>swagger-ui</code>, when I set a different context-path?</a></li>
<li><a href="#can-i-customize-openapi-object-programmatically">13.49. Can I customize OpenAPI object programmatically?</a></li>
<li><a href="#where-can-i-find-the-source-code-of-the-demo-applications">13.50. Where can I find the source code of the demo applications?</a></li>
<li><a href="#does-this-library-supports-annotations-from-interfaces">13.51. Does this library supports annotations from interfaces?</a></li>
<li><a href="#what-is-the-list-of-the-excluded-parameter-types">13.52. What is the list of the excluded parameter types?</a></li>
<li><a href="#is-file-upload-supported">13.53. Is file upload supported ?</a></li>
<li><a href="#can-i-use-parameter-inside-operation-annotation">13.54. Can I use <code>@Parameter</code> inside <code>@Operation</code> annotation?</a></li>
<li><a href="#why-my-parameter-is-marked-as-required">13.55. Why my parameter is marked as required?</a></li>
<li><a href="#how-are-overloaded-methods-with-the-same-endpoints-but-with-different-parameters">13.56. How are overloaded methods with the same endpoints, but with different parameters</a></li>
<li><a href="#what-is-a-proper-way-to-set-up-swagger-ui-to-use-provided-spec-yml">13.57. What is a proper way to set up Swagger UI to use provided spec.yml?</a></li>
<li><a href="#is-there-a-way-to-send-authorization-header-through-the-parameter-tag">13.58. Is there a way to send authorization header through the @Parameter tag?</a></li>
<li><a href="#my-rest-controller-using-controller-annotation-is-ignored">13.59. My Rest Controller using @Controller annotation is ignored?</a></li>
<li><a href="#how-can-i-define-groups-using-application-yml">13.60. How can I define groups using application.yml?</a></li>
<li><a href="#how-can-i-extract-fields-from-parameter-object">13.61. How can I extract fields from parameter object ?</a></li>
<li><a href="#how-can-i-use-the-last-springdoc-openapi-snapshot">13.62. How can I use the last <code>springdoc-openapi</code> SNAPSHOT ?</a></li>
<li><a href="#how-can-i-use-enable-springdoc-openapi-monetaryamount-support">13.63. How can I use enable <code>springdoc-openapi</code> MonetaryAmount support ?</a></li>
<li><a href="#how-can-i-aggregate-external-endpoints-exposing-openapi-3-spec-inside-one-single-application">13.64. How can i aggregate external endpoints (exposing OPENAPI 3 spec) inside one single application?</a></li>
<li><a href="#how-can-use-custom-jsonyml-file-instead-of-generated-one">13.65. How can use custom json/yml file instead of generated one ?</a></li>
<li><a href="#how-can-i-enable-csrf-support">13.66. How can i enable CSRF support?</a></li>
<li><a href="#how-can-i-disable-the-default-swagger-petstore-url">13.67. How can i disable the default swagger petstore URL?</a></li>
<li><a href="#is-pageabledefault-supported-to-enhance-the-openapi-3-docuementation">13.68. Is @PageableDefault supported, to enhance the OpenAPI 3 docuementation?</a></li>
<li><a href="#how-can-i-make-spring-security-login-endpoint-visible">13.69. How can i make spring security login-endpoint visible ?</a></li>
<li><a href="#how-can-i-show-schema-definitions-even-the-schema-is-not-referenced">13.70. How can i show schema definitions even the schema is not referenced?</a></li>
<li><a href="#how-to-override-deprecated">13.71. How to override @Deprecated?</a></li>
<li><a href="#how-can-i-display-a-method-that-returns-modelandview">13.72. How can i display a method that returns ModelAndView?</a></li>
<li><a href="#how-can-i-have-pretty-printed-output-of-the-openapi-specification">13.73. How can i have pretty-printed output of the OpenApi specification?</a></li>
<li><a href="#how-can-i-define-different-schemas-for-the-same-class">13.74. How can i define different schemas for the same class?</a></li>
<li><a href="#how-can-i-define-different-description-for-a-class-attribute-depending-on-usage">13.75. How can i define different description for a class attribute depending on usage?</a></li>
<li><a href="#customizing-swagger-static-resources">13.76. Customizing swagger static resources</a></li>
<li><a href="#is-graalvm-supported">13.77. Is GraalVM supported ?</a></li>
<li><a href="#how-to-integrate-open-api-3-with-spring-project-not-spring-boot">13.78. How to Integrate Open API 3 with Spring project (not Spring Boot)?</a></li>
<li><a href="#what-is-the-compatibility-matrix-of-springdoc-openapi-with-spring-boot">13.79. What is the compatibility matrix of <code>springdoc-openapi</code> with <code>spring-boot</code> ?</a></li>
<li><a href="#why-am-i-getting-an-error-swagger-ui-unable-to-render-definition-when-overriding-the-default-spring-registered-httpmessageconverter">13.80. Why am i getting an error: <code>Swagger UI unable to render definition</code>, when overriding the default spring registered <code>HttpMessageConverter</code>?</a></li>
<li><a href="#some-parameters-are-not-generated-in-the-resulting-openapi-spec">13.81. Some parameters are not generated in the resulting OpenAPI spec.</a></li>
</ul>
</li>
</ul>
</div>
</div>
<div id="content">
<div id="preamble">
<div class="sectionbody">
<div class="admonitionblock important">
<table>
<tr>
<td class="icon">
<i class="fa icon-important" title="Important"></i>
</td>
<td class="content">
<code>springdoc-openapi v1.8.0 </code> is the latest Open Source release supporting Spring Boot 2.x and 1.x.<br>
An extended support for <a href="https://springdoc.org/v1"><strong>springdoc-openapi v1</strong></a> project is now available for organizations that need support beyond 2023.<br>
For more details, feel free to reach out: <a href="mailto:[email protected]">[email protected]</a>
</td>
</tr>
</table>
</div>
<div class="paragraph">
<p><code>springdoc-openapi</code> is on <a href="https://opencollective.com/springdoc" target="_blank" rel="noopener">Open Collective</a>. If you ❤️ this project consider becoming a <a href="https://github.com/sponsors/springdoc" target="_blank" rel="noopener">sponsor</a>.</p>
</div>
<div class="paragraph">
<p>This project is sponsored by</p>
</div>
<p style="text-align: center;">
<a href="https://opensource.mercedes-benz.com/" target="_blank">
<img src="img/mercedes-benz.png" height="10%" width="10%" />
</a>
<a href="https://www.dm-jobs.com/dmTECH/?locale=de_DE&wt_mc=.display.github.sponsoring.logo" target="_blank">
<img src="img/dmTECH_Logo.jpg" height="10%" width="10%" />
</a>
<a href="https://www.contrastsecurity.com/" target="_blank">
<img src="img/contrastsecurity.svg" height="10%" width="30%" />
</a>
<a href="https://www.lvm.de/" target="_blank">
<img src="img/LVM_Versicherung_2010_logo.svg.png" height="10%" width="25%" />
</a>
</p>
</div>
</div>
<div class="sect1">
<h2 id="Introduction"><a class="anchor" href="#Introduction"></a>1. Introduction</h2>
<div class="sectionbody">
<div class="paragraph">
<p><code>springdoc-openapi</code> java library helps to automate the generation of API documentation using spring boot projects.
<code>springdoc-openapi</code> works by examining an application at runtime to infer API semantics based on spring configurations, class structure and various annotations.</p>
</div>
<div class="paragraph">
<p>Automatically generates documentation in JSON/YAML and HTML format APIs.
This documentation can be completed by comments using swagger-api annotations.</p>
</div>
<div class="paragraph">
<p>This library supports:</p>
</div>
<div class="ulist">
<ul>
<li>
<p>OpenAPI 3</p>
</li>
<li>
<p>Spring-boot v3 (Java 17 & Jakarta EE 9)</p>
</li>
<li>
<p>JSR-303, specifically for @NotNull, @Min, @Max, and @Size.</p>
</li>
<li>
<p>Swagger-ui</p>
</li>
<li>
<p>OAuth 2</p>
</li>
<li>
<p>GraalVM native images</p>
</li>
</ul>
</div>
<div class="paragraph">
<p>The following video introduces the Library:</p>
</div>
<div class="imageblock">
<div class="content">
<a class="image" href="https://youtu.be/ondlnm5ZoFM?t=9" target="_blank" rel="noopener"><img src="img/spring-io-24.png" alt="spring.io conference"></a>
</div>
</div>
<div class="paragraph">
<p>This is a community-based project, not maintained by the Spring Framework Contributors (Pivotal).</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="getting-started"><a class="anchor" href="#getting-started"></a>2. Getting Started</h2>
<div class="sectionbody">
<div class="paragraph">
<p>For the integration between spring-boot and swagger-ui, add the library to the list of your project dependencies (No additional configuration is needed)</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlight"><code class="language-xml" data-lang="xml"> <dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
<version>2.7.0</version>
</dependency></code></pre>
</div>
</div>
<div class="paragraph">
<p>This will automatically deploy swagger-ui to a spring-boot application:</p>
</div>
<div class="ulist">
<ul>
<li>
<p>Documentation will be available in HTML format, using the official <a href="https://github.com/swagger-api/swagger-ui.git" target="_blank" rel="noopener">swagger-ui jars</a></p>
</li>
<li>
<p>The Swagger UI page will then be available at <code>http://server:port/context-path/swagger-ui.html</code> and the OpenAPI description will be available at the following url for json format: <code>http://server:port/context-path/v3/api-docs</code></p>
<div class="ulist">
<ul>
<li>
<p>server: The server name or IP</p>
</li>
<li>
<p>port: The server port</p>
</li>
<li>
<p>context-path: The context path of the application</p>
</li>
</ul>
</div>
</li>
<li>
<p>Documentation can be available in yaml format as well, on the following path : /v3/api-docs.yaml</p>
</li>
</ul>
</div>
<div class="admonitionblock tip">
<table>
<tr>
<td class="icon">
<i class="fa icon-tip" title="Tip"></i>
</td>
<td class="content">
For custom path of the swagger documentation in HTML format, add a custom springdoc property, in your spring-boot configuration file: .
</td>
</tr>
</table>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlight"><code class="language-properties" data-lang="properties"># swagger-ui custom path
springdoc.swagger-ui.path=/swagger-ui.html</code></pre>
</div>
</div>
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-8127371937306964"
crossorigin="anonymous"></script>
<ins class="adsbygoogle"
style="display:block; text-align:center;"
data-ad-layout="in-article"
data-ad-format="fluid"
data-ad-client="ca-pub-8127371937306964"
data-ad-slot="6163211104"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
</div>
</div>
<div class="sect1">
<h2 id="modules"><a class="anchor" href="#modules"></a>3. Springdoc-openapi Modules</h2>
<div class="sectionbody">
<div class="sect2">
<h3 id="general-overview"><a class="anchor" href="#general-overview"></a>3.1. General overview</h3>
<div class="imageblock">
<div class="content">
<img src="img/common.png" alt="Architecture">
</div>
</div>
</div>
<div class="sect2">
<h3 id="spring-webmvc-support"><a class="anchor" href="#spring-webmvc-support"></a>3.2. Spring WebMvc support</h3>
<div class="ulist">
<ul>
<li>
<p>Documentation will be available at the following url for json format: <code>http://server:port/context-path/v3/api-docs</code></p>
<div class="ulist">
<ul>
<li>
<p>server: The server name or IP</p>
</li>
<li>
<p>port: The server port</p>
</li>
<li>
<p>context-path: The context path of the application</p>
</li>
</ul>
</div>
</li>
<li>
<p>Documentation will be available in yaml format as well, on the following path : /v3/api-docs.yaml</p>
</li>
<li>
<p>Add the library to the list of your project dependencies. (No additional configuration is needed)</p>
</li>
</ul>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlight"><code class="language-xml" data-lang="xml"> <dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-webmvc-api</artifactId>
<version>2.7.0</version>
</dependency></code></pre>
</div>
</div>
<div class="admonitionblock note">
<table>
<tr>
<td class="icon">
<i class="fa icon-note" title="Note"></i>
</td>
<td class="content">
This dependency is relevant if you want to generate the OpenAPI description without using the swagger-ui.
</td>
</tr>
</table>
</div>
<div class="admonitionblock tip">
<table>
<tr>
<td class="icon">
<i class="fa icon-tip" title="Tip"></i>
</td>
<td class="content">
For custom path of the OpenAPI documentation in Json format, add a custom springdoc property, in your spring-boot configuration file:
</td>
</tr>
</table>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlight"><code class="language-properties" data-lang="properties"># /api-docs endpoint custom path
springdoc.api-docs.path=/api-docs</code></pre>
</div>
</div>
</div>
<div class="sect2">
<h3 id="spring-webflux-support"><a class="anchor" href="#spring-webflux-support"></a>3.3. Spring WebFlux support</h3>
<div class="ulist">
<ul>
<li>
<p>Documentation can be available in yaml format as well, on the following path : /v3/api-docs.yaml</p>
</li>
<li>
<p>Add the library to the list of your project dependencies (No additional configuration is needed)</p>
</li>
</ul>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlight"><code class="language-xml" data-lang="xml"> <dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-webflux-api</artifactId>
<version>2.7.0</version>
</dependency></code></pre>
</div>
</div>
</div>
<div class="sect2">
<h3 id="spring-hateoas-support"><a class="anchor" href="#spring-hateoas-support"></a>3.4. Spring Hateoas support</h3>
<div class="paragraph">
<p>The support for Spring Hateoas is available using the dependency springdoc-openapi-hateoas.</p>
</div>
<div class="paragraph">
<p>The projects that use <code>spring-boot-starter-hateoas</code> should use:</p>
</div>
<div class="ulist">
<ul>
<li>
<p><code>springdoc-openapi-starter-webmvc-api</code> if they need only the access to the OpenAPI endpoints</p>
</li>
<li>
<p>OR <code>springdoc-openapi-starter-webmvc-ui</code>, if they need also the access to the swagger-ui</p>
</li>
</ul>
</div>
</div>
<div class="sect2">
<h3 id="spring-data-rest-support"><a class="anchor" href="#spring-data-rest-support"></a>3.5. Spring Data Rest support</h3>
<div class="paragraph">
<p><code>springdoc-openapi</code> project supports <code>spring-boot-starter-data-rest</code> types like: <code>@RepositoryRestResource</code> and <code>QuerydslPredicate</code> annotations.</p>
</div>
<div class="paragraph">
<p>The projects that use <code>spring-boot-starter-data-rest</code> should use:</p>
</div>
<div class="ulist">
<ul>
<li>
<p><code>springdoc-openapi-starter-webmvc-api</code> if they need only the access to the OpenAPI endpoints</p>
</li>
<li>
<p>OR <code>springdoc-openapi-starter-webmvc-ui</code>, if they need also the access to the swagger-ui</p>
</li>
</ul>
</div>
</div>
<div class="sect2">
<h3 id="spring-security-support"><a class="anchor" href="#spring-security-support"></a>3.6. Spring Security support</h3>
<div class="paragraph">
<p><code>springdoc-openapi</code> helps ignoring @AuthenticationPrincipal type in case it is used on REST Controllers.</p>
</div>
<div class="paragraph">
<p><code>springdoc-openapi</code> supports also exposing Oauth2 endpoints of <code>spring-security-oauth2-authorization-server</code>.</p>
</div>
<div class="paragraph">
<p>The projects that use <code>spring-boot-starter-security</code> or <code>spring-security-oauth2-authorization-server</code> should use:</p>
</div>
<div class="ulist">
<ul>
<li>
<p><code>springdoc-openapi-starter-webmvc-api</code> if they depend on <code>spring-boot-starter-web</code> and they only need the access to the OpenAPI endpoints.</p>
</li>
<li>
<p>OR <code>springdoc-openapi-starter-webmvc-ui</code>, if they depend on <code>spring-boot-starter-web</code> and they also need the access to the swagger-ui.</p>
</li>
<li>
<p>OR <code>springdoc-openapi-starter-webflux-api</code> if they depend on <code>spring-boot-starter-webflux</code> and they only the access to the OpenAPI endpoints.</p>
</li>
<li>
<p>OR <code>springdoc-openapi-starter-webflux-ui</code>, if they depend on <code>spring-boot-starter-webflux</code> and they also need the access to the swagger-ui.</p>
</li>
</ul>
</div>
</div>
<div class="sect2">
<h3 id="actuator-support"><a class="anchor" href="#actuator-support"></a>3.7. Actuator support</h3>
<div class="ulist">
<ul>
<li>
<p>In order to display <code>spring-boot-actuator</code> endpoints, simply add the following property:</p>
</li>
</ul>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlight"><code class="language-properties" data-lang="properties">springdoc.show-actuator=true</code></pre>
</div>
</div>
<div class="paragraph">
<p>Starting from the release <code>1.5.1</code>, it will be possible to expose the <strong>swagger-ui</strong> and the <strong>openapi</strong> endpoints on <strong>actuator port</strong>.</p>
</div>
<div class="admonitionblock note">
<table>
<tr>
<td class="icon">
<i class="fa icon-note" title="Note"></i>
</td>
<td class="content">
The actuator management port has to be different from the application port.
</td>
</tr>
</table>
</div>
<div class="paragraph">
<p>To expose the swagger-ui, on the management port, you should set</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlight"><code class="language-properties" data-lang="properties">springdoc.use-management-port=true
# This property enables the openapi and swagger-ui endpoints to be exposed beneath the actuator base path.
management.endpoints.web.exposure.include=openapi, swagger-ui</code></pre>
</div>
</div>
<div class="paragraph">
<p>Once enabled, you should also be able to see the springdoc-openapi endpoints under: (host and port depends on your settings)
- <code>http://serverName:managementPort/actuator</code></p>
</div>
<div class="paragraph">
<p>For example, if you have the following settings:</p>
</div>
<div class="paragraph">
<p>Two endpoints will be available:</p>
</div>
<div class="olist arabic">
<ol class="arabic">
<li>
<p>REST API that holdes the OpenAPI definition:</p>
<div class="ulist">
<ul>
<li>
<p><code>http://serverName:managementPort/actuator/openapi</code></p>
</li>
</ul>
</div>
</li>
<li>
<p>An Endpoint, that routes to the swagger-ui:</p>
<div class="ulist">
<ul>
<li>
<p><code>http://serverName:managementPort/actuator/swagger-ui</code></p>
</li>
</ul>
</div>
</li>
</ol>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlight"><code class="language-properties" data-lang="properties">management.server.port=9090</code></pre>
</div>
</div>
<div class="paragraph">
<p>For the example, you should also be able to see the springdoc-openapi endpoints:</p>
</div>
<div class="ulist">
<ul>
<li>
<p><code>http://serverName:9090/actuator</code></p>
</li>
<li>
<p><code>http://serverName:9090/actuator/swagger-ui</code></p>
</li>
<li>
<p><code>http://serverName:9090/actuator/openapi</code></p>
</li>
</ul>
</div>
<div class="paragraph">
<p>All the path <code>springdoc-openapi</code> properties are not applicable when <code>springdoc.use-management-port=true</code>.</p>
</div>
<div class="admonitionblock tip">
<table>
<tr>
<td class="icon">
<i class="fa icon-tip" title="Tip"></i>
</td>
<td class="content">
If you want to reach the application endpoints, from the swagger-ui deployed beneath the actuator base path, using a different port from your application, <code>CORS for your endpoints</code> on your application level should be enabled.
</td>
</tr>
</table>
</div>
<div class="paragraph">
<p>Additionally, it is also possible to combine this property, with the existing property to display the actuator endpoints in the swagger-ui.</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlight"><code class="language-properties" data-lang="properties">springdoc.show-actuator=true</code></pre>
</div>
</div>
<div class="paragraph">
<p>Once enabled:
- A dedicated group for the actuator endpoints will be by default added.
- If no group is defined for the application, a default one will be added.</p>
</div>
<div class="paragraph">
<p>The swagger-ui will be then accessible through the actuator port:</p>
</div>
<div class="ulist">
<ul>
<li>
<p><code>http://serverName:managementPort/actuator/swagger-ui</code></p>
</li>
</ul>
</div>
<div class="paragraph">
<p>If the management port is different from the application port and <code>springdoc.use-management-port</code> is not defined but <code>springdoc.show-actuator</code> is set to true:</p>
</div>
<div class="ulist">
<ul>
<li>
<p>The swagger-ui will be then accessible through the application port. For example: <code>http://serverName:applicationPort/swagger-ui.html</code></p>
</li>
<li>
<p>A dedicated group for the actuator endpoints will be by default added.</p>
</li>
<li>
<p>If no group is defined for the application, a default one will be added.</p>
</li>
</ul>
</div>
<div class="admonitionblock tip">
<table>
<tr>
<td class="icon">
<i class="fa icon-tip" title="Tip"></i>
</td>
<td class="content">
If you want to reach the actuator endpoints for this case (different port from your application), <code>CORS</code> for your actuator endpoints should be enabled.
</td>
</tr>
</table>
</div>
<div class="paragraph">
<p>Note: The naming of these new endpoints beneath the actuator base path cannot be customized for now.</p>
</div>
</div>
<div class="sect2">
<h3 id="spring-cloud-function-web-support"><a class="anchor" href="#spring-cloud-function-web-support"></a>3.8. Spring Cloud Function Web support</h3>
<div class="paragraph">
<p><code>spring-cloud-function-web</code> exposes Java Function as REST endpoint automatically.
* Since version <code>v1.6.3</code>, the support of functional endpoints has been added.</p>
</div>
<div class="ulist">
<ul>
<li>
<p>These starters will display the OpenAPI description of the <code>spring-cloud-function-web</code> endpoints.</p>
<div class="ulist">
<ul>
<li>
<p>If you are using <code>spring-web</code>, simply add the <code>springdoc-openapi-starter-webmvc-ui</code> dependency.</p>
</li>
<li>
<p>If you are using <code>spring-webflux</code>, simply add the <code>springdoc-openapi-starter-webflux-ui</code> dependency.</p>
</li>
</ul>
</div>
</li>
</ul>
</div>
<div class="paragraph">
<p>The customisation of the output can be achieved programmatically through <code>OpenApiCustomizer</code> or with the annotations: <code>@RouterOperations</code> and <code>@RouterOperation</code>.
For annotation usage, you have:
* <code>@RouterOperation</code>: It can be used alone, if the customisation is related to a single REST API.
When using <code>@RouterOperation</code>, it’s not mandatory to fill the path</p>
</div>
<div class="ulist">
<ul>
<li>
<p><code>@RouterOperation</code>, contains the <code>@Operation</code> annotation.
The <code>@Operation</code> annotation can also be placed on the bean method level if the property beanMethod is declared.</p>
</li>
</ul>
</div>
<div class="admonitionblock important">
<table>
<tr>
<td class="icon">
<i class="fa icon-important" title="Important"></i>
</td>
<td class="content">
Don’t forget to set <strong>operationId</strong> which is <strong>mandatory</strong>.
</td>
</tr>
</table>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlight"><code class="language-java" data-lang="java">@Bean
@RouterOperation(operation = @Operation(description = "Say hello", operationId = "hello", tags = "persons",
responses = @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = PersonDTO.class)))))
public Supplier<PersonDTO> helloSupplier() {
return () -> new PersonDTO();
}
</code></pre>
</div>
</div>
<div class="ulist">
<ul>
<li>
<p><code>@RouterOperations</code>: This annotation should be used to describe the multiple REST APIs exposed by <code>spring-cloud-function-web</code>.
When using <code>RouterOperations</code>, it’s mandatory to fill the method property.</p>
</li>
<li>
<p>A <code>@RouterOperations</code>, contains many <code>@RouterOperation</code>.</p>
</li>
</ul>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlight"><code class="language-java" data-lang="java">@Bean
@RouterOperations({
@RouterOperation(method = RequestMethod.GET, operation = @Operation(description = "Say hello GET", operationId = "lowercaseGET", tags = "persons")),
@RouterOperation(method = RequestMethod.POST, operation = @Operation(description = "Say hello POST", operationId = "lowercasePOST", tags = "positions"))
})
public Function<Flux<String>, Flux<String>> lowercase() {
return flux -> flux.map(value -> value.toLowerCase());
}
</code></pre>
</div>
</div>
<div class="paragraph">
<p>Some code samples are available on GITHUB of demos:</p>
</div>
<div class="ulist">
<ul>
<li>
<p><a href="https://github.com/springdoc/springdoc-openapi-demos/tree/master/demo-spring-cloud-function" target="_blank" rel="noopener">Sample applications with Spring Cloud Function Web</a></p>
</li>
</ul>
</div>
</div>
<div class="sect2">
<h3 id="kotlin-support"><a class="anchor" href="#kotlin-support"></a>3.9. Kotlin support</h3>
<div class="paragraph">
<p><code>springdoc-openapi</code> supports Kotlin types.</p>
</div>
<div class="paragraph">
<p>The projects that use <code>Kotlin</code> should use:</p>
</div>
<div class="ulist">
<ul>
<li>
<p><code>springdoc-openapi-starter-webmvc-api</code> if they depend on <code>spring-boot-starter-web</code> and they only need the access to the OpenAPI endpoints.</p>
</li>
<li>
<p>OR <code>springdoc-openapi-starter-webmvc-ui</code>, if they depend on <code>spring-boot-starter-web</code> and they also need the access to the swagger-ui.</p>
</li>
<li>
<p>OR <code>springdoc-openapi-starter-webflux-api</code> if they depend on <code>spring-boot-starter-webflux</code> and they only the access to the OpenAPI endpoints.</p>
</li>
<li>
<p>OR <code>springdoc-openapi-starter-webflux-ui</code>, if they depend on <code>spring-boot-starter-webflux</code> and they also need the access to the swagger-ui.</p>
</li>
</ul>
</div>
<div class="admonitionblock note">
<table>
<tr>
<td class="icon">
<i class="fa icon-note" title="Note"></i>
</td>
<td class="content">
In addition, your project should add <code>jackson-module-kotlin</code> as well to have the full support of <code>Kotlin</code> types:
</td>
</tr>
</table>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlight"><code class="language-xml" data-lang="xml"> <dependency>
<groupId>com.fasterxml.jackson.module</groupId>
<artifactId>jackson-module-kotlin</artifactId>
</dependency></code></pre>
</div>
</div>
</div>
<div class="sect2">
<h3 id="groovy-support"><a class="anchor" href="#groovy-support"></a>3.10. Groovy support</h3>
<div class="paragraph">
<p>The projects that use <code>Groovy</code> should use:</p>
</div>
<div class="ulist">
<ul>
<li>
<p><code>springdoc-openapi-starter-webmvc-api</code> if they depend on <code>spring-boot-starter-web</code> and they only need the access to the OpenAPI endpoints.</p>
</li>
<li>
<p>OR <code>springdoc-openapi-starter-webmvc-ui</code>, if they depend on <code>spring-boot-starter-web</code> and they also need the access to the swagger-ui.</p>
</li>
<li>
<p>OR <code>springdoc-openapi-starter-webflux-api</code> if they depend on <code>spring-boot-starter-webflux</code> and they only the access to the OpenAPI endpoints.</p>
</li>
<li>
<p>OR <code>springdoc-openapi-starter-webflux-ui</code>, if they depend on <code>spring-boot-starter-webflux</code> and they also need the access to the swagger-ui.</p>
</li>
</ul>
</div>
</div>
<div class="sect2">
<h3 id="javadoc-support"><a class="anchor" href="#javadoc-support"></a>3.11. Javadoc support</h3>
<div class="paragraph">
<p><code>springdoc-openapi</code> can introspect <code>Javadoc</code> annotations and comments:</p>
</div>
<div class="ulist">
<ul>
<li>
<p>The javadoc comment of a method: is resolved as the <code>@Operation</code> description</p>
</li>
<li>
<p><code>@return </code>: is resolved as the <code>@Operation</code> response description</p>
</li>
<li>
<p>The javadoc comment of an attribute: is resolved as '@Schema' description for this field.</p>
</li>
</ul>
</div>
<div class="paragraph">
<p>The projects that needs <code>Javadoc</code> support should use:</p>
</div>
<div class="ulist">
<ul>
<li>
<p><code>springdoc-openapi-starter-webmvc-api</code> if they depend on <code>spring-boot-starter-web</code> and they only need the access to the OpenAPI endpoints.</p>
</li>
<li>
<p>OR <code>springdoc-openapi-starter-webmvc-ui</code>, if they depend on <code>spring-boot-starter-web</code> and they also need the access to the swagger-ui.</p>
</li>
<li>
<p>OR <code>springdoc-openapi-starter-webflux-api</code> if they depend on <code>spring-boot-starter-webflux</code> and they only the access to the OpenAPI endpoints.</p>
</li>
<li>
<p>OR <code>springdoc-openapi-starter-webflux-ui</code>, if they depend on <code>spring-boot-starter-webflux</code> and they also need the access to the swagger-ui.</p>
</li>
</ul>
</div>
<div class="admonitionblock note">
<table>
<tr>
<td class="icon">
<i class="fa icon-note" title="Note"></i>
</td>
<td class="content">
In addition, your project should add <a href="https://github.com/dnault/therapi-runtime-javadoc"><code>therapi-runtime-javadoc</code></a> to read Javadoc comments at runtime.
Ensure that you add it as well as its annotation processor to your project’s dependencies. Otherwise, the Javadoc support will fail silently.
</td>
</tr>
</table>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlight"><code class="language-xml" data-lang="xml"> <!--Annotation processor -->
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<annotationProcessorPaths>
<path>
<groupId>com.github.therapi</groupId>
<artifactId>therapi-runtime-javadoc-scribe</artifactId>
<version>0.15.0</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
</plugins>
</build>
<!-- Runtime library -->
<dependency>
<groupId>com.github.therapi</groupId>
<artifactId>therapi-runtime-javadoc</artifactId>
<version>0.15.0</version>
</dependency></code></pre>
</div>
</div>
<div class="admonitionblock tip">
<table>
<tr>
<td class="icon">
<i class="fa icon-tip" title="Tip"></i>
</td>
<td class="content">
If both a swagger-annotation description and a javadoc comment are present. The value of the swagger-annotation description will be used.
</td>
</tr>
</table>
</div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="features"><a class="anchor" href="#features"></a>4. Springdoc-openapi Features</h2>
<div class="sectionbody">
<div class="sect2">
<h3 id="adding-api-information-and-security-documentation"><a class="anchor" href="#adding-api-information-and-security-documentation"></a>4.1. Adding API Information and Security documentation</h3>
<div class="paragraph">
<p>The library uses spring-boot application auto-configured packages to scan for the following annotations in spring beans: OpenAPIDefinition and Info.
These annotations declare, API Information: Title, version, licence, security, servers, tags, security and externalDocs.
For better performance of documentation generation, declare @OpenAPIDefinition and @SecurityScheme annotations within a spring managed bean.</p>
</div>
</div>
<div class="sect2">
<h3 id="error-handling-for-rest-using-controlleradvice"><a class="anchor" href="#error-handling-for-rest-using-controlleradvice"></a>4.2. Error Handling for REST using @ControllerAdvice</h3>
<div class="paragraph">
<p>To generate documentation automatically, make sure all the methods declare the HTTP Code responses using the annotation: @ResponseStatus</p>
</div>
</div>
<div class="sect2">
<h3 id="disabling-the-springdoc-openapi-endpoints"><a class="anchor" href="#disabling-the-springdoc-openapi-endpoints"></a>4.3. Disabling the <code>springdoc-openapi</code> endpoints</h3>
<div class="paragraph">
<p>In order to disable the <code>springdoc-openapi</code> endpoint (/v3/api-docs by default) use the following property:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlight"><code class="language-properties" data-lang="properties"># Disabling the /v3/api-docs endpoint
springdoc.api-docs.enabled=false</code></pre>
</div>
</div>
</div>
<div class="sect2">
<h3 id="disabling-the-swagger-ui"><a class="anchor" href="#disabling-the-swagger-ui"></a>4.4. Disabling the swagger-ui</h3>
<div class="paragraph">
<p>In order to disable the swagger-ui, use the following property:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlight"><code class="language-properties" data-lang="properties"># Disabling the swagger-ui
springdoc.swagger-ui.enabled=false</code></pre>