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

add express open api validator to vc-api #115

Closed
arpentnoir opened this issue Jun 27, 2023 · 0 comments
Closed

add express open api validator to vc-api #115

arpentnoir opened this issue Jun 27, 2023 · 0 comments
Assignees

Comments

@arpentnoir
Copy link
Contributor

validation on vc-api at the moment is a hand rolled middleware. this isn't very maintainable if there are changes to the spec. but in general it would be better to have validation driven from the spec itself.

https://github.com/cdimascio/express-openapi-validator

this task is to change request / response validation on the vc-api to use express-openapi-validator so that validation is performed against the spec as written.

namhoang1604 added a commit that referenced this issue Jul 6, 2023
<!--
  For Work In Progress Pull Requests, please use the Draft PR feature,
see https://github.blog/2019-02-14-introducing-draft-pull-requests/ for
further details.
  
  For a timely review/response, please avoid force-pushing additional
  commits if your PR already received reviews or comments.
  
Before submitting a Pull Request, please ensure you've done the
following:
- 📖 Read the [Contributing
Guide](https://github.com/uncefact/project-vckit/blob/main/CONTRIBUTING.md).
- 📖 Read the [Code of
Conduct](https://github.com/uncefact/project-vckit/blob/main/CODE_OF_CONDUCT.md).
  - 👷‍♀️ Create small PRs. In most cases, this will be possible.
  - ✅ Provide tests for your changes.
- 📝 Use descriptive commit messages following [conventional
commits](https://www.conventionalcommits.org/en/v1.0.0/).
- 📗 Update any related documentation and include any relevant
screenshots.
-->

## What type of PR is this? (check all applicable)

- [x] 🍕 Feature
- [ ] 🐛 Bug Fix
- [x] 📝 Documentation Update
- [ ] 🎨 Style
- [ ] 🧑‍💻 Code Refactor
- [ ] 🔥 Performance Improvements
- [x] ✅ Test
- [ ] 🤖 Build
- [ ] 🔁 CI
- [ ] 📦 Chore (Release)
- [ ] ⏩ Revert

## Description

<!-- 
Please do not leave this blank 
This PR [adds/removes/fixes/replaces] the [feature/bug/etc]. 
-->
- Implement the vc-api for the holder and verifier.
- Implement the open api validator for the vc api router

```yaml
# API base path
- - $require: '@vckit/vc-api?t=function#HolderRouter'
- - $require: '@vckit/vc-api?t=function#IssuerRouter'
    $args:
      - createCredential: createVerifiableCredential
        updateCredentialStatus: updateVerifiableCredentialStatus
- - $require: '@vckit/vc-api?t=function#VerifierRouter'
    $args:
      - verifyCredential: verifyCredential
        verifyPresentation: verifyPresentation

# VC API docs path
- - /vc-api.json
  - $require: '@vckit/vc-api?t=function#VCApiSchemaRouter'
    $args:
      - basePath: :3332

- - /vc-api-docs
  - $require: '@vckit/vc-api?t=function#VCApiDocsRouter'
```

## Related Tickets & Documents
<!-- 
Please use this format link issue numbers: Fixes #123

https://docs.github.com/en/free-pro-team@latest/github/managing-your-work-on-github/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword
-->
#100
#92
#115

## Mobile & Desktop Screenshots/Recordings

<!-- Visual changes require screenshots -->

<img width="1510" alt="image"
src="https://github.com/uncefact/project-vckit/assets/13606809/5168be6a-ae27-4b6c-b4d4-7b51d8175d27">

<img width="536" alt="image"
src="https://github.com/uncefact/project-vckit/assets/13606809/1a1d08e8-fc02-48f5-aced-1ec56a2c24b5">

<img width="426" alt="image"
src="https://github.com/uncefact/project-vckit/assets/13606809/181eac6d-0998-4f31-9686-d855c2c6e626">





## Added tests?

- [x] 👍 yes
- [ ] 🙅 no, because they aren't needed
- [ ] 🙋 no, because I need help

## Added to documentation?

- [x] 📜 README.md
- [ ] 📓 [vc-kit doc site](https://uncefact.github.io/vckit/)
- [ ] 📕 storybook
- [ ] 🙅 no documentation needed

## [optional] Are there any post-deployment tasks we need to perform?


<!-- note: PRs with deleted sections will be marked invalid -->

---------

Signed-off-by: Nam Hoang <hoangxuannam160493@gmail.com>
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

No branches or pull requests

3 participants