Skip to content

Commit e91d0c6

Browse files
feat!: introduce comprehensive OpenAPI 3.0.x/3.1.x parser with validation, walking, and upgrading (#19)
1 parent cddaf2e commit e91d0c6

File tree

321 files changed

+63599
-2483
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

321 files changed

+63599
-2483
lines changed

.gitattributes

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Ensure consistent line endings across platforms
2+
# All text files should use LF (Unix) line endings
3+
4+
# Default behavior: normalize line endings to LF on checkin,
5+
# but allow platform-specific line endings on checkout
6+
* text=auto
7+
8+
# Force LF line endings for specific file types that should always be consistent
9+
*.go text eol=lf
10+
*.yaml text eol=lf
11+
*.yml text eol=lf
12+
*.json text eol=lf
13+
*.md text eol=lf
14+
*.txt text eol=lf
15+
*.sh text eol=lf
16+
17+
# Test data files should always use LF to match Go's YAML output
18+
testdata/**/*.yaml text eol=lf
19+
testdata/**/*.yml text eol=lf
20+
testdata/**/*.json text eol=lf
21+
22+
# Binary files should not be normalized
23+
*.png binary
24+
*.jpg binary
25+
*.jpeg binary
26+
*.gif binary
27+
*.ico binary
28+
*.pdf binary
29+
*.zip binary
30+
*.tar.gz binary

.github/dependabot.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
version: 2
2+
updates:
3+
# Enable version updates for Go modules
4+
- package-ecosystem: "gomod"
5+
directory: "/"
6+
schedule:
7+
interval: "weekly"
8+
day: "monday"
9+
time: "09:00"
10+
open-pull-requests-limit: 10
11+
reviewers:
12+
- "speakeasy-api/maintainers"
13+
assignees:
14+
- "speakeasy-api/maintainers"
15+
commit-message:
16+
prefix: "deps"
17+
prefix-development: "deps"
18+
include: "scope"
19+
labels:
20+
- "dependencies"
21+
- "go"
22+
groups:
23+
# Group patch and minor updates together
24+
go-minor-patch:
25+
patterns:
26+
- "*"
27+
update-types:
28+
- "minor"
29+
- "patch"
30+
# Keep major updates separate for careful review
31+
go-major:
32+
patterns:
33+
- "*"
34+
update-types:
35+
- "major"
36+
37+
# Enable version updates for GitHub Actions
38+
- package-ecosystem: "github-actions"
39+
directory: "/"
40+
schedule:
41+
interval: "weekly"
42+
day: "monday"
43+
time: "09:00"
44+
open-pull-requests-limit: 5
45+
reviewers:
46+
- "speakeasy-api/maintainers"
47+
assignees:
48+
- "speakeasy-api/maintainers"
49+
commit-message:
50+
prefix: "ci"
51+
include: "scope"
52+
labels:
53+
- "dependencies"
54+
- "github-actions"
55+
groups:
56+
github-actions:
57+
patterns:
58+
- "*"

.github/workflows/commits.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Validate Conventional Commits
2+
3+
on:
4+
pull_request:
5+
types:
6+
- opened
7+
- reopened
8+
- edited
9+
- synchronize
10+
- ready_for_review
11+
jobs:
12+
build:
13+
name: Conventional Commits
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
17+
- uses: webiny/action-conventional-commits@8bc41ff4e7d423d56fa4905f6ff79209a78776c7 # v1.3.0
18+
- uses: amannn/action-semantic-pull-request@0723387faaf9b38adef4775cd42cfd5155ed6017 # v5.5.3
19+
env:
20+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/test.yaml

Lines changed: 118 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -7,57 +7,125 @@ on:
77
branches: [main]
88

99
jobs:
10-
test-and-build:
10+
lint:
11+
name: Lint and Format Check
1112
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- name: Install mise
17+
uses: jdx/mise-action@v2
18+
19+
- name: Get Go cache paths
20+
id: go-cache-paths
21+
shell: bash
22+
run: |
23+
echo "go-build=$(go env GOCACHE)" >> $GITHUB_OUTPUT
24+
echo "go-mod=$(go env GOMODCACHE)" >> $GITHUB_OUTPUT
25+
26+
- name: Cache Go Build Cache
27+
uses: actions/cache@v4
28+
with:
29+
path: ${{ steps.go-cache-paths.outputs.go-build }}
30+
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}
31+
32+
- name: Cache Go Mod Cache
33+
uses: actions/cache@v4
34+
with:
35+
path: ${{ steps.go-cache-paths.outputs.go-mod }}
36+
key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}
37+
38+
- name: Check code formatting
39+
run: mise run fmt-check
40+
41+
- name: Check module dependencies
42+
run: mise run mod-check
43+
44+
- name: Run lint task
45+
run: mise run lint
46+
47+
- name: Check examples are up to date
48+
run: mise run examples-check
49+
50+
test-and-build:
51+
name: Test and Build
52+
needs: lint
53+
strategy:
54+
matrix:
55+
os: [ubuntu-latest, windows-latest]
56+
runs-on: ${{ matrix.os }}
1257
permissions:
1358
contents: read
1459
pull-requests: write
1560

