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: ftl call suggests verbs if no match found #1516

Merged
merged 12 commits into from
May 20, 2024
Merged

Conversation

mihai-chiorean
Copy link
Contributor

https://hackmd.io/@ftl/By2EEAXmR

~/D/pfi ❯❯❯ ftl call "idv.GetCustomerID"                                                                                                                                                                                                                                                                 ✘ 1 mihai/create_recipient_api ✭ ✱
ftl: error: verb not found, did you mean one of these: [idv.getCustomerId]

~/D/pfi ❯❯❯ ftl call "idv.getCustomerId" '{"did": "did:web:1234567"}'                                                                                                                                                                                                                                    ✘ 1 mihai/create_recipient_api ✭ ✱
{"customer":"customer_01hy1bf79pf71b4ff5kmfmnerp"}

@github-actions github-actions bot changed the title ftl call suggests verbs if no match found feat: ftl call suggests verbs if no match found May 16, 2024
Copy link
Collaborator

@alecthomas alecthomas left a comment

Choose a reason for hiding this comment

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

Great idea, just a few changes 🙇

backend/controller/controller.go Outdated Show resolved Hide resolved
cmd/ftl/cmd_call.go Outdated Show resolved Hide resolved
cmd/ftl/cmd_call.go Outdated Show resolved Hide resolved
cmd/ftl/cmd_call.go Outdated Show resolved Hide resolved
cmd/ftl/cmd_call.go Outdated Show resolved Hide resolved
cmd/ftl/cmd_call.go Outdated Show resolved Hide resolved
@mihai-chiorean mihai-chiorean force-pushed the mihai/ftl_cmd_suggest branch from bcdcc9c to 7d3333d Compare May 17, 2024 18:00
@mihai-chiorean mihai-chiorean marked this pull request as ready for review May 17, 2024 18:25
@mihai-chiorean mihai-chiorean requested review from a team and worstell and removed request for a team May 17, 2024 18:25
@worstell
Copy link
Contributor

awesome thank you @mihai-chiorean !!

Copy link
Collaborator

@alecthomas alecthomas left a comment

Choose a reason for hiding this comment

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

Nice one, the NotFound is great, thanks.

@@ -90,7 +93,8 @@ func (s *Schema) ResolveRefToType(ref *Ref, out Decl) error {
}
}
}
return fmt.Errorf("could not resolve reference %v", ref)

return errors.Join(ErrNotFound, fmt.Errorf("could not resolve reference %v", ref))
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is great, but can you add this to the other Resolve* methods, and add a comment to each, and the error, mentioning that this is returned when the reference cannot be found?

Copy link
Contributor Author

@mihai-chiorean mihai-chiorean May 17, 2024

Choose a reason for hiding this comment

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

ResolveRefMonomorphised is the only one that seems relevant because it calls this. I updated it.

cmd/ftl/cmd_call.go Outdated Show resolved Hide resolved
Copy link
Collaborator

@alecthomas alecthomas left a comment

Choose a reason for hiding this comment

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

Nice!

@alecthomas alecthomas merged commit f777c2b into main May 20, 2024
24 checks passed
@alecthomas alecthomas deleted the mihai/ftl_cmd_suggest branch May 20, 2024 22:57
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