-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[1.8.x]Add support for union type request body mapping to Ballerina to OpenAPI spec generation #1544
Conversation
d09edd1
to
b06153b
Compare
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## 1.8.x ballerina-platform/openapi-tools#1544 +/- ##
========================================
Coverage ? 79.55%
Complexity ? 1763
========================================
Files ? 124
Lines ? 10086
Branches ? 1673
========================================
Hits ? 8024
Misses ? 1479
Partials ? 583 ☔ View full report in Codecov by Sentry. |
b06153b
to
7782d75
Compare
7782d75
to
deb8b15
Compare
...l-service/src/main/java/io/ballerina/openapi/converter/service/OpenAPIRequestBodyMapper.java
Outdated
Show resolved
Hide resolved
...l-service/src/main/java/io/ballerina/openapi/converter/service/OpenAPIRequestBodyMapper.java
Outdated
Show resolved
Hide resolved
...l-service/src/main/java/io/ballerina/openapi/converter/service/OpenAPIRequestBodyMapper.java
Outdated
Show resolved
Hide resolved
...l-service/src/main/java/io/ballerina/openapi/converter/service/OpenAPIRequestBodyMapper.java
Show resolved
Hide resolved
openapi-cli/src/test/resources/ballerina-to-openapi/request_body/union_type.bal
Show resolved
Hide resolved
Kudos, SonarCloud Quality Gate passed! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
openapi-cli/src/test/resources/ballerina-to-openapi/request_body/union_type.bal
Show resolved
Hide resolved
IncompatibleResourceDiagnostic error = new IncompatibleResourceDiagnostic( | ||
DiagnosticMessages.OAS_CONVERTOR_116, payloadNode.location(), | ||
String.valueOf(payloadNode.kind())); | ||
diagnostics.add(error); | ||
break; | ||
} | ||
} else { | ||
//Warning message for unsupported request payload type in Ballerina resource. | ||
IncompatibleResourceDiagnostic error = new IncompatibleResourceDiagnostic( | ||
DiagnosticMessages.OAS_CONVERTOR_116, payloadNode.location(), payloadNode.toSourceCode().trim()); | ||
diagnostics.add(error); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here we are using the same error, but with two different properties of the payload (payload kind at L247 and, payload node itself at L254). Is that intentional?
operationAdaptor.getOperation().setRequestBody(bodyParameter); | ||
} | ||
} | ||
|
||
private void addConsumes(OperationAdaptor operationAdaptor, RequestBody bodyParameter, String applicationType) { | ||
String type = applicationType.split("/")[1]; | ||
private void addConsumes(OperationAdaptor operationAdaptor, RequestBody bodyParameter, String applicationType, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whats the purpose of this util?
content.addMediaType(mimeType, media); | ||
} else if (typeDescriptorNode.kind() == SyntaxKind.BYTE_TYPE_DESC) { | ||
StringSchema byteSchema = new StringSchema(); | ||
byteSchema.setFormat("byte"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shall we reuse our predefined constant for "byte" in here?
Purpose
Automation tests
Security checks
Samples
Related PRs
Migrations (if applicable)
Test environment
Learning