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

Validate command output is polluted by noisy messages #1095

Open
cykl opened this issue Jan 29, 2024 · 6 comments
Open

Validate command output is polluted by noisy messages #1095

cykl opened this issue Jan 29, 2024 · 6 comments
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@cykl
Copy link

cykl commented Jan 29, 2024

Describe the bug

Validate command supports multiple diagnostics formats.
I assume that formats like json or junit are intended to be processed by machines.

However, validate command standard output is a mix of the selected diagnostics format and informational messages.
User must parse / filter standard output to end up with the expected file.

How to Reproduce

docker run -it --rm     -v ${PWD}:/spec test asyncapi validate /spec/docs/events/asyncapi.yaml --diagnostics-format=junit  > asyncapi.xml

cat asyncapi.xml
(node:1) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)

File /spec/docs/events/asyncapi.yaml and/or referenced documents have governance issues.
<?xml version="1.0" encoding="utf-8"?>
<testsuites>
<testsuite package="org.spectral" time="0" tests="1" errors="0" failures="1" name="/spec/docs/events/asyncapi.yaml">
<testcase time="0" name="org.spectral.asyncapi-document-resolved(#/channels/hems-site-events/messages/GatewayConnectionMqttDisconnected/payloa)" classname="/spec/docs/events/asyncapi"><failure message="Property &quot;payloa&quot; is not expected to be here"><![CDATA[line 94, col 16, Property "payloa" is not expected to be here (asyncapi-document-resolved) at path #/channels/site-events/messages/GatewayConnectionMqttDisconnected/payloa]]></failure></testcase>
</testsuite>
</testsuites>

Expected behavior

It would be nice to separate command logs from actual output.
Those options could work:

  • Add an optional outputFile parameter
  • Add an optional silent parameter
@cykl cykl added the bug Something isn't working label Jan 29, 2024
Copy link
Contributor

Welcome to AsyncAPI. Thanks a lot for reporting your first issue. Please check out our contributors guide and the instructions about a basic recommended setup useful for opening a pull request.
Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue.

@Shurtu-gal
Copy link
Collaborator

Regarding silent parameter the current validate command already has a boolean flag log-diagnostics. The output file is a valid addition. Thanks for giving this idea 🤗

Copy link
Contributor

github-actions bot commented Sep 6, 2024

This issue has been automatically marked as stale because it has not had recent activity 😴

It will be closed in 120 days if no further activity occurs. To unstale this issue, add a comment with a detailed explanation.

There can be many reasons why some specific issue has no activity. The most probable cause is lack of time, not lack of interest. AsyncAPI Initiative is a Linux Foundation project not owned by a single for-profit company. It is a community-driven initiative ruled under open governance model.

Let us figure out together how to push this issue forward. Connect with us through one of many communication channels we established here.

Thank you for your patience ❤️

@github-actions github-actions bot added the stale label Sep 6, 2024
@Amzani Amzani added the good first issue Good for newcomers label Sep 11, 2024
@Amzani
Copy link
Collaborator

Amzani commented Sep 11, 2024

still relevant

@github-actions github-actions bot removed the stale label Sep 12, 2024
@dhruvilmehta
Copy link

Currently, it's printing the XML in the command line. XML file should contain the following that is printed in the terminal right? It should only contain pure XML and not the diagnostics logs, right?
image

@Shurtu-gal
Copy link
Collaborator

Yeah, output-file param will become more and more necessary as we do more UI/UX improvements.
WDYT @Amzani ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
Status: To Triage
Development

No branches or pull requests

4 participants