From 1f950bd627229c32aeea4c0275880f77d117c049 Mon Sep 17 00:00:00 2001 From: lnash94 Date: Fri, 15 Nov 2024 16:19:41 +0530 Subject: [PATCH] Fix conflicts --- .../service/mapper/type/RecordTypeMapper.java | 7 +++---- .../service/mapper/utils/MapperCommonUtils.java | 12 ------------ .../expected_gen/header_scenario13.yaml | 10 +++++----- 3 files changed, 8 insertions(+), 21 deletions(-) diff --git a/ballerina-to-openapi/src/main/java/io/ballerina/openapi/service/mapper/type/RecordTypeMapper.java b/ballerina-to-openapi/src/main/java/io/ballerina/openapi/service/mapper/type/RecordTypeMapper.java index 92ba6245f..f8b34c76d 100644 --- a/ballerina-to-openapi/src/main/java/io/ballerina/openapi/service/mapper/type/RecordTypeMapper.java +++ b/ballerina-to-openapi/src/main/java/io/ballerina/openapi/service/mapper/type/RecordTypeMapper.java @@ -17,7 +17,6 @@ */ package io.ballerina.openapi.service.mapper.type; -import io.ballerina.compiler.api.SemanticModel; import io.ballerina.compiler.api.SemanticModel; import io.ballerina.compiler.api.symbols.IntersectionTypeSymbol; import io.ballerina.compiler.api.symbols.RecordFieldSymbol; @@ -56,7 +55,6 @@ import static io.ballerina.openapi.service.mapper.Constants.NAME_CONFIG; import static io.ballerina.openapi.service.mapper.Constants.VALUE; import static io.ballerina.openapi.service.mapper.utils.MapperCommonUtils.getNameFromAnnotation; -import static io.ballerina.openapi.service.mapper.utils.MapperCommonUtils.getExpressionNodeForConstantDeclaration; import static io.ballerina.openapi.service.mapper.utils.MapperCommonUtils.getRecordFieldTypeDescription; import static io.ballerina.openapi.service.mapper.utils.MapperCommonUtils.getTypeName; @@ -263,9 +261,10 @@ public static Map mapRecordFields(Map public static Map mapRecordFields(Map recordFieldMap, Components components, Set requiredFields, String recordName, boolean treatNilableAsOptional, - AdditionalData additionalData) { + AdditionalData additionalData, + Set fieldsOnlyForRequiredList) { return mapRecordFields(recordFieldMap, components, requiredFields, recordName, treatNilableAsOptional, - true, additionalData); + true, additionalData, fieldsOnlyForRequiredList); } private static String getRecordFieldName(boolean inferNameFromJsonData, diff --git a/ballerina-to-openapi/src/main/java/io/ballerina/openapi/service/mapper/utils/MapperCommonUtils.java b/ballerina-to-openapi/src/main/java/io/ballerina/openapi/service/mapper/utils/MapperCommonUtils.java index f460085f2..53c03278d 100644 --- a/ballerina-to-openapi/src/main/java/io/ballerina/openapi/service/mapper/utils/MapperCommonUtils.java +++ b/ballerina-to-openapi/src/main/java/io/ballerina/openapi/service/mapper/utils/MapperCommonUtils.java @@ -588,18 +588,6 @@ public static Node getTypeDescriptor(TypeDefinitionNode typeDefinitionNode) { return node; } - public static ExpressionNode getExpressionNodeForConstantDeclaration(ModuleMemberVisitor moduleMemberVisitor, - ExpressionNode defaultValueExpression, - SimpleNameReferenceNode reference) { - Optional constantDeclarationNode = moduleMemberVisitor - .getConstantDeclarationNode(reference.name().text()); - if (constantDeclarationNode.isPresent()) { - ConstantDeclarationNode constantNode = constantDeclarationNode.get(); - defaultValueExpression = (ExpressionNode) constantNode.initializer(); - } - return defaultValueExpression; - } - public static String getNameFromAnnotation(String packageName, String annotationName, String annotationFieldName, SemanticModel semanticModel, String defaultName, RecordFieldSymbol recordField) { diff --git a/openapi-cli/src/test/resources/ballerina-to-openapi/expected_gen/header_scenario13.yaml b/openapi-cli/src/test/resources/ballerina-to-openapi/expected_gen/header_scenario13.yaml index 1d55a8be7..a7887f655 100644 --- a/openapi-cli/src/test/resources/ballerina-to-openapi/expected_gen/header_scenario13.yaml +++ b/openapi-cli/src/test/resources/ballerina-to-openapi/expected_gen/header_scenario13.yaml @@ -139,11 +139,6 @@ paths: schema: type: string default: Pod - - name: header31 - in: header - schema: - type: string - default: Pod - name: header32 in: header required: true @@ -156,6 +151,11 @@ paths: - 1 - 2 - 3 + - name: header31 + in: header + schema: + type: string + default: Pod responses: "200": description: Ok