Skip to content

Commit 4aedba6

Browse files
committed
use old status names (#339)
1 parent 89b3272 commit 4aedba6

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/main/kotlin/io/openapiprocessor/spring/processor/SpringFrameworkAnnotations.kt

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,11 @@ private fun getAnnotationName(name: String): String {
117117
return "${ANNOTATION_PKG}.${name}"
118118
}
119119

120+
// To avoid a dependency on Spring, the map provides the http status enum names.
121+
// This may break if the enum name does not exist in the used Spring version.
122+
123+
// https://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml
124+
120125
private val HTTP_STATUS = hashMapOf(
121126
"100" to getEnum("CONTINUE"),
122127
"101" to getEnum("SWITCHING_PROTOCOLS"),
@@ -136,7 +141,8 @@ private val HTTP_STATUS = hashMapOf(
136141

137142
"300" to getEnum("MULTIPLE_CHOICES"),
138143
"301" to getEnum("MOVED_PERMANENTLY"),
139-
"302" to getEnum("FOUND"), // replaces MOVED_TEMPORARILY
144+
"302" to getEnum("MOVED_TEMPORARILY"),
145+
//"302" to getEnum("FOUND"), // replaces MOVED_TEMPORARILY
140146
"303" to getEnum("SEE_OTHER"),
141147
"304" to getEnum("NOT_MODIFIED"),
142148
"305" to getEnum("USE_PROXY"),
@@ -156,8 +162,10 @@ private val HTTP_STATUS = hashMapOf(
156162
"410" to getEnum("GONE"),
157163
"411" to getEnum("LENGTH_REQUIRED"),
158164
"412" to getEnum("PRECONDITION_FAILED"),
159-
"413" to getEnum("PAYLOAD_TOO_LARGE"), // replaces REQUEST_ENTITY_TOO_LARGE
160-
"414" to getEnum("URI_TOO_LONG"), // replaces REQUEST_URI_TOO_LONG
165+
"413" to getEnum("REQUEST_ENTITY_TOO_LARGE"),
166+
//"413" to getEnum("PAYLOAD_TOO_LARGE"), // replaces REQUEST_ENTITY_TOO_LARGE
167+
"414" to getEnum("REQUEST_URI_TOO_LONG"),
168+
//"414" to getEnum("URI_TOO_LONG"), // replaces REQUEST_URI_TOO_LONG
161169
"415" to getEnum("UNSUPPORTED_MEDIA_TYPE"),
162170
"416" to getEnum("REQUESTED_RANGE_NOT_SATISFIABLE"),
163171
"417" to getEnum("EXPECTATION_FAILED"),

0 commit comments

Comments
 (0)