1661
steps:
1762
- uses: actions/checkout@v4
1863

19-
- name: Set up Go
20-
uses: actions/setup-go@v5
64+
- name: Install mise
65+
uses: jdx/mise-action@v2
66+
67+
- name: Get Go cache paths
68+
id: go-cache-paths
69+
shell: bash
70+
run: |
71+
echo "go-build=$(go env GOCACHE)" >> $GITHUB_OUTPUT
72+
echo "go-mod=$(go env GOMODCACHE)" >> $GITHUB_OUTPUT
73+
74+
- name: Cache Go Build Cache
75+
uses: actions/cache@v4
2176
with:
22-
go-version: "1.23"
77+
path: ${{ steps.go-cache-paths.outputs.go-build }}
78+
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}
2379

24-
- name: Install dependencies
25-
run: go mod download
80+
- name: Cache Go Mod Cache
81+
uses: actions/cache@v4
82+
with:
83+
path: ${{ steps.go-cache-paths.outputs.go-mod }}
84+
key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}
2685

27-
- name: Run golangci-lint
28-
uses: golangci/golangci-lint-action@v6
86+
- name: Cache downloaded test files
87+
uses: actions/cache@v4
2988
with:
30-
version: latest
89+
path: |
90+
~/tmp/speakeasy-api_arazzo
91+
${{ runner.temp }}/speakeasy-api_arazzo
92+
key: arazzo-test-files-${{ hashFiles('arazzo/arazzo_test.go') }}
93+
restore-keys: |
94+
arazzo-test-files-
3195
3296
- name: Run tests with coverage
33-
run: |
34-
go test -v -race -coverprofile=coverage.out -covermode=atomic ./...
35-
go tool cover -html=coverage.out -o coverage.html
97+
if: matrix.os == 'ubuntu-latest'
98+
run: mise run test-coverage
99+
100+
- name: Run tests (Windows)
101+
if: matrix.os == 'windows-latest'
102+
run: gotestsum --format testname -- -race ./...
36103

