Skip to content

Commit

Permalink
fix(cli): relative path file loading
Browse files Browse the repository at this point in the history
  • Loading branch information
NextFire committed Jul 17, 2024
1 parent 336fa43 commit 8c1bb0c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ openapi-compare -o new_oas.json -n old_oas.json -f Json
```

Available options:
| Option | Small | Required | Description |
|----------------|-------|----------|---------------------------------------------------------------------------------------------------------------|
| --old | -o | true | Path or URL to old OpenAPI Specification. |
| --new | -n | true | Path or URL to new OpenAPI Specification. |
| --outputFormat | -f | false | (Default: Json) Specifies in which format the differences should be displayed. Possible values: Json \| Text. |
| --strict | -s | false | (Default: false) Enable strict mode: breaking changes are errors instead of warnings. |
| --help | -h | false | Log available options |
| Option | Small | Required | Description |
|------------------|---------|----------|---------------------------------------------------------------------------------------------------------------------|
| `--old` | `-o` | `true` | Path or URL to old OpenAPI Specification. |
| `--new` | `-n` | `true` | Path or URL to new OpenAPI Specification. |
| `--outputFormat` | `-f` | `false` | (Default: `Json`) Specifies in which format the differences should be displayed. Possible values: `Json` \| `Text`. |
| `--strict` | `-s` | `false` | (Default: `false`) Enable strict mode: breaking changes are errors instead of warnings. |
| `--help` | `-h` | `false` | Log available options |

## Comparison rules

Expand Down
4 changes: 3 additions & 1 deletion src/Criteo.OpenApi.Comparator.Cli/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ private static bool TryReadFile(string path, out string fileContent)
{
try
{
var uri = new Uri(path);
// In case `path` is detected as an absolute or remote URI, `System.Uri` will ignore the `cwdUri`.
var cwdUri = new Uri(Directory.GetCurrentDirectory());
var uri = new Uri(cwdUri, path);
if (uri.IsFile)
{
return TryReadLocalFile(path, out fileContent);
Expand Down

0 comments on commit 8c1bb0c

Please sign in to comment.