Let $Y$ be a noetherian scheme and $y \in Y$. We denote by $\hat{O}_{Y,y}$ the completion of the local ring $O_{Y,y}$. I want to define a morphism $$ \operatorname{Spec} \hat{O}_{Y,y} \to Y $$ which sends the closed point $\hat{m}_y$ to $y$ and the map of the stalks is the canonical injection $O_{Y,y} \hookrightarrow \hat{O}_{Y,y}$.
How do I define this morphism? Thank you!
By taking affine neighbourhood of $y$, we may assume $Y=\operatorname{Spec}B$, and define it as $B\to O_{Y,y}\to\hat{O}_{Y,y}$ where the first map is localization $O_{Y,y}=B_{m_y}$ and the second map is the completion.