Skip to content

Unnecessary depreciation warning calling init on ApolloCodegenConfiguration.OutputOptions #3563

@CraigSiemens

Description

@CraigSiemens

Summary

After updating from 1.17.0 to 1.22.0, our codegen script started getting a depreciation warning when calling the init for ApolloCodegenConfiguration.OutputOptions.

It appears to happing because all the parameters have a default value and we're only passing a subset thats common between the current and deprecated inits. The compiler seems to be defaulting to the deprecated init and giving the warning.

This could be a case where the deprecated inits should be marked @_disfavoredOverload so the compiler will try to use the current init first.

Version

1.22.0

Steps to reproduce the behavior

We're calling the init with the following parameters.

.init(
    deprecatedEnumCases: .exclude,
    operationDocumentFormat: [.definition, .operationId],
    pruneGeneratedFiles: false,
    markOperationDefinitionsAsFinal: true
)

Changing the init to have a parameter that's unique to the new init removes the warning.

.init(
    deprecatedEnumCases: .exclude,
    operationDocumentFormat: [.definition, .operationId],
    reduceGeneratedSchemaTypes: false,
    pruneGeneratedFiles: false,
    markOperationDefinitionsAsFinal: true
)

Logs

app/Sources/ApolloCommand/Apollo+Codegen.swift:66:27 'init(additionalInflectionRules:deprecatedEnumCases:schemaDocumentation:selectionSetInitializers:operationDocumentFormat:schemaCustomization:cocoapodsCompatibleImportStatements:warningsOnDeprecatedUsage:conversionStrategies:pruneGeneratedFiles:markOperationDefinitionsAsFinal:appendSchemaTypeFilenameSuffix:)' is deprecated: replaced by 'init(additionalInflectionRules:queryStringLiteralFormat:deprecatedEnumCases:schemaDocumentation:selectionSetInitializers:operationDocumentFormat:schemaCustomization:reduceGeneratedSchemaTypes:cocoapodsCompatibleImportStatements:warningsOnDeprecatedUsage:conversionStrategies:pruneGeneratedFiles:markOperationDefinitionsAsFinal:appendSchemaTypeFilenameSuffix:)'

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions