-
Notifications
You must be signed in to change notification settings - Fork 19
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
es/v2: Port /implementing-services
#215
base: es/v2
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
docs/node/implementing-services.md
Outdated
|
||
export const eliza: ServiceImpl<typeof ElizaService> = { | ||
// ... | ||
}; | ||
|
||
export class Eliza implements ServiceImpl<typeof ElizaService> { | ||
async say(req: SayRequest) { | ||
export class Eliza implements Partial<ServiceImpl<typeof ElizaService>> { |
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.
I used Partial
here to avoid the not implemented error, if the user decides to copy the code as is.
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.
This page builds on the previous page "Getting started", where we're defining the service with just this RPC. It's fine to not use Partial
here.
docs/node/implementing-services.md
Outdated
|
||
export default (router: ConnectRouter) => | ||
router.service(ElizaService, { | ||
async say(req: SayRequest, context: HandlerContext) { | ||
return new SayResponse({ | ||
return create(SayResponseSchema, { |
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.
With the added type safety of the message init types should we just recommend using the init version?
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.
Yes, I think we should return the init object here - we do it in pretty much every example and also in clients.
Signed-off-by: Sri Krishna Paritala <skrishna@buf.build>
40a3a78
to
2d2571f
Compare
Signed-off-by: Sri Krishna Paritala <skrishna@buf.build>
Port
/implementing-services
section to v2.