IBM/openapi-to-graphql

Should OASGraph support GraphQL code-generation?

开放

#16 创建于 2018年9月6日

 (13 条评论) (0 个反应) (0 位负责人)TypeScript (215 个派生)github user discovery
enhancementhelp wanted

仓库指标

星标
 (1,645 个星标)
PR 合并指标
 (30 天内没有已合并 PR)

描述

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.

贡献者指南