@@ -31,7 +31,7 @@ The library has springdoc-openapi as a provided dependency,
31
31
thus users of the library have to include that dependency in their projects:
32
32
- for springdoc-openapi 1.x versions ` 1.6.7 ` up to ` 1.7.0 ` (including) of
33
33
` "org.springdoc" % "springdoc-openapi-webmvc-core" ` are supported
34
- - for springdoc-openapi 2.x versions ` 1.6.7 ` up to ` 1.7 .0` (including) of
34
+ - for springdoc-openapi 2.x versions ` 2.0.0 ` up to ` 2.3 .0` (including) of
35
35
` "org.springdoc" % "springdoc-openapi-starter-webmvc-api" ` are supported
36
36
37
37
### Add library dependency to SBT/Maven
@@ -50,31 +50,39 @@ If you want to use the library with springdoc-openapi 1.x, add:
50
50
``` xml
51
51
<dependency >
52
52
<groupId >za.co.absa</groupId >
53
- <artifactId >springdoc-openapi-scala-1_{scala_binary_version}</artifactId >
53
+ <artifactId >springdoc-openapi-scala-1_$ {scala_binary_version}</artifactId >
54
54
<version >${version}</version >
55
55
</dependency >
56
56
```
57
57
if with springdoc-openapi 2.x, add:
58
58
``` xml
59
59
<dependency >
60
60
<groupId >za.co.absa</groupId >
61
- <artifactId >springdoc-openapi-scala-2_{scala_binary_version}</artifactId >
61
+ <artifactId >springdoc-openapi-scala-2_$ {scala_binary_version}</artifactId >
62
62
<version >${version}</version >
63
63
</dependency >
64
64
```
65
65
66
66
where ` scala_binary_version ` is either ` 2.12 ` or ` 2.13 ` .
67
67
68
68
### Create custom OpenAPI Spring Configuration
69
+ For springdoc-openapi 1.x
69
70
``` scala
71
+ import io .swagger .v3 .oas .models .OpenAPI
72
+ import io .swagger .v3 .oas .models .info .Info
73
+ import org .springdoc .core .customizers .OpenApiCustomiser
74
+ import org .springframework .context .annotation .{Bean , Configuration }
75
+
76
+ import za .co .absa .springdocopenapiscala .{Bundle , OpenAPIModelRegistration }
77
+
70
78
@ Configuration
71
79
class OpenAPIConfiguration {
72
80
73
81
private val springDocOpenAPIScalaBundle = new Bundle (
74
82
Seq ((openAPI : OpenAPI ) =>
75
83
openAPI.setInfo(
76
84
new Info ()
77
- .title(" Example API" )
85
+ .title(" Example API with springdoc-openapi v1.x " )
78
86
.version(" 1.0.0" )
79
87
)
80
88
)
@@ -89,6 +97,37 @@ class OpenAPIConfiguration {
89
97
}
90
98
```
91
99
100
+ For springdoc-openapi 2.x
101
+ ``` scala
102
+ import io .swagger .v3 .oas .models .OpenAPI
103
+ import io .swagger .v3 .oas .models .info .Info
104
+ import org .springdoc .core .customizers .OpenApiCustomizer
105
+ import org .springframework .context .annotation .{Bean , Configuration }
106
+
107
+ import za .co .absa .springdocopenapiscala .{Bundle , OpenAPIModelRegistration }
108
+
109
+ @ Configuration
110
+ class OpenAPIConfiguration {
111
+
112
+ private val springDocOpenAPIScalaBundle = new Bundle (
113
+ Seq ((openAPI : OpenAPI ) =>
114
+ openAPI.setInfo(
115
+ new Info ()
116
+ .title(" Example API with springdoc-openapi v2.x" )
117
+ .version(" 1.0.0" )
118
+ )
119
+ )
120
+ )
121
+
122
+ @ Bean
123
+ def openAPICustomizer : OpenApiCustomizer = springDocOpenAPIScalaBundle.customizer
124
+
125
+ @ Bean
126
+ def openAPIModelRegistration : OpenAPIModelRegistration = springDocOpenAPIScalaBundle.modelRegistration
127
+
128
+ }
129
+ ```
130
+
92
131
### Register top-level model case classes (for example in Controller)
93
132
Example model:
94
133
``` scala
0 commit comments