Spring Data Rest : How to expose a json schema from a repository (2.0.0.M1)

流过昼夜 提交于 2019-12-01 03:39:17

问题


I saw in the source code that Spring DATA Rest can expose a Json Schema for a repository with this URL : /{repository}/schema.

Is there anybody who know how to configure this ?

There is the RepositorySchemaController (org.springframework.data.rest.webmvc) but i have not found how to use it.

version : 2.0.0.M1


回答1:


Make sure you set the right headers...

Request -  /{repository}/schema
Header - Accept: application/json+schema

Also if you haven't looked into 2.0 snapshots, there are lot more features and changes coming up

EDIT: Jan 27 2014

Correction: Accept should be "application/schema+json" instead of "application/json+schema"

Request -  /{repository}/schema
Header - Accept: application/schema+json



回答2:


Just an update for version 2.4.0 of Spring Data REST:

JSONSchema is now exposed under the profile link, so you need to change your request as follows:

Request:  /profile/{repository}
Header:   Accept: application/schema+json

You can find the updated documentation here.



来源:https://stackoverflow.com/questions/21169937/spring-data-rest-how-to-expose-a-json-schema-from-a-repository-2-0-0-m1

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!