【问题标题】:how to automatically generate schema for django graphql如何为 django graphql 自动生成模式
【发布时间】:2021-01-08 02:55:16
【问题描述】:

我正在做这个项目:https://github.com/mirumee/saleor 这个项目使用graphql,我想知道如何在这个文件夹中生成模式:https://github.com/mirumee/saleor/tree/master/saleor/graphql 有没有办法自动生成模式?谢谢

【问题讨论】:

    标签: django graphql


    【解决方案1】:

    使用graphql_schema管理命令作为

    python manage.py graphql_schema --schema tutorial.quickstart.schema --out <b>schema.graphql</b>

    请注意,--out 文件必须具有扩展名 .graphql 才能生成 GraphQL SDL 表示。

    【讨论】:

    • 这只会生成 schema.graphql,对吧? github.com/mirumee/saleor/tree/master/saleor/graphql中的所有文件夹和文件怎么样?这些文件夹和文件是自动生成的吗?
    • 不,这些文件是维护者手写的。
    • 那么,生成schema.graphql的目的是什么?
    • 如果需要,您可以在 TypeScript 中使用它
    • 但这不是我的问题。生成 schema.graphql 的目的是什么?代码中哪里使用了 schema.graphql?
    猜你喜欢
    • 2020-12-05
    • 2023-03-25
    • 2017-06-24
    • 2018-03-30
    • 2020-05-07
    • 2018-12-05
    • 2020-11-13
    • 2019-09-08
    • 2015-06-26
    相关资源
    最近更新 更多