|
1 | | -/* |
2 | | - * Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech) |
3 | | - * |
4 | | - * Licensed under the Apache License, Version 2.0 (the "License"); |
5 | | - * you may not use this file except in compliance with the License. |
6 | | - * You may obtain a copy of the License at |
7 | | - * |
8 | | - * https://www.apache.org/licenses/LICENSE-2.0 |
9 | | - * |
10 | | - * Unless required by applicable law or agreed to in writing, software |
11 | | - * distributed under the License is distributed on an "AS IS" BASIS, |
12 | | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
13 | | - * See the License for the specific language governing permissions and |
14 | | - * limitations under the License. |
15 | | - */ |
16 | | - |
17 | 1 | package org.openapitools.codegen.languages; |
18 | 2 |
|
19 | 3 | import lombok.Setter; |
@@ -57,8 +41,7 @@ public class KotlinMiskServerCodegen extends AbstractKotlinCodegen implements Be |
57 | 41 | protected String rootPackage = "org.openapitools.server.api"; |
58 | 42 | protected String apiVersion = "1.0.0-SNAPSHOT"; |
59 | 43 |
|
60 | | - @Setter |
61 | | - protected String moduleClassName = "OpenApiModule"; |
| 44 | + @Setter protected String moduleClassName = "OpenApiModule"; |
62 | 45 |
|
63 | 46 | @Override |
64 | 47 | public CodegenType getTag() { |
@@ -199,30 +182,36 @@ public boolean getUseBeanValidation() { |
199 | 182 | } |
200 | 183 |
|
201 | 184 | private String mapMediaType(String mediaType) { |
202 | | - return MEDIA_MAPPING.getOrDefault(mediaType, "MediaTypes.APPLICATION_OCTETSTREAM /* unknown -> " + mediaType + " */ "); |
| 185 | + return MEDIA_MAPPING.getOrDefault(mediaType, "MediaTypes.APPLICATION_OCTETSTREAM /* @todo(unknown) -> " + mediaType + " */ "); |
203 | 186 | } |
204 | 187 |
|
205 | 188 | private final static Map<String, String> MEDIA_MAPPING = getMappings(); |
206 | 189 |
|
207 | 190 | private static Map<String, String> getMappings() { |
| 191 | + // add new values in order |
208 | 192 | Map<String, String> result = new HashMap<>(); |
209 | | - result.put("application/json", "MediaTypes.APPLICATION_JSON"); |
210 | | - result.put("application/xml", "MediaTypes.APPLICATION_XML"); |
211 | | - result.put("application/javascript", "MediaTypes.APPLICATION_JAVASCRIPT"); |
212 | 193 | result.put("*/*", "MediaTypes.ALL"); |
213 | | - result.put("application/x-www-form-urlencoded", "MediaTypes.APPLICATION_FORM_URLENCODED"); |
| 194 | + |
| 195 | + result.put("application/grpc", "MediaTypes.APPLICATION_GRPC"); |
| 196 | + result.put("application/javascript", "MediaTypes.APPLICATION_JAVASCRIPT"); |
| 197 | + result.put("application/json", "MediaTypes.APPLICATION_JSON"); |
214 | 198 | result.put("application/octetstream", "MediaTypes.APPLICATION_OCTETSTREAM"); |
215 | 199 | result.put("application/pdf", "MediaTypes.APPLICATION_OCTETSTREAM"); |
216 | 200 | result.put("application/x-protobuf", "MediaTypes.APPLICATION_PROTOBUF"); |
217 | | - result.put("application/grpc", "MediaTypes.APPLICATION_GRPC"); |
218 | | - result.put("text/css", "MediaTypes.TEXT_CSS"); |
219 | | - result.put("text/html", "MediaTypes.TEXT_HTML"); |
220 | | - result.put("text/plain", "MediaTypes.TEXT_PLAIN_UTF8"); |
| 201 | + result.put("application/x-www-form-urlencoded", "MediaTypes.APPLICATION_FORM_URLENCODED"); |
| 202 | + result.put("application/xml", "MediaTypes.APPLICATION_XML"); |
| 203 | + result.put("application/zip", "MediaTypes.APPLICATION_ZIP"); |
| 204 | + |
| 205 | + result.put("image/gif", "MediaTypes.IMAGE_GIF"); |
| 206 | + result.put("image/jpeg", "MediaTypes.IMAGE_JPEG"); |
221 | 207 | result.put("image/png", "MediaTypes.IMAGE_PNG"); |
222 | 208 | result.put("image/svg+xml", "MediaTypes.IMAGE_SVG"); |
223 | | - result.put("image/jpeg", "MediaTypes.IMAGE_JPEG"); |
224 | | - result.put("image/gif", "MediaTypes.IMAGE_GIF"); |
225 | 209 | result.put("image/x-icon", "MediaTypes.IMAGE_ICO"); |
| 210 | + |
| 211 | + result.put("text/css", "MediaTypes.TEXT_CSS"); |
| 212 | + result.put("text/html", "MediaTypes.TEXT_HTML"); |
| 213 | + result.put("text/plain", "MediaTypes.TEXT_PLAIN_UTF8"); |
| 214 | + |
226 | 215 | return result; |
227 | 216 | } |
228 | 217 | } |
0 commit comments