Should JSON RESTful web services use data contract

后端 未结 3 1464
北恋
北恋 2020-12-21 10:45

This is actually a design question. I\'m wondering if Spring3.0 REST web services that carries JSON payload provide some kind of data contract similar to traditional web ser

3条回答
  •  天命终不由人
    2020-12-21 11:16

    JSON Schema and Hyper-Schema are JSON Schema formats for specifying content and content negotiation.

    I have been working on a HATEOAS (Hypermedia as the engine of application state) API, using JSON Hyper Schema. You can go to the URL below, browse around, register, login and do some actions.

    Check it out, here: http://direct.psprt.com:8081/

    I also open sourced my actual API code thus far: http://bpanahij.github.io/passportedu_schema/

    Feel free to take a look, borrow, and comment.

    Also, check out the Javascript JSON-Hyper-Schema client. It dynamically builds an HTML client app using Angular, by parsing the Schema provided at a given resources endpoint with the OPTIONS method.

    https://github.com/bpanahij/passportedu_schema/tree/master/client

提交回复
热议问题