-
Notifications
You must be signed in to change notification settings - Fork 38
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(rest)!: update to AFJ 0.2.0 #148
feat(rest)!: update to AFJ 0.2.0 #148
Conversation
5c10bff
to
ea65472
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not any major notes.
I think something that we can improve upon, in a follow-up would PR would be to generalize the error handling of an apicall.
Recordnotfound will always return 404, if we don't know we return 500, etc.
It could be as simlpe as:
handleHttpErrors(() => {
return {status: 200}
})
const handleHttpErrors = (cb: (...args: any[]) => void | Promise<void>) => {
try {
cb()
} catch(e) {
if(e instanceof RecordNotFoundError) {
return {status: 404, message: "Record not found"}
}
}
}
packages/rest/src/controllers/credentials/CredentialController.ts
Outdated
Show resolved
Hide resolved
credential.offerMessage.toJSON({ useLegacyDidSovPrefix: this.agent.config.useLegacyDidSovPrefix }) | ||
)}`, | ||
credentialRecord: credential.credentialRecord, | ||
try { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not an important comment, but it would be nice if we could handle the internalservererror(500, ...) wihtout specifying it like this all the time. Will think about this.
packages/rest/src/controllers/credentials/CredentialController.ts
Outdated
Show resolved
Hide resolved
`credential definition with credentialDefinitionId "${credentialDefinitionId}" not found.` | ||
) | ||
if (error instanceof IndySdkError && error.message === 'IndyError(LedgerNotFound): LedgerNotFound') { | ||
return notFoundError(404, { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason why we explicitly pass 404 to NotFound
? Shouldn't that be handled by the function as 404 == not-found?
@@ -0,0 +1,186 @@ | |||
import type { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should look into generating this... even if it will be
{
"did": "string",
"isDid": "boolean"
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you mean? Generating examples instead of defining them ourselves?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, and even the generating it like this would be fine. However, we shouldn't over engineer it :).
ea65472
to
65c94c6
Compare
77bad7b
to
3b8b3af
Compare
I looked into a cleaner way to handle the errors with a |
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Signed-off-by: Jan <60812202+janrtvld@users.noreply.github.com>
Signed-off-by: Jan <60812202+janrtvld@users.noreply.github.com>
…undation#100) Signed-off-by: Jan <60812202+janrtvld@users.noreply.github.com>
Signed-off-by: Timo Glastra <timo@animo.id> Signed-off-by: Jan <60812202+janrtvld@users.noreply.github.com>
…#103) Signed-off-by: Jan <60812202+janrtvld@users.noreply.github.com>
Signed-off-by: Jan <60812202+janrtvld@users.noreply.github.com>
Signed-off-by: Timo Glastra <timo@animo.id> Signed-off-by: Jan <60812202+janrtvld@users.noreply.github.com>
Signed-off-by: Timo Glastra <timo@animo.id> Signed-off-by: Jan <60812202+janrtvld@users.noreply.github.com>
Signed-off-by: Timo Glastra <timo@animo.id> Signed-off-by: Jan <60812202+janrtvld@users.noreply.github.com>
…#106) Signed-off-by: Jan <60812202+janrtvld@users.noreply.github.com>
…foundation#112) Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Signed-off-by: Jan <60812202+janrtvld@users.noreply.github.com>
…llet-foundation#109) Signed-off-by: Jan <60812202+janrtvld@users.noreply.github.com>
…n#110) Signed-off-by: Jan <60812202+janrtvld@users.noreply.github.com>
Signed-off-by: Berend Sliedrecht <berend@animo.id> BREAKING CHANGE: PushNotificationsModule does not exist anymore. You now have to use one that is specific to your service, e.g. PushNotificationsApnsModule or PushNotificationsFcmModule Signed-off-by: Jan <60812202+janrtvld@users.noreply.github.com>
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Signed-off-by: Jan <60812202+janrtvld@users.noreply.github.com>
…#117) Signed-off-by: Jan <60812202+janrtvld@users.noreply.github.com>
…ation#113) Signed-off-by: Łukasz Przytuła <lprzytula@gmail.com> BREAKING CHANGE: `useConnectionByState` now needs a `DidExchangeState` state value instead of a `ConnectionState` state value. Signed-off-by: Jan <60812202+janrtvld@users.noreply.github.com>
Some feedback from my side:
Also, @janrtvld Maybe we can merge this PR into a separate branch and start making incremental PRs? |
Signed-off-by: Jan <60812202+janrtvld@users.noreply.github.com>
Signed-off-by: Jan <60812202+janrtvld@users.noreply.github.com>
Signed-off-by: Jan <60812202+janrtvld@users.noreply.github.com>
Signed-off-by: Jan <60812202+janrtvld@users.noreply.github.com>
I have changed the credentials Api to use the credentialRecord Id in the endpoint. I have also excluded the if there isn't anything else i think we can merge this. If we want to add more i'm fine working on a separate branch. |
Great! I think there were also messages that you can pass to the oob apis. Have you tested whether that works? |
It seems the create-offer method is missing in the API. But we can add that in a separate PR Have opened issue for create-invitation: #156 |
Some other parameters to remove:
|
Codecov Report
@@ Coverage Diff @@
## main #148 +/- ##
==========================================
- Coverage 87.07% 86.24% -0.84%
==========================================
Files 45 21 -24
Lines 681 1163 +482
Branches 92 260 +168
==========================================
+ Hits 593 1003 +410
- Misses 76 146 +70
- Partials 12 14 +2
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
Signed-off-by: Jan <60812202+janrtvld@users.noreply.github.com>
dd542bf
to
f26f848
Compare
Signed-off-by: Jan <60812202+janrtvld@users.noreply.github.com>
Ready to merge 👀 ??? |
I think the switch to tsoa has improved the OpenAPI spec quite a lot. However, there are a few drawbacks (mainly related to the issues lukeautry/tsoa#1268, lukeautry/tsoa#1267 & lukeautry/tsoa#1266).
I think it is fine for now, but if there are better alternatives i'd be happy to change it. It isn't that much work if we don't combine it with a major AFJ release :).