IBM/openapi-to-graphql

Should OASGraph support GraphQL code-generation?

Aperta

#16 aperta il 6 set 2018

 (13 commenti) (0 reazioni) (0 assegnatari)TypeScript (215 fork)github user discovery
enhancementhelp wanted

Metriche repository

Star
 (1645 stelle)
Metriche merge PR
 (Nessuna PR mergiata in 30 g)

Descrizione

Currently, OASGraph builds up a GraphQL schema including corresponding resolve functions in memory. I think this approach is great for immediately serving the GraphQL interface.

However, having the GraphQL schema in-memory only also has drawbacks:

  • In some settings, the GraphQL schema needs to be re-generated repeatedly. For example, in serverless, it needs to be re-generated for every invocation, which adds around 100 ms for a relatively small OAS.
  • Generated schemas can mostly be used as-is. However, OASGraph may also be considered a starting point for developers to create a GraphQL interface, which they can then extend and maintain.

In consequence, it may be desirable for a library like OASGraph or thereupon-based tools to output source code instead.

One question is whether this would require a dedicated, separate effort, or can be integrated with a library like OASGraph? On the one hand, generating code requires different capabilities from those supported by OASGraph, including templating and writing to file. On the other hand, capabilities present in OASGraph may be re-usable, for example the schema already produced by OASGraph could simply be stringified, or sanitation mappings could be reused.

Guida contributor