37104
- name: Calculate coverage
105+
if: matrix.os == 'ubuntu-latest'
38106
id: coverage
39107
run: |
40108
COVERAGE=$(go tool cover -func=coverage.out | grep total | awk '{print $3}')
41109
echo "coverage=$COVERAGE" >> $GITHUB_OUTPUT
42110
echo "Coverage: $COVERAGE"
43111
44112
- name: Get main branch coverage
45-
if: github.event_name == 'pull_request'
113+
if: github.event_name == 'pull_request' && matrix.os == 'ubuntu-latest'
46114
id: main-coverage
47115
run: |
48116
# Store current working directory
49117
CURRENT_DIR=$(pwd)
50-
118+
51119
# Fetch main branch
52120
git fetch origin main:main
53-
121+
54122
# Checkout main branch in a temporary directory
55123
git worktree add /tmp/main-branch main
56-
124+
57125
# Run tests on main branch to get coverage
58126
cd /tmp/main-branch
59127
go test -coverprofile=main-coverage.out -covermode=atomic ./... > /dev/null 2>&1 || echo "Main branch tests failed"
60-
128+
61129
if [ -f main-coverage.out ]; then
62130
MAIN_COVERAGE=$(go tool cover -func=main-coverage.out | grep total | awk '{print $3}' || echo "0.0%")
63131
echo "main-coverage=$MAIN_COVERAGE" >> $GITHUB_OUTPUT
@@ -69,23 +137,24 @@ jobs:
69137
echo "main-coverage=0.0%" >> $GITHUB_OUTPUT
70138
echo "Could not get main branch coverage"
71139
fi
72-
140+
73141
# Return to original directory
74142
cd "$CURRENT_DIR"
75-
143+
76144
# Clean up worktree (force removal to handle modified files)
77145
git worktree remove --force /tmp/main-branch || rm -rf /tmp/main-branch
78146
79147
- name: Generate coverage summary
148+
if: matrix.os == 'ubuntu-latest'
80149
id: coverage-summary
81150
run: |
82151
echo "## 📊 Test Coverage Report" > coverage-summary.md
83152
echo "" >> coverage-summary.md
84-
153+
85154
# Current coverage
86155
CURRENT_COV="${{ steps.coverage.outputs.coverage }}"
87156
echo "**Current Coverage:** \`$CURRENT_COV\`" >> coverage-summary.md
88-
157+
89158
# Compare with main if this is a PR
90159
if [ "${{ github.event_name }}" = "pull_request" ] && [ "${{ steps.main-coverage.outputs.main-coverage }}" != "" ]; then
91160
MAIN_COV="${{ steps.main-coverage.outputs.main-coverage }}"
@@ -109,7 +178,7 @@ jobs:
109178
fi
110179
fi
111180
fi
112-
181+
113182
echo "" >> coverage-summary.md
114183
echo "### Coverage by Package" >> coverage-summary.md
115184
echo "\`\`\`" >> coverage-summary.md
@@ -122,25 +191,25 @@ jobs:
122191
echo "_Generated by GitHub Actions_" >> coverage-summary.md
123192
124193
- name: Comment PR with coverage
125-
if: github.event_name == 'pull_request'
194+
if: github.event_name == 'pull_request' && matrix.os == 'ubuntu-latest'
126195
uses: actions/github-script@v7
127196
with:
128197
script: |
129198
const fs = require('fs');
130199
const coverageSummary = fs.readFileSync('coverage-summary.md', 'utf8');
131-
200+
132201
// Look for existing coverage comment
133202
const comments = await github.rest.issues.listComments({
134203
issue_number: context.issue.number,
135204
owner: context.repo.owner,
136205
repo: context.repo.repo,
137206
});
138-
207+
139208
const botComment = comments.data.find(comment =>
140209
comment.user.type === 'Bot' &&
141210
comment.body.includes('📊 Test Coverage Report')
142211
);
143-
212+
144213
if (botComment) {
145214
// Update existing comment
146215
await github.rest.issues.updateComment({
@@ -160,12 +229,34 @@ jobs:
160229
}
161230
162231
- name: Upload coverage artifact
232+
if: matrix.os == 'ubuntu-latest'
163233
uses: actions/upload-artifact@v4
164234
with:
165235
name: coverage-report
166236
path: |
167237
coverage.out
168238
coverage.html
169239
170-
- name: Build
240+
- name: Build (Ubuntu)
241+
if: matrix.os == 'ubuntu-latest'
242+
run: mise run build
243+
244+
- name: Build (Windows)
245+
if: matrix.os == 'windows-latest'
171246
run: go build -v ./...
247+
248+
# Summary job that depends on all matrix jobs
249+
# This provides a single status check for branch protection
250+
test-summary:
251+
name: Test Summary
252+
needs: [lint, test-and-build]
253+
runs-on: ubuntu-latest
254+
if: always()
255+
steps:
256+
- name: Check test results
257+
run: |
258+
if [ "${{ needs.test-and-build.result }}" != "success" ]; then
259+
echo "Tests failed or were cancelled"
260+
exit 1
261+
fi
262+
echo "All tests passed successfully"

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Coverage files generated by test-coverage task
2+
coverage.out
3+
coverage.html
4+
5+
# VSCode settings (user-specific)
6+
.vscode/*
7+
!.vscode/settings.example.json

0 commit comments

Comments
 (0)