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

fix(cmd-api-server): add runtime type validation to HTTP verbs pulled from OAS #2755

Conversation

petermetz
Copy link
Contributor

This addresses the shortcomings of the linter fix provided in #2751, which
uses unchecked casts to the linter warnings go away.
With the fix of #2751, at runtime, the possibility of a crash is still there
exactly as before, but it has silenced the linter about calling that
possibility out.

We now use a type guard to check the type of the object before casting it
and therefore ensure that at runtime the cast will not produce a crash.

[skip ci]

Depends on #2751
Depends on #2754

Signed-off-by: Peter Somogyvari [email protected]

Pull Request Requirements
[x] Rebased onto upstream/main branch and squashed into single commit to help maintainers review it more efficient and to avoid spaghetti git commit graphs that obfuscate which commit did exactly what change, when and, why.
[x] Have git sign off at the end of commit message to avoid being marked red. You can add -s flag when using git commit command. You may refer to this link for more information.
[x] Follow the Commit Linting specification. You may refer to this link for more information.

Character Limit
[x] Pull Request Title and Commit Subject must not exceed 72 characters (including spaces and special characters).
[x] Commit Message per line must not exceed 80 characters (including spaces and special characters).

A Must Read for Beginners
For rebasing and squashing, here's a must read guide for beginners.

@petermetz petermetz enabled auto-merge (rebase) October 9, 2023 17:59
@petermetz petermetz force-pushed the style-cmd-api-server-pr-2751-touch-up branch from 799eafb to c5d07f1 Compare October 9, 2023 17:59
@petermetz petermetz force-pushed the style-cmd-api-server-pr-2751-touch-up branch from c5d07f1 to 6869c9e Compare October 17, 2023 18:59
Copy link
Contributor

@izuru0 izuru0 left a comment

Choose a reason for hiding this comment

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

LGTM

… from OAS

This addresses the shortcomings of the linter fix provided in hyperledger-cacti#2751, which
uses unchecked casts to the linter warnings go away.
With the fix of hyperledger-cacti#2751, at runtime, the possibility of a crash is still there
exactly as before, but it has silenced the linter about calling that
possibility out.

We now use a type guard to check the type of the object before casting it
and therefore ensure that at runtime the cast will not produce a crash.

[skip ci]

Depends on hyperledger-cacti#2751
Depends on hyperledger-cacti#2754

Signed-off-by: Peter Somogyvari <[email protected]>
@petermetz petermetz force-pushed the style-cmd-api-server-pr-2751-touch-up branch from 6869c9e to 0106555 Compare October 18, 2023 04:48
@petermetz petermetz merged commit b0ff599 into hyperledger-cacti:main Oct 18, 2023
@petermetz petermetz deleted the style-cmd-api-server-pr-2751-touch-up branch October 18, 2023 04:48
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.

3 participants