Skip to content

Add linter for scenario files#1642

Merged
koesie10 merged 1 commit intomainfrom
koesie10/validate-mocks
Oct 24, 2022
Merged

Add linter for scenario files#1642
koesie10 merged 1 commit intomainfrom
koesie10/validate-mocks

Conversation

@koesie10
Copy link
Copy Markdown
Member

This adds a linter for JSON scenario files which will validate the JSON files in the scenarios directory against the TypeScript types. It will convert the TypeScript types to JSON schema to simplify this process.

Unfortunately, this will not currently allow adding scenarios with failing requests since the types do not allow this. Rather than removing this validation, we should fix the types. This can be done in a follow-up PR.

Checklist

  • CHANGELOG.md has been updated to incorporate all user visible changes made by this pull request.
  • Issues have been created for any UI or other user-facing changes made by this pull request.
  • [Maintainers only] If this pull request makes user-facing changes that require documentation changes, open a corresponding docs pull request in the github/codeql repo and add the ready-for-doc-review label there.

This adds a linter for JSON scenario files which will validate the JSON
files in the scenarios directory against the TypeScript types. It will
convert the TypeScript types to JSON schema to simplify this process.

Unfortunately, this will not currently allow adding scenarios with
failing requests since the types do not allow this. Rather than removing
this validation, we should fix the types. This can be done in a follow-up
PR.
@koesie10 koesie10 requested review from a team and charisk October 21, 2022 14:42
@koesie10 koesie10 requested a review from a team as a code owner October 21, 2022 14:42
Copy link
Copy Markdown
Contributor

@charisk charisk left a comment

Choose a reason for hiding this comment

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

Looks great!

Shall we add something in CONTRIBUTING to explain a bit more what scenarios are etc?

Comment thread extensions/ql-vscode/scripts/lint-scenarios.ts
@koesie10
Copy link
Copy Markdown
Member Author

Shall we add something in CONTRIBUTING to explain a bit more what scenarios are etc?

I assumed that would be part of the documentation issue, which would also explain how to record and load scenarios, etc.

@charisk
Copy link
Copy Markdown
Contributor

charisk commented Oct 24, 2022

Shall we add something in CONTRIBUTING to explain a bit more what scenarios are etc?

I assumed that would be part of the documentation issue, which would also explain how to record and load scenarios, etc.

I may have forgotten I created that on Friday 😂

@koesie10 koesie10 merged commit c325a72 into main Oct 24, 2022
@koesie10 koesie10 deleted the koesie10/validate-mocks branch October 24, 2022 08:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants