Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
100 commits
Select commit Hold shift + click to select a range
f85abf4
Fix #165
Apr 19, 2023
7ee5140
Merge pull request #166 from Aven30/fix-spec-parser-ignoring-response…
casualjim Apr 22, 2023
b123375
Fix `x-order` not working with number value #162
ChandanChainani Mar 6, 2023
832384d
Merge pull request #163 from ChandanChainani/fix/162/x-order_not_work…
casualjim Apr 22, 2023
32e224f
fixed json unmarshal for BoolOrSchema
fredbi Nov 30, 2023
d8ccc36
ci: re-enacted linting
fredbi Nov 30, 2023
0da2f93
chore: updated linting config, relinted
fredbi Nov 30, 2023
2341568
ci: removed deprecated appveyor CI
fredbi Nov 30, 2023
cc27dbe
Merge pull request #170 from fredbi/chore/update-linting
casualjim Dec 1, 2023
ba7eeb1
Merge pull request #169 from fredbi/ci/reenact-linting
casualjim Dec 1, 2023
8b1afa6
Merge pull request #171 from fredbi/vuln/fix-161
casualjim Dec 1, 2023
95bb41d
Merge pull request #168 from fredbi/fix-148
casualjim Dec 1, 2023
d6c58be
updated go version
fredbi Dec 4, 2023
5762ed3
Removed dependency on bindata
fredbi Dec 4, 2023
b250982
Revert fix #146 (#172)
fredbi Dec 4, 2023
56b7b69
Merge pull request #173 from fredbi/chore/update-go-version
youyuanwu Dec 5, 2023
0bd5b7c
Merge pull request #174 from fredbi/chore/adopt-embedfs
youyuanwu Dec 5, 2023
7d71eda
doc: fixed typo in badge link
fredbi Dec 5, 2023
4df02b2
fixed yet another typo with badges
fredbi Dec 5, 2023
94a1c0d
updated dependencies
fredbi Dec 17, 2023
8789dc3
removed pre-go1.19 code
fredbi Dec 17, 2023
ee158df
chore(deps): updated go-openapi deps
fredbi Dec 22, 2023
b445199
fix(ci): muted warnings in CI runs due to cache conflicts
fredbi Dec 25, 2023
ed00e71
fix(expand): parameters & responses should properly follow remote doc…
fredbi Jan 9, 2024
63dcade
doc(faq): transfered questions to README
fredbi Jan 9, 2024
4c02b81
ci(dependencies): automate dependencies updates
fredbi Feb 1, 2024
7e0aabf
Bump the go-openapi-dependencies group with 1 update
dependabot[bot] Feb 1, 2024
5c52f3d
Bump the development-dependencies group with 3 updates
dependabot[bot] Feb 1, 2024
817cb94
chore(ci): prevents duplicate workflow runs
fredbi Feb 1, 2024
c21b34f
Bump the development-dependencies group with 1 update
dependabot[bot] Feb 2, 2024
a68da9e
ci: remove paths-ignore
fredbi Feb 3, 2024
397f81b
Bump the development-dependencies group with 1 update
dependabot[bot] Feb 16, 2024
c786eed
fix(ci): remove dependency-type from dependabot groups
fredbi Mar 4, 2024
fc76ee8
chore(lint): relinted
fredbi Mar 4, 2024
8937a3d
updated dependencies
fredbi Mar 4, 2024
af9bab8
chore(go): go-openapi requires go.1.20 across the board
fredbi Mar 9, 2024
7246d41
Bump the development-dependencies group with 1 update
dependabot[bot] Mar 22, 2024
2a63555
Bump golangci/golangci-lint-action in the development-dependencies group
dependabot[bot] Apr 26, 2024
7b021a9
Bump golangci/golangci-lint-action in the development-dependencies group
dependabot[bot] May 10, 2024
96bee35
Bump codecov/codecov-action in the development-dependencies group
dependabot[bot] Nov 15, 2024
302430d
Bump github.com/stretchr/testify from 1.9.0 to 1.10.0
dependabot[bot] Nov 29, 2024
de35272
Merge pull request #204 from go-openapi/dependabot/go_modules/github.…
youyuanwu Feb 5, 2025
0201d0c
Relint
fredbi Mar 11, 2025
9deaa98
re-enacted dependabot auto-merge
fredbi Mar 12, 2025
d8c0160
Bump the go-openapi-dependencies group with 2 updates
dependabot[bot] Mar 14, 2025
6613744
ci: fixed broken codecov coverage upload
fredbi Mar 16, 2025
bc386e3
ci: updated config for golangci-lint v2
fredbi Mar 28, 2025
a392846
ci: fixed codecov upload
fredbi Mar 17, 2025
cebbc5a
Bump golangci/golangci-lint-action in the development-dependencies group
dependabot[bot] May 9, 2025
c58668d
chore(lint): updated linters, relinted code
fredbi Aug 9, 2025
7c8c5e9
ci: fixed auto-merge
fredbi Aug 10, 2025
47a6321
fix(lint): fixed false positives in tests (testifylint)
fredbi Aug 10, 2025
e874ac9
build(deps): bump github.com/go-openapi/jsonpointer
dependabot[bot] Aug 10, 2025
50d4b57
build(deps): bump actions/checkout in the development-dependencies group
dependabot[bot] Aug 15, 2025
26ddb24
build(deps): bump github.com/stretchr/testify
dependabot[bot] Aug 29, 2025
e935aa9
chore: adopted swag v0.24.0 modules
fredbi Aug 30, 2025
496cf72
build(deps): bump actions/setup-go in the development-dependencies group
dependabot[bot] Sep 5, 2025
3dbaee0
build(deps): bump the go-openapi-dependencies group with 5 updates
dependabot[bot] Sep 26, 2025
df12108
chore(deps): updated dependencies
fredbi Sep 26, 2025
053aef4
updated linting rules to go1.24
fredbi Sep 26, 2025
e3141f6
updated yaml dependency to maintained package
fredbi Sep 26, 2025
3c1111c
chore(linting): removed nolint directives when the linter has fixed f…
fredbi Sep 26, 2025
9da6d8d
chore: updated license marks in source files
fredbi Nov 9, 2025
f06cfff
tests: replaced stretchr/testify by go-openapi/testify
fredbi Nov 9, 2025
c14c0a6
chore: fix typos in comments
alexandear Nov 11, 2025
817d7f9
build(deps): bump golangci/golangci-lint-action
dependabot[bot] Nov 14, 2025
f0c3eff
build(deps): bump the go-openapi-dependencies group with 6 updates
dependabot[bot] Nov 21, 2025
f532082
build(deps): bump the go-openapi-dependencies group with 5 updates
dependabot[bot] Nov 28, 2025
a637b92
build(deps): bump actions/checkout in the development-dependencies group
dependabot[bot] Dec 5, 2025
4f79daa
ci: aligned CI and doc with go-openapi repos
fredbi Dec 8, 2025
b75931b
fix: added guard for edge case causing potential panic
fredbi Dec 8, 2025
90bc044
test(readability): used embedded FS for fixtures
fredbi Dec 4, 2023
1ffcd7a
doc: updated contributors file
bot-go-openapi[bot] Dec 8, 2025
e58b915
chore: updated jsonpointer and reference
fredbi Dec 8, 2025
324f6d9
doc: removed old version of the README
fredbi Dec 8, 2025
ddeeaf8
doc: updated contributors file
bot-go-openapi[bot] Dec 13, 2025
b3b30bf
ci: remove redundant release workflow
fredbi Dec 17, 2025
1beb4f3
doc: fixed wrong links in docs
fredbi Dec 17, 2025
32a252c
build(deps): bump the development-dependencies group with 7 updates
dependabot[bot] Dec 19, 2025
e64b092
doc: announced new discord channel
fredbi Dec 19, 2025
90efd45
doc: updated contributors file
bot-go-openapi[bot] Dec 20, 2025
3b2ff60
fix: fixed key escaping in OrderedItems marshaling
fredbi Dec 24, 2025
5fc39a0
doc: updated contributors file
bot-go-openapi[bot] Dec 27, 2025
22037ac
build(deps): bump the development-dependencies group with 7 updates
dependabot[bot] Jan 9, 2026
02c28f2
build(deps): bump github.com/go-openapi/testify/v2
dependabot[bot] Jan 16, 2026
d181245
build(deps): bump the development-dependencies group with 7 updates
dependabot[bot] Jan 30, 2026
d708159
build(deps): bump github.com/go-openapi/testify/v2
dependabot[bot] Feb 6, 2026
71eebab
build(deps): bump github.com/go-openapi/testify/v2
dependabot[bot] Feb 13, 2026
7ca5d97
build(deps): bump the development-dependencies group with 7 updates
dependabot[bot] Feb 20, 2026
0c2d5d4
build(deps): bump github.com/go-openapi/testify/v2
dependabot[bot] Feb 27, 2026
d6177ef
chore: doc, tests, lint (#255)
fredbi Mar 3, 2026
fb0c59e
build(deps): bump the development-dependencies group with 7 updates
dependabot[bot] Mar 6, 2026
cb33f35
doc: updated contributors file
bot-go-openapi[bot] Mar 7, 2026
6bf1996
build(deps): bump the go-openapi-dependencies group with 2 updates
dependabot[bot] Mar 13, 2026
b2867e8
doc: update discord link (#260)
fredbi Mar 15, 2026
b7c0c19
doc: add portable agentic instructions (#261)
fredbi Mar 15, 2026
1505803
chore: bump go directive to 1.25.0 (#262)
fredbi Mar 15, 2026
2e5142b
build(deps): bump the development-dependencies group with 7 updates
dependabot[bot] Mar 15, 2026
2b49290
build(deps): bump the go-openapi-dependencies group with 2 updates
dependabot[bot] Mar 20, 2026
c5c7103
doc: updated contributors file
bot-go-openapi[bot] Mar 21, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .claude/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
plans/
skills/
commands/
agents/
hooks/
85 changes: 85 additions & 0 deletions .claude/CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

## Project Overview

Go types modeling the [Swagger 2.0 / OpenAPI 2.0](https://swagger.io/specification/v2/)
specification. Every object in the spec --- `Swagger`, `Info`, `PathItem`, `Operation`,
`Parameter`, `Schema`, `Response`, `Header`, `SecurityScheme`, etc. --- has a corresponding
Go struct with JSON serialization (`encoding/json`) that round-trips through the spec's
JSON representation.

This package is the **foundational data model** for the
[go-swagger](https://github.com/go-swagger/go-swagger) ecosystem. Higher-level packages
(`analysis`, `loads`, `validate`, `runtime`) consume these types to load, analyze, validate,
and serve Swagger specifications. Because it sits at the bottom of the dependency graph,
changes here ripple through the entire ecosystem.

Key capabilities beyond plain structs:

- **`$ref` resolution** --- the `Ref` type wraps JSON Reference pointers; the `expander`
resolves `$ref` nodes (local, remote, circular) into fully expanded specs.
- **Schema composition** --- `Schema` supports `allOf`, `additionalProperties`,
`additionalItems`, and JSON Schema validations (`minimum`, `pattern`, `enum`, etc.).
- **URL normalization** --- cross-platform path/URL normalization for `$ref` targets.
- **Embedded spec** --- a copy of the Swagger 2.0 JSON Schema is embedded via `go:embed`
for offline use.

See [docs/MAINTAINERS.md](../docs/MAINTAINERS.md) for CI/CD, release process, and repo structure details.

### Package layout (single package)

| File | Contents |
|------|----------|
| `swagger.go` | Root `Swagger` type (top-level spec object) |
| `info.go` | `Info`, `ContactInfo`, `LicenseInfo` |
| `paths.go` | `Paths` (map of path patterns to `PathItem`) |
| `path_item.go` | `PathItem` (GET/PUT/POST/DELETE/... operations per path) |
| `operation.go` | `Operation` (single API operation) |
| `parameter.go` | `Parameter` (query, header, path, body, formData) |
| `header.go` | `Header` |
| `response.go`, `responses.go` | `Response`, `Responses` |
| `schema.go` | `Schema` (JSON Schema subset used by Swagger) |
| `security_scheme.go` | `SecurityScheme` |
| `items.go` | `Items` (non-body parameter schema) |
| `ref.go` | `Ref` type, JSON Reference (`$ref`) handling |
| `expander.go` | `$ref` expansion / resolution engine |
| `normalizer.go` | URL/path normalization (platform-specific variants) |
| `cache.go` | Resolution cache for expanded specs |
| `validations.go` | Common validation properties shared across types |
| `properties.go` | `SchemaProperties` ordered map |
| `embed.go` | Embedded Swagger 2.0 JSON Schema (`go:embed`) |
| `spec.go` | `MustLoadSwagger20Schema()` loader |
| `external_docs.go` | `ExternalDocumentation` |
| `tag.go` | `Tag` |
| `xml_object.go` | `XMLObject` |
| `debug.go` | Debug logging helpers |

### Key API

- `Swagger` --- root specification object; deserialize with `json.Unmarshal`
- `Schema` --- JSON Schema with Swagger extensions; supports `allOf`, `$ref`, validations
- `Ref` / `MustCreateRef(uri)` --- JSON Reference wrapper
- `ExpandSpec(spec, opts)` --- resolve all `$ref` nodes in a specification
- `ExpandSchema(schema, root, cache)` --- resolve `$ref` nodes in a single schema
- `ResolveRef(root, ref)` / `ResolveParameter` / `ResolveResponse` --- targeted resolution

### Dependencies

- `github.com/go-openapi/jsonpointer` --- JSON Pointer (RFC 6901) navigation
- `github.com/go-openapi/jsonreference` --- JSON Reference parsing
- `github.com/go-openapi/swag` --- JSON/YAML utilities, name mangling
- `github.com/go-openapi/testify/v2` --- test-only assertions (zero-dep testify fork)

### Notable historical design decisions

- **Mixin of spec types and `$ref`** --- many types embed both their data fields and a `Ref`
field. When `$ref` is present, the data fields are ignored per the Swagger specification.
This is modeled by custom `MarshalJSON`/`UnmarshalJSON` on each type.
- **`VendorExtensible`** --- most types embed `VendorExtensible` to capture `x-` extension
fields as `map[string]any`.
- **`SchemaProperties` as ordered slice** --- schema properties are stored as a slice of
key-value pairs (not a map) to preserve declaration order during round-trip serialization.
- **Platform-specific normalization** --- Windows path handling differs from Unix; separate
`normalizer_windows.go` / `normalizer_nonwindows.go` files handle this.
52 changes: 52 additions & 0 deletions .claude/rules/contributions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
---
paths:
- "**/*"
---

# Contribution rules (go-openapi)

Read `.github/CONTRIBUTING.md` before opening a pull request.

## Commit hygiene

- Every commit **must** be DCO signed-off (`git commit -s`) with a real email address.
PGP-signed commits are appreciated but not required.
- Agents may be listed as co-authors (`Co-Authored-By:`) but the commit **author must be the human sponsor**.
We do not accept commits solely authored by bots or agents.
- Squash commits into logical units of work before requesting review (`git rebase -i`).

## Linting

Before pushing, verify your changes pass linting against the base branch:

```sh
golangci-lint run --new-from-rev master
```

Install the latest version if you don't have it:

```sh
go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@latest
```

## Problem statement

- Clearly describe the problem the PR solves, or reference an existing issue.
- PR descriptions must not be vague ("fix bug", "improve code") — explain *what* was wrong and *why* the change is correct.

## Tests are mandatory

- Every bug fix or feature **must** include tests that demonstrate the problem and verify the fix.
- The only exceptions are documentation changes and typo fixes.
- Aim for at least 80% coverage of your patch.
- Run the full test suite before submitting:

For mono-repos:
```sh
go test work ./...
```

For single module repos:
```sh
go test ./...
```
Loading