Skip to content
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

Closed

Conversation

lnash94
Copy link
Member

@lnash94 lnash94 commented May 26, 2023

Purpose

ballerina-platform/ballerina-library#5134

Automation tests

  • Unit tests - added

    Code coverage information

  • Integration tests

    Details about the test cases and coverage

Security checks

Samples

Provide high-level details about the samples related to this feature

Related PRs

List any other related PRs

Migrations (if applicable)

Describe migration steps and platforms on which migration has been tested

Test environment

List all JDK versions, operating systems, databases, and browser/versions on which this feature/fix was tested

Learning

Describe the research phase and any blog posts, patterns, libraries, or add-ons you used to solve the problem.

@lnash94 lnash94 force-pushed the compilation_error_1364 branch from 12dffbc to 3ba1000 Compare May 27, 2023 03:23
@github-actions github-actions bot added the Stale label Jun 11, 2023
@lnash94 lnash94 removed the Stale label Jun 12, 2023
@lnash94
Copy link
Member Author

lnash94 commented Jun 22, 2023

Hold due to priorities some urgent fixes

@github-actions github-actions bot added the Stale label Jul 7, 2023
@lnash94 lnash94 removed the Stale label Jul 10, 2023
@github-actions github-actions bot added the Stale label Aug 4, 2023
@lnash94 lnash94 removed the Stale label Aug 7, 2023
@github-actions github-actions bot added the Stale label Aug 22, 2023
@lnash94 lnash94 removed the Stale label Aug 23, 2023
@github-actions github-actions bot added the Stale label Sep 7, 2023
@github-actions github-actions bot closed this Sep 11, 2023
@lnash94 lnash94 reopened this Sep 12, 2023
@github-actions github-actions bot closed this Sep 15, 2023
@lnash94 lnash94 removed the Stale label Sep 20, 2023
@lnash94 lnash94 reopened this Oct 2, 2023
@ballerina-platform ballerina-platform deleted a comment from github-actions bot Oct 2, 2023
@ballerina-platform ballerina-platform deleted a comment from github-actions bot Oct 2, 2023
@ballerina-platform ballerina-platform deleted a comment from github-actions bot Oct 2, 2023
@ballerina-platform ballerina-platform deleted a comment from github-actions bot Oct 2, 2023
@ballerina-platform ballerina-platform deleted a comment from github-actions bot Oct 2, 2023
@ballerina-platform ballerina-platform deleted a comment from github-actions bot Oct 2, 2023
@github-actions github-actions bot added the Stale label Oct 17, 2023
@github-actions github-actions bot closed this Oct 21, 2023
@lnash94 lnash94 reopened this Nov 1, 2023
// 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)) {
Copy link
Contributor

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

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();
Copy link
Contributor

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?

@github-actions github-actions bot added the Stale label Feb 15, 2024
@TharmiganK TharmiganK removed the Stale label Feb 16, 2024
@ballerina-platform ballerina-platform deleted a comment from github-actions bot Feb 16, 2024
Copy link

github-actions bot commented Mar 2, 2024

This PR has been open for more than 15 days with no activity. This will be closed in 3 days unless the stale label is removed or commented.

@github-actions github-actions bot added the Stale label Mar 2, 2024
@lnash94 lnash94 removed the Stale label Mar 4, 2024
@lnash94 lnash94 force-pushed the compilation_error_1364 branch from 4709e89 to bbfa308 Compare March 7, 2024 11:32
Copy link

sonarqubecloud bot commented Mar 7, 2024

Quality Gate Passed Quality Gate passed

Issues
3 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

Copy link

This PR has been open for more than 15 days with no activity. This will be closed in 3 days unless the stale label is removed or commented.

@github-actions github-actions bot added the Stale label Mar 22, 2024

/**
* 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;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrong link

Suggested change
* This {@code BallerinaToOpenAPITests} contains all the ballerina to openapi command negative.
* This class contains all the ballerina to OpenAPI command related negative tests.

Comment on lines +93 to +94
outStream.println("openapi contract generation is skipped because the compilation error(s)" +
" in the ballerina package");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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;
Copy link
Contributor

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?

@lnash94 lnash94 removed the Stale label Mar 25, 2024
@lnash94
Copy link
Member Author

lnash94 commented Apr 2, 2024

This PR is on hold for a while, till the other priority tasks complete

Copy link

This PR has been open for more than 15 days with no activity. This will be closed in 3 days unless the stale label is removed or commented.

@lnash94
Copy link
Member Author

lnash94 commented Apr 20, 2024

#1692

@lnash94 lnash94 closed this Apr 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants