Are there any adapters which are converting JSON Schema schemas (e.g from Swagger) to GraphQL schemas? There is even an official article about wrapping around REST http://graphql.org/blog/rest-api-graphql-wrapper/, but usually REST already described and Swagger is the most popular format for it. Wouldn't like to write it by my own if there is already existing implementation.
I actually put some time into trying this out a few months ago. You can read the my post detailing the results here: https://medium.com/apollo-stack/will-graphql-replace-rest-documentation-f1a55092ef9d#.m50im46o0
After looking at a lot of the Swagger schemas available online, I think that Swagger or similar API description languages can be a good starting point for defining a GraphQL schema, but they often don't contain enough information to generate a schema on their own. Specifically, there is usually not enough data about relationships between objects.
If you want to start from a JSON-formatted schema description, all you need to do is write some code that loops over your different data types in Swagger, and generate GraphQLObjectType
objects. You can see a simple approach to this in the example repository for the blog post I linked above: https://github.com/apollostack/swapi-rest-graphql/blob/951e50ec29732c93e7aa0bc6880210fdd1816a2f/schema.js#L28
Basically, you are just converting one format of data into another, and then you need to add some relationships between the data (foreign keys, IDs, and such), and add some root queries to create an entry point. In the case of a REST API, it often makes sense to have your single and multiple resource endpoints act as your root query fields.