fun generate()

in graphql-dgs-codegen-core/src/main/kotlin/com/netflix/graphql/dgs/codegen/generators/kotlin/KotlinDataTypeGenerator.kt [105:152]


    fun generate(
        definition: InputObjectTypeDefinition,
        extensions: List<InputObjectTypeExtensionDefinition>,
        inputTypeDefinitions: Collection<InputObjectTypeDefinition>,
    ): CodeGenResult {
        if (definition.shouldSkip(config)) {
            return CodeGenResult.EMPTY
        }

        logger.info("Generating input type {}", definition.name)

        val fields =
            definition.inputValueDefinitions
                .filter(ReservedKeywordFilter.filterInvalidNames)
                .map {
                    val defaultValue =
                        it.defaultValue?.let { value ->
                            generateKotlinCode(
                                value,
                                typeUtils.findReturnType(it.type),
                                inputTypeDefinitions,
                                config,
                                typeUtils,
                            )
                        }
                    Field(
                        name = it.name,
                        type = typeUtils.findReturnType(it.type),
                        nullable = it.type !is NonNullType,
                        default = defaultValue,
                        description = it.description,
                        directives = it.directives,
                    )
                }.plus(
                    extensions.flatMap { it.inputValueDefinitions }.map {
                        Field(
                            name = it.name,
                            type = typeUtils.findReturnType(it.type),
                            nullable = it.type !is NonNullType,
                            default = null,
                            description = it.description,
                            directives = it.directives,
                        )
                    },
                )
        val interfaces = emptyList<Type<*>>()
        return generate(definition.name, fields, interfaces, document, definition.description, definition.directives)
    }