I have seen some people suggesting creating an endpoint called /schemas/
Most of the validation schemes out there are public, hence, have a route. So yes, you need to make it public. It doesn't mean it should be accessible to everyone. You could secure the document for only clients of yours.
Now, the route doesn't have to be part of the API. For simplicity, the document is usually served as a whole from a single endpoint which can be published from a Web server or CDN as static content. Bear in mind that schemes are versioned too. I find one route per schema and version too complex to manage. A single versioned descriptor, including all models, makes for a more comprehensive document.
Now, bear in mind the following.
The scheme is usually cached, so clients download it from time to time. As you may guess, this increases complexity since we must find a way to invalidate the cache (on the client side) every time we release new schema versions.
A second vector of complexity comes from segmentation.
- The json schema model version itself
- Your data model version
- The client/agent version (browser version, OS-SDKs, etc.)
You have to find libraries compatible with #1 and #3 so that it allows you to implement #2 to meet your multi-platform requirements and expectations.
You have alternatives tho.
In my opinion, the real issue is at implementing the API client several times and maintaining each API client as part of the app. Repeating validation logic is only a symptom of the previous.
The alternative could be a multi-platform API client (say, implemented in Kotlin) so the API client (logic, validations, etc) is programmed only once.