Генерация ID в mutation GraphQL

Имеется вот такой код в схеме

input CreateElementInput{
    name: String!
    description: String!
    data: String!
    type_: String!
    id: ID
}

и вот такой код в самой программе

@mutation.field("create_element")
def resolve_add_element_to_type(*_, input):
    new_element = TextElement(input['name'], input['id'], input['description'], input['data'])
....

Вот так выглядит запрос

mutation{
    create_element(input:{
        name:"name1",
        data:"True",
        description: "None",
        type_:"Text",
     }){

    id
    name
    data
    description
    type_
    }
}

в самом классе Text Element есть поле id, можно ли как-то сделать, чтобы поле Id самостоятельно генерировалось с типом GraphQL ID? во время создания элемента?


Ответы (0 шт):