Skip to content

Commit

Permalink
diff-add-exclude-elements-options (#454)
Browse files Browse the repository at this point in the history
  • Loading branch information
Reuven Harrison authored Dec 7, 2023
1 parent ac02167 commit 88b9075
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 11 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
strategy:
fail-fast: true
matrix:
go: ['1.21.4']
go: ['1.21.5']
os:
- ubuntu-latest
- windows-latest
Expand Down Expand Up @@ -71,7 +71,7 @@ jobs:
name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.52.2
version: v1.55

- id: govulncheck
uses: golang/govulncheck-action@v1
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
### Go get dependecies and build ###
FROM golang:1.21.4 as builder
FROM golang:1.21.5 as builder
ENV PLATFORM docker
WORKDIR /go/src/app
COPY go.mod go.sum ./
Expand Down
36 changes: 36 additions & 0 deletions OASDIFF-SERVICE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# oasdiff-service

### Creating a tenant
Create a tenant and get a tenant ID:
```
curl -d '{"tenant": "my-company", "email": "[email protected]"}' https://register.oasdiff.com/tenants
```
You will get a response with your tenant ID:
```
{"id": "2ahh9d6a-2221-41d7-bbc5-a950958345"}
```
### Run diff
```
curl -X POST \
-F base=@data/openapi-test1.yaml \
-F revision=@data/openapi-test3.yaml \
http://api.oasdiff.com/tenants/{tenant-id}/diff
```

### Run breaking-changes
```
curl -X POST \
-F base=@data/openapi-test1.yaml \
-F revision=@data/openapi-test3.yaml \
https://api.oasdiff.com/tenants/{tenant-id}/breaking-changes
```

### Run changelog
```
curl -X POST \
-F base=@data/openapi-test1.yaml \
-F revision=@data/openapi-test3.yaml \
https://api.oasdiff.com/tenants/{tenant-id}/changelog
```
### Errors
oasdiff-service uses conventional HTTP response codes to indicate the success or failure of an API request. In general: Codes in the 2xx range indicate success. Codes in the 4xx range indicate a failure with additional information provided (e.g., invalid OpenAPI spec format, a required parameter was missing, etc.). Codes in the 5xx range indicate an error with oasdiff-service servers (these are rare)
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ Copy binaries from [latest release](https://github.com/Tufin/oasdiff/releases/)

## Wrappers
- [GitHub Action](https://github.com/oasdiff/oasdiff-action)
- [Cloud Service](#openapi-diff-and-breaking-changes-as-a-service)
- [Cloud Service](#openapi-diff-breaking-changes-and-changelog-as-a-service)
- [OpenAPI Sync: Get notified when an API provider breaks the API](https://github.com/oasdiff/sync/)

## Usage Examples
Expand Down Expand Up @@ -163,8 +163,7 @@ Replace `$(pwd)/data` by the path that contains your files.
Note that the spec paths must begin with `/`.

## OpenAPI Diff, Breaking Changes and Changelog as a Service
Oasdiff is also available a service.
See: https://github.com/oasdiff/oasdiff-service
[Oasdiff is also available as a service](OASDIFF-SERVICE.md).

## Diff Output Formats
The default diff output format, YAML, provides a full view of all diff details.
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/tufin/oasdiff

go 1.21.4
go 1.21.5

require (
cloud.google.com/go v0.111.0
Expand All @@ -11,7 +11,7 @@ require (
github.com/stretchr/testify v1.8.4
github.com/yargevad/filepathx v1.0.0
github.com/yuin/goldmark v1.6.0
golang.org/x/exp v0.0.0-20231127185646-65229373498e
golang.org/x/exp v0.0.0-20231206192017-f3f8817b8deb
gopkg.in/yaml.v3 v3.0.1
)

Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ github.com/yargevad/filepathx v1.0.0 h1:SYcT+N3tYGi+NvazubCNlvgIPbzAk7i7y2dwg3I5
github.com/yargevad/filepathx v1.0.0/go.mod h1:BprfX/gpYNJHJfc35GjRRpVcwWXS89gGulUIU5tK3tA=
github.com/yuin/goldmark v1.6.0 h1:boZcn2GTjpsynOsC0iJHnBWa4Bi0qzfJjthwauItG68=
github.com/yuin/goldmark v1.6.0/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
golang.org/x/exp v0.0.0-20231127185646-65229373498e h1:Gvh4YaCaXNs6dKTlfgismwWZKyjVZXwOPfIyUaqU3No=
golang.org/x/exp v0.0.0-20231127185646-65229373498e/go.mod h1:iRJReGqOEeBhDZGkGbynYwcHlctCvnjTYIamk7uXpHI=
golang.org/x/exp v0.0.0-20231206192017-f3f8817b8deb h1:c0vyKkb6yr3KR7jEfJaOSv4lG7xPkbN6r52aJz1d8a8=
golang.org/x/exp v0.0.0-20231206192017-f3f8817b8deb/go.mod h1:iRJReGqOEeBhDZGkGbynYwcHlctCvnjTYIamk7uXpHI=
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc=
golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
Expand Down
2 changes: 1 addition & 1 deletion internal/diff.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func getDiffCmd() *cobra.Command {

cmd.PersistentFlags().BoolVarP(&flags.composed, "composed", "c", false, "work in 'composed' mode, compare paths in all specs matching base and revision globs")
enumWithOptions(&cmd, newEnumValue(formatters.SupportedFormatsByContentType(formatters.OutputDiff), string(formatters.FormatYAML), &flags.format), "format", "f", "output format")
cmd.PersistentFlags().VarP(newEnumSliceValue(diff.ExcludeDiffOptions, nil, &flags.excludeElements), "exclude-elements", "e", "comma-separated list of elements to exclude")
enumWithOptions(&cmd, newEnumSliceValue(diff.ExcludeDiffOptions, nil, &flags.excludeElements), "exclude-elements", "e", "comma-separated list of elements to exclude")
cmd.PersistentFlags().StringVarP(&flags.matchPath, "match-path", "p", "", "include only paths that match this regular expression")
cmd.PersistentFlags().StringVarP(&flags.filterExtension, "filter-extension", "", "", "exclude paths and operations with an OpenAPI Extension matching this regular expression")
cmd.PersistentFlags().IntVarP(&flags.circularReferenceCounter, "max-circular-dep", "", 5, "maximum allowed number of circular dependencies between objects in OpenAPI specs")
Expand Down

0 comments on commit 88b9075

Please sign in to comment.