微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

如何解决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 举报,一经查实,本站将立刻删除。