Skip to content

Commit 7609273

Browse files
authored
fix string compare in haskell generator (#18410)
1 parent dd97def commit 7609273

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/HaskellServantCodegen.java

+8-5
Original file line numberDiff line numberDiff line change
@@ -333,13 +333,14 @@ public void preprocessOpenAPI(OpenAPI openAPI) {
333333

334334
/**
335335
* Internal method to set the generateToSchema parameter.
336-
*
336+
* <p>
337337
* Basically we're generating ToSchema instances (generically) for all schemas.
338338
* However, if any of the contained datatypes doesn't have the ToSchema instance,
339339
* we cannot generate it for its "ancestor" type.
340340
* This is the case with the "Data.Aeson.Value" type: it doesn't (and cannot) have
341341
* a Swagger-compatible ToSchema instance. So we have to detect its presence "downstream"
342342
* the current schema, and if we find it we just don't generate any ToSchema instance.
343+
*
343344
* @param model
344345
*/
345346
private void setGenerateToSchema(CodegenModel model) {
@@ -356,7 +357,7 @@ private void setGenerateToSchema(CodegenModel model) {
356357

357358
List<CodegenModel> children = model.getChildren();
358359
if (children != null) {
359-
for(CodegenModel child : children) {
360+
for (CodegenModel child : children) {
360361
setGenerateToSchema(child);
361362
}
362363
}
@@ -512,7 +513,7 @@ public CodegenOperation fromOperation(String resourcePath, String httpMethod, Op
512513
// Query parameters appended to routes
513514
for (CodegenParameter param : op.queryParams) {
514515
String paramType = param.dataType;
515-
if (param.contentType == "application/json") {
516+
if ("application/json".equals(param.contentType)) {
516517
if (param.isArray) {
517518
paramType = "[JSONQueryParam " + paramType.substring(1, paramType.length() - 1) + "]";
518519
} else {
@@ -554,7 +555,7 @@ public CodegenOperation fromOperation(String resourcePath, String httpMethod, Op
554555
path.add("Header \"" + param.baseName + "\" " + param.dataType);
555556

556557
String paramType = param.dataType;
557-
if (param.contentType == "application/json") {
558+
if ("application/json".equals(param.contentType)) {
558559
if (param.isArray) {
559560
paramType = "(JSONQueryParam " + paramType.substring(1, paramType.length() - 1) + ")";
560561
} else {
@@ -721,5 +722,7 @@ public void postProcessFile(File file, String fileType) {
721722
}
722723

723724
@Override
724-
public GeneratorLanguage generatorLanguage() { return GeneratorLanguage.HASKELL; }
725+
public GeneratorLanguage generatorLanguage() {
726+
return GeneratorLanguage.HASKELL;
727+
}
725728
}

0 commit comments

Comments
 (0)