Skip to content

Commit 33beb18

Browse files
Merge main and resolve go.mod conflict
2 parents eb6d69d + 15217b3 commit 33beb18

File tree

19 files changed

+217
-188
lines changed

19 files changed

+217
-188
lines changed

.github/workflows/claude-code-review.yml

Lines changed: 0 additions & 78 deletions
This file was deleted.

.github/workflows/go.yml

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,17 @@ jobs:
4545
uses: actions/cache@v4
4646
with:
4747
path: ${{ steps.go-cache-paths.outputs.go-build }}
48-
key: ${{ runner.os }}-go-${{ matrix.go }}-build-${{ hashFiles('**/go.sum') }}
48+
key: ${{ runner.os }}-go-${{ matrix.go }}-build-v2-${{ hashFiles('**/go.sum', 'checker/localizations_src/**/*.yaml') }}
49+
restore-keys: |
50+
${{ runner.os }}-go-${{ matrix.go }}-build-v2-
4951
5052
- name: Go Mod Cache
5153
uses: actions/cache@v4
5254
with:
5355
path: ${{ steps.go-cache-paths.outputs.go-mod }}
54-
key: ${{ runner.os }}-go-${{ matrix.go }}-mod-${{ hashFiles('**/go.sum') }}
56+
key: ${{ runner.os }}-go-${{ matrix.go }}-mod-v2-${{ hashFiles('**/go.sum') }}
57+
restore-keys: |
58+
${{ runner.os }}-go-${{ matrix.go }}-mod-v2-
5559
5660
- run: go mod download && go mod tidy && go mod verify
5761
- run: git --no-pager diff --exit-code
@@ -61,18 +65,30 @@ jobs:
6165

6266
- if: runner.os == 'Linux'
6367
name: Generate breaking-changes examples
68+
run: make doc-breaking-changes
69+
70+
- if: runner.os == 'Linux'
71+
name: Check breaking-changes examples are up to date
72+
run: git --no-pager diff --exit-code docs/BREAKING-CHANGES-EXAMPLES.md
73+
74+
- if: runner.os == 'Linux'
75+
name: Generate localized messages
76+
run: |
77+
make localize
78+
79+
- if: runner.os == 'Linux'
80+
name: Check localized messages are up to date (excluding timestamp)
6481
run: |
65-
sh scripts/doc_breaking_changes.sh > docs/BREAKING-CHANGES-EXAMPLES.md
82+
# Compare from line 4 onwards (skipping the timestamp on line 3)
83+
git diff --no-index <(tail -n +4 checker/localizations/localizations.go) <(git show HEAD:checker/localizations/localizations.go | tail -n +4) || exit 0
6684
6785
- run: go fmt ./...
68-
- run: git --no-pager diff --exit-code
86+
- run: git --no-pager diff --exit-code -- ':!checker/localizations/localizations.go'
6987

7088
- run: go test ./... -coverprofile=coverage.txt -covermode=atomic
7189
env:
7290
CGO_ENABLED: '1'
7391

74-
- run: git --no-pager diff --exit-code
75-
7692
- if: runner.os == 'Linux'
7793
name: Errors must not be capitalized https://github.com/golang/go/wiki/CodeReviewComments#error-strings
7894
run: |

Makefile

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,9 @@ LINKER_FLAGS=-s -w -X github.com/oasdiff/oasdiff/build.Version=${VERSION}
55
GOLANGCILINT_VERSION=v1.52.2
66

77
.PHONY: test
8-
test: ## Run tests
8+
test: doc-breaking-changes localize ## Run tests
99
@echo "==> Running tests..."
1010
go test ./...
11-
@echo "==> Updating breaking changes documentation..."
12-
make doc-breaking-changes
1311

1412
.PHONY: coverage
1513
coverage: ## Run tests with coverage
@@ -51,6 +49,7 @@ lint: ## Run linter
5149
.PHONY: localize
5250
localize: ## Compile localized changelog messages
5351
@echo "==> Compiling localized changelog messages..."
52+
go install github.com/m1/go-localize@latest
5453
go-localize -input checker/localizations_src -output checker/localizations
5554
go fmt ./checker/localizations
5655

checker/localizations/localizations.go

Lines changed: 6 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

