Skip to content

Unused import of Foundation.URL when OpenAPI spec does not contain a server URL #923

Description

@ahoppen

If the OpenAPI spec does not contain a server URL, the package does not compile without warnings anymore:

/private/var/folders/6g/w8x1jq613lxb8rywcsr6c2sr0000gn/T/tmp.kMsrdZjt6T/Test/.build/plugins/outputs/test/MyAPI/destination/OpenAPIGenerator/GeneratedSources/Types.swift:11:9: error: package import of 'Foundation' was not used in package declarations [#UnusedImportAccess]
 9 | package import struct Foundation.URL
10 | package import struct Foundation.Data
11 | package import struct Foundation.Date
   |         `- error: package import of 'Foundation' was not used in package declarations [#UnusedImportAccess]
12 | #endif
13 | /// A type that performs HTTP operations defined by the OpenAPI document.

Build the attached package with swift build -Xswiftc -warnings-as-errors to reproduce.

Test.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/generatorAffects: plugin, CLI, config file.kind/enhancementImprovements to existing feature.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions