graphql api不将代码视为石墨烯中的字符串

问题描述

我需要将一些代码嵌入到我的应用程序中,这就是为什么我需要进行更改,但是当我将代码元素放在双引号内时,它会引发错误,因为它没有将代码视为字符串。当我将普通文本放在引号中时,它确实显示没有问题,但是当我将代码放入字符串中时,它确实如此.. 有什么方法可以使系统不在引号内进行验证

enter image description here

我把代码放在双引号中

python 代码

class Forum_Answer_Mutation(graphene.Mutation):

class Arguments:
    forum = graphene.Int()
    author = graphene.String()
    body = graphene.String()
    code1_title = graphene.String()
    code1 = graphene.String()
    code2_title = graphene.String()
    code2= graphene.String()
    code3_title = graphene.String()
    code3 = graphene.String()

answer = graphene.Field(Forum_Answer_Type)

@classmethod
def mutate(cls,root,info,forum,author,body,code1,code2,code3,code3_title,code1_title,code2_title):
    
    answer = Answer(forum_answer_post=forum,forum_answer_author=author,forum_answer_body=body,forum_answer_code1_title=code1_title,forum_answer_code2_title=code2_title,forum_answer_code3_title=code3_title,forum_answer_code1=code1,forum_answer_code2=code2,forum_answer_code3=code3)
    answer.save()
    return Forum_Answer_Mutation(answer=answer)

我只需要让系统忽略双引号内的验证..希望它有帮助

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)