2
6 Comments

Looking to convert a rest app to graphql for dynamic schema handling.Anyone having experience in this sort of use case?

Any contributions are welcome

on January 1, 2020
  1. 1

    Could you explicit a bit more the problem you're trying to solve (the dynamic schema handling)? Thanks :)
    GraphQL is definitely more static (schema + typing is static even if you can build more abstract things using interfaces and fragments) than a json api.

    1. 1

      @FabienHerfray I realize now that dynamic schema building is not a possibility in graphql. I wanted the schema to be automatically updated based on the response received from the backend services.

  2. 1

    @robby The data source service response returns json data over http endpoints alread.I need to know how the schema management can be dynamic. I am currently having huge Pojo objects can graphql solve this problem?

    1. 1

      Nope, that is not the problem where graphql shines. JSON itself is schemaless, so you have to handle "dynamic schema" in your storage layer most of the time in these situations. GraphQL comes handy for example if you want to provide a) arbitrary query capabilities to you clients b) you have to collect data from many different data sources and present them (usually with transformation) if they would come from a single source

      1. 1

        That is a great answer. Thank you. For b) collecting the data(in json) from various datasources and presenting the datasources as they would appear to be coming from a single source, a union is needed, maybe with new methods or mutations.
        I believe the schema to be intelligent to be constructed on the fly is not a possibility is that right?

  3. 1

    Using JSON over HTTP (REST-ish) it’s possible for the client to request what data it needs. The JIRA API works that way and it needs to support user generated fields.

    I’m not saying don’t use GraphQL but it’s not the only way to handle arbitrary dynamic schemas.

    Good luck!