In algebraic number theory, one constructs for each number field $K$ a subring $\mathcal{O}_K$, the integral closure of $\mathbb{Z}$ inside $K$, which carries many of the properties which make $\mathbb{Z}$ a nice ring- it is a Dedekind Domain.
Hence, for a number field $K$, we have assigned an integral $\mathcal{O}_K$-algebra to each finite étale $K$-algebra. I am looking to see if there is some categorical formality behind this construction. More precisely, given a number ring $K$, what formal operation are we doing to the category of finite étale-$K$-algebras so as to pass to the category of $\mathcal{O}_K$-algebras?
By the way, one way of describing this assignment of $\mathcal{O}_L$, with $\mathcal{O}_K \subset K$ given, is to stipulate that (i) $\phi (\mathcal{O}_L ) = \mathcal{O}_L$ for each $K$-algebra map $\phi : L \rightarrow L$, (ii) $\mathcal{O}_L \cap K = \mathcal{O}_K$, and (iii) $\mathcal{O}_L$ is maximal as such. This is enough to show that $\mathcal{O}_L$ is the ring of integers of $L$ when $L$ is Galois over $K$. A modification gives a similar result for non Galois extensions. This may give some kind of hint.