-
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
[master] Fix providing error message for openapi spec generation when bal service has compilation issues #1370
[master] Fix providing error message for openapi spec generation when bal service has compilation issues #1370
Conversation
12dffbc
to
3ba1000
Compare
Hold due to priorities some urgent fixes |
…i-tools into compilation_error_1364 # Conflicts: # gradle.properties
...ion-tests/src/test/resources/ballerina_sources/bal_service_has_compilation_issue/service.bal
Show resolved
Hide resolved
...ion-tests/src/test/resources/ballerina_sources/bal_service_has_compilation_issue/service.bal
Show resolved
Hide resolved
openapi-build-extension/src/main/java/io/ballerina/openapi/build/HttpServiceAnalysisTask.java
Outdated
Show resolved
Hide resolved
openapi-cli/src/main/java/io/ballerina/openapi/cmd/OASContractGenerator.java
Outdated
Show resolved
Hide resolved
// if there are any compilation errors, do not proceed and those diagnostic will display to user | ||
outStream.println("OpenAPI contract generation failed due to Ballerina code has compilation errors. :"); | ||
compilation.diagnosticResult().diagnostics().forEach(diagnostic -> { | ||
if (diagnostic.diagnosticInfo().severity().equals(DiagnosticSeverity.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.
i remember there was an api for this like diagnostic.diagnosticInfo().hasErrors()
or something like that
openapi-integration-tests/src/test/java/io/ballerina/openapi/cmd/BallerinaToOpenAPITests.java
Outdated
Show resolved
Hide resolved
Thread.sleep(5000); | ||
// compare generated file has not included constraint annotation for scenario record field. | ||
Assert.assertFalse(Files.exists(RESOURCE.resolve("\"build/package_with_compilation_issue/target/openapi/"))); | ||
process.waitFor(); |
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.
If we do waitFor
before the assert, do we need the above sleep?
openapi-build-extension/src/main/java/io/ballerina/openapi/build/HttpServiceAnalysisTask.java
Outdated
Show resolved
Hide resolved
openapi-build-extension/src/main/java/io/ballerina/openapi/build/HttpServiceAnalysisTask.java
Outdated
Show resolved
Hide resolved
openapi-build-extension/src/main/java/io/ballerina/openapi/build/HttpServiceAnalysisTask.java
Outdated
Show resolved
Hide resolved
openapi-build-extension/src/main/java/io/ballerina/openapi/build/HttpServiceAnalysisTask.java
Outdated
Show resolved
Hide resolved
openapi-build-extension/src/main/java/io/ballerina/openapi/build/HttpServiceAnalysisTask.java
Outdated
Show resolved
Hide resolved
openapi-build-extension/src/main/java/io/ballerina/openapi/build/HttpServiceAnalysisTask.java
Show resolved
Hide resolved
openapi-cli/src/main/java/io/ballerina/openapi/cmd/OASContractGenerator.java
Outdated
Show resolved
Hide resolved
openapi-cli/src/main/java/io/ballerina/openapi/cmd/OASContractGenerator.java
Show resolved
Hide resolved
This PR has been open for more than 15 days with no activity. This will be closed in 3 days unless the |
4709e89
to
bbfa308
Compare
Quality Gate passedIssues Measures |
This PR has been open for more than 15 days with no activity. This will be closed in 3 days unless the |
|
||
/** | ||
* This test class is for capturing special tests regarding resource methods. | ||
*/ | ||
public class HttpMethodTests { | ||
private static final Path RES_DIR = Paths.get("src/test/resources/ballerina-to-openapi/").toAbsolutePath(); | ||
private Path tempDir; | ||
private final ByteArrayOutputStream outputStreamCaptor = new ByteArrayOutputStream(); | ||
private final PrintStream standardOut = System.out; |
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.
private final PrintStream standardOut = System.out; | |
private final PrintStream stdOut = System.out; |
import static io.ballerina.openapi.TestUtil.assertOnErrorStream; | ||
|
||
/** | ||
* This {@code BallerinaToOpenAPITests} contains all the ballerina to openapi command negative. |
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.
Wrong link
* This {@code BallerinaToOpenAPITests} contains all the ballerina to openapi command negative. | |
* This class contains all the ballerina to OpenAPI command related negative tests. |
outStream.println("openapi contract generation is skipped because the compilation error(s)" + | ||
" in the ballerina package"); |
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.
outStream.println("openapi contract generation is skipped because the compilation error(s)" + | |
" in the ballerina package"); | |
outStream.println("openapi contract generation is skipped because of the compilation error(s)" + | |
" in the ballerina package"); |
@@ -68,6 +69,11 @@ | |||
* @since 2.0.0 | |||
*/ | |||
public class HttpServiceAnalysisTask implements AnalysisTask<SyntaxNodeAnalysisContext> { | |||
static boolean isErrorPrinted = false; |
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 having this flag? can the analysis get triggered multiple times during a single compilation?
This PR is on hold for a while, till the other priority tasks complete |
This PR has been open for more than 15 days with no activity. This will be closed in 3 days unless the |
Purpose
Automation tests
Security checks
Samples
Related PRs
Migrations (if applicable)
Test environment
Learning