checker/localizations_src/ru/messages.yaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ in: в
33
request-body-added-required: добавлено обязательное тело запроса
44
request-body-added-optional: добавлено необязательное тело запроса
55
request-parameter-removed: удалён %s параметр запроса %s
6-
total-errors: "%s критические изменения: %s %s, %s %s\\n"
7-
total-changes: "%s изменений: %s %s, %s %s, %s %s\\n"
6+
total-errors: "%d критические изменения: %d %s, %d %s\\n"
7+
total-changes: "%d изменений: %d %s, %d %s, %d %s\\n"
88
request-parameter-pattern-added: добавлен pattern %s у %s параметра запроса %s
99
request-parameter-pattern-removed: удалён pattern %s у %s параметра запроса %s
1010
request-parameter-pattern-changed: изменён pattern у %s параметра запроса %s со значения %s на значение %s
@@ -20,6 +20,9 @@ api-invalid-stability-level: "не удалось разобрать урове
2020
api-deprecated-sunset-missing: "API устарел без даты прекращения действия"
2121
api-sunset-date-too-small: дата API sunset date %s слишком ранняя, должно быть как минимум %s дней от текущего дня
2222
api-path-added: API path добавлено
23+
endpoint-added: эндпоинт добавлен
24+
endpoint-deprecated: эндпоинт устарел
25+
endpoint-reactivated: эндпоинт реактивирован
2326
api-path-deprecated: API path deprecated
2427
api-path-reactivated: API path реактивирован
2528
api-path-removed-without-deprecation: API path удалён без процедуры deprecation

data/explode-params/issue-767.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
openapi: 3.0.3
2+
paths:
3+
/test:
4+
parameters:
5+
- $ref: '#/components/parameters/QueryParam'
6+
7+
components:
8+
parameters:
9+
QueryParam:
10+
name: query
11+
in: query
12+
required: false
13+
explode: true
14+
schema:
15+
$ref: '#/components/schemas/QuerySchema'
16+
schemas:
17+
QuerySchema:
18+
type: object
19+
properties:
20+
query:
21+
type: string

diff/parameters_diff_by_location.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,12 @@ func matchExplodedWithSimple(config *Config, state *state, simpleParams, explode
376376
continue
377377
}
378378

379+
// Skip if this parameter is itself an exploded object parameter
380+
// We only want to match truly simple parameters with exploded parameters
381+
if isExplodedObjectParam(simpleParam) {
382+
continue
383+
}
384+
379385
// Only match simple parameters that are in query or cookie locations
380386
// to ensure both simple and exploded params are in compatible locations
381387
if !isQueryOrCookieParam(simpleParam) {

diff/parameters_diff_by_location_test.go

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,30 @@ func TestParameterStyleDefaults(t *testing.T) {
155155

156156
}
157157

158+
// TestIssue767_ExplodedParamWithSameNameProperty tests that an exploded object parameter
159+
// is not mistakenly matched with a property inside its own schema.
160+
// Regression test for issue #767 where a parameter named "query" with a property named "query"
161+
// inside its schema was incorrectly matched as semantically equivalent to itself.
162+
func TestIssue767_ExplodedParamWithSameNameProperty(t *testing.T) {
163+
loader := openapi3.NewLoader()
164+
165+
// Load the same spec twice - should result in no diff
166+
s1, err := load.NewSpecInfo(loader, load.NewSource("../data/explode-params/issue-767.yml"))
167+
require.NoError(t, err)
168+
169+
s2, err := load.NewSpecInfo(loader, load.NewSource("../data/explode-params/issue-767.yml"))
170+
require.NoError(t, err)
171+
172+
// Get the diff
173+
d, _, err := diff.GetWithOperationsSourcesMap(diff.NewConfig(), s1, s2)
174+
require.NoError(t, err)
175+
176+
// The key assertion: identical specs should have no diff
177+
// Before the fix, this incorrectly reported modifications because the "query" parameter
178+
// was matched with its own "query" property
179+
require.Nil(t, d, "Identical specs should result in no diff")
180+
}
181+
158182
// TestExplodedParameterLocationMatching tests that parameters with the same name
159183
// but different locations (In field) are NOT matched by exploded parameter logic.
160184
// This test verifies the location check at parameters_diff_by_location.go:304

docs/OASDIFF-SERVICE.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,6 @@ The service uses conventional HTTP response codes to indicate success or failure
3939
- Codes in the 2xx range indicate success
4040
- Codes in the 4xx range indicate a failure with additional information provided (e.g., invalid OpenAPI spec format, a required parameter was missing, etc.)
4141
- Codes in the 5xx range indicate a server error (these are rare)
42+
43+
### Source Code
44+
https://github.com/oasdiff/oasdiff-service

docs/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ go install github.com/oasdiff/oasdiff@latest
2020

2121
### Install on macOS with Brew
2222
```bash
23-
brew tap oasdiff/homebrew-oasdiff
2423
brew install oasdiff
2524
```
2625

0 commit comments

Comments
 (0)