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

feat: cli should validate only yml, yaml and json extension files #799

Closed
AayushSaini101 opened this issue Sep 12, 2023 · 4 comments · Fixed by #807
Closed

feat: cli should validate only yml, yaml and json extension files #799

AayushSaini101 opened this issue Sep 12, 2023 · 4 comments · Fixed by #807
Labels
enhancement New feature or request

Comments

@AayushSaini101
Copy link
Contributor

Reason/Context

Please try answering a few of those questions

  • Why do we need this improvement?

According to the latest version of the CLI, it will generate only yml, yaml and JSON file extensions, but the validate is still validating the files of different extensions like exe etc

image
@AayushSaini101 AayushSaini101 added the enhancement New feature or request label Sep 12, 2023
@AyushNautiyalDeveloper
Copy link

hi I would like to work on this. @AayushSaini101 please assign this to me. and also project me to correct direction on where can i start to work on this.

@Souvikns
Copy link
Member

@AyushNautiyalDeveloper, @AayushSaini101 opened the issue and might be working on it so you need to ask him if you want to work on this issue.

That being said some points I would like to share about the problem

asyncapi.ymal.yaml as per the example shared in the issue is still a valid name for a .yaml file so, in theory, this behavior is expected.

This is the function that loads and parses the spec file,

const specFile = await load(filePath);

If you read the function you will notice that CLI loads the spec from three different ways, from

  • filesystem
  • URL
  • Context

This is how we are reading the file from the filesystem, we don't really check what format of the file is as long as it is valid YAML or JSON.

static async fromFile(filepath: string) {

Since we already have a check for file formats while running the new command makes sense to have it for validation as well. Also, I think we can create a new Error Type called Invalid AsyncAPI file type(Error name up for debate) since we have more than one scenario for the same error.

@AyushNautiyalDeveloper
Copy link

hi @AayushSaini101 can I work on this task or it is already worked on? please let me know.

@AayushSaini101
Copy link
Contributor Author

@AyushNautiyalDeveloper Please take this issue #800

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants