Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions Plugins/OpenAPIGeneratorCommand/plugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,11 @@ extension SwiftOpenAPIGeneratorPlugin: CommandPlugin {
hadASuccessfulRun = true
} catch let error as PluginError {
if error.isMisconfigurationError {
print("- OpenAPI code generation failed with error.")
print("- Stopping because target isn't configured for OpenAPI code generation.")
Comment on lines 84 to +85
Copy link
Contributor

@MahdiBM MahdiBM Jul 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not quite right though.

When isMisconfigurationError is true, It's pretty much certain that the user configured their target for openapi, but did it wrong.

When isMisconfigurationError is false, it can be either a misconfiguration or no-configuration.

Or at least that's what I intended with this code, IIRC.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not defending the existing message and handling. Just saying the new message/handling can also be improved.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's fair, how about we just tweak this one?

Suggested change
if error.isMisconfigurationError {
print("- OpenAPI code generation failed with error.")
print("- Stopping because target isn't configured for OpenAPI code generation.")
if error.isMisconfigurationError {
print("- Stopping because target is misconfigured for OpenAPI code generation.")

//cc @MahdiBM @czechboy0

throw error
} else {
print("- Stopping because target isn't configured for OpenAPI code generation.")
print("- OpenAPI code generation failed with error.")
throw error
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ extension _GenerateOptions {
}
let (diagnostics, finalizeDiagnostics) = preparedDiagnosticsCollector(outputPath: diagnosticsOutputPath)
let doc = self.docPath
print(
FileHandle.standardError.write(
"""
Swift OpenAPI Generator is running with the following configuration:
- OpenAPI document path: \(doc.path)
Expand Down