You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Emit YAML processing errors that Xcode can display (#81)
### Motivation
If there are any errors in the openapi.yaml file currently the errors
show up in the build transcript but are not shown in the Xcode issue
sidebar and are also not linked to the openapi.yaml file in the sidebar.
This makes it hard to know what has failed, and what to do to fix the
file.
### Modifications
The YAML parser now catches decoding errors, and if they are common
parsing or scanning errors it will emit a diagnostic message then throw
a failure exit code. This required importing the swift-argument-parser
module into the main _OpenAPIGeneratorCore.
Added `absoluteFilePath` and `lineNumber` optional properties to the
`Diagnostics` struct to capture more info. Modified the
`Diagnostics.description` method to build a properly formatted message
that Xcode can parse to point out the file and line causing issues.
### Result
In consuming projects, invalid yaml in the openapi.yaml file is now
highlighted in the Xcode Issue Navigator after a build with this plugin.
### Test Plan
Added unit tests to verify emitted diagnostic and thrown error. Also
tested manually with an example project.
### Resolves
- Resolves#65.
---------
Signed-off-by: Kyle Hammond <[email protected]>
0 commit comments