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(common): add express http verb method name string literal type #2754

Conversation

petermetz
Copy link
Contributor

  1. Also ships with a user-defined typescript type-guard so that we can
    ensure at runtime that the string literal value is indeed one of the
    valid ExpressJS HTTP verb method names.
  2. The primary use-case for this is checking at runtime the HTTP verb
    name of OpenAPI specifications that are being loaded into the API.

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:28
@petermetz petermetz force-pushed the feat-common-express-http-verb-method-name branch from 2b2457d to 8380945 Compare October 9, 2023 17:28
petermetz added a commit to petermetz/cacti that referenced this pull request Oct 9, 2023
…ervices()

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 added a commit to petermetz/cacti that referenced this pull request Oct 9, 2023
… 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]>
1. Also ships with a user-defined typescript type-guard so that we can
ensure at runtime that the string literal value is indeed one of the
valid ExpressJS HTTP verb method names.
2. The primary use-case for this is checking at runtime the HTTP verb
name of OpenAPI specifications that are being loaded into the API.

[skip ci]

Signed-off-by: Peter Somogyvari <[email protected]>
@petermetz petermetz force-pushed the feat-common-express-http-verb-method-name branch from 8380945 to e5f62f1 Compare October 16, 2023 17:54
@petermetz petermetz merged commit 8f048ea into hyperledger-cacti:main Oct 16, 2023
4 checks passed
@petermetz petermetz deleted the feat-common-express-http-verb-method-name branch October 16, 2023 18:02
petermetz added a commit to petermetz/cacti that referenced this pull request Oct 17, 2023
… 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 added a commit to petermetz/cacti that referenced this pull request Oct 18, 2023
… 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 added a commit that referenced this pull request Oct 18, 2023
… from OAS

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]>
sandeepnRES pushed a commit to sandeepnRES/cacti that referenced this pull request Dec 21, 2023
… 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]>
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