Skip to content

chore: sync with upstream/master#13

Closed
reuvenharrison wants to merge 29 commits intomasterfrom
sync/upstream-master
Closed

chore: sync with upstream/master#13
reuvenharrison wants to merge 29 commits intomasterfrom
sync/upstream-master

Conversation

@reuvenharrison
Copy link
Copy Markdown

Merges 3 commits from getkin/kin-openapi master that were already superseded by our OriginTree approach:

Conflicts resolved in our favor throughout.

🤖 Generated with Claude Code

reuvenharrison and others added 29 commits March 16, 2026 17:21
The origin-tracking YAML loader injects __origin__ as a key inside any
map-valued field to record source location. Typed Go maps
(map[string]*Encoding, map[string]*ServerVariable) treat __origin__ as
a real entry, causing false positive diffs when the same spec is loaded
from two different file paths (issue oasdiff/oasdiff#806).

Fix by deleting originKey from these maps after JSON unmarshaling,
mirroring the existing pattern for Extensions and the unmarshalStringMapP
helper already used by Content, Schemas, Headers, etc.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… types

Run docs.sh to regenerate .github/docs/openapi3.txt after the type
changes in encoding.go and server.go (map[string]*Encoding → Encodings,
map[string]*ServerVariable → ServerVariables). Add v0.135.0 breaking API
changes entries to README.md.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ping in sequence (getkin#808)

fix: prevent false positive diffs (getkin#806) and panic on empty mapping in sequence (getkin#808)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Allows consumers to depend on this fork directly without a replace
directive, fixing go install failures (oasdiff/oasdiff#810).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
fix: rename module path to github.com/oasdiff/kin-openapi
Merges upstream commits:
- openapi3: strip __origin__ from Encodings and ServerVariables maps (getkin#1132)
- fix: update yaml3 to prevent panic on empty mapping node in sequence (getkin#1133)

Both fixes were already present in oasdiff/kin-openapi; this merge aligns
the fork's git history with upstream to minimize divergence.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
stripOriginFromAny only recursed into map[string]any but not []any,
so __origin__ keys inside array elements (e.g. example values with
lists of objects) survived stripping and caused false positive diffs.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Picks up the fix that skips __origin__ entries during alias expansion,
preventing spurious "excessive aliasing" errors on large specs with
many YAML aliases (follow-up to oasdiff/oasdiff#821).

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
The alias/excessive-aliasing fix is in oasdiff/yaml3; no test is
needed at the kin-openapi level.

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
…d mappings

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
bump: yaml and yaml3 to v0.0.4
fix: strip `__origin__` from slices in example values
Extension values are map[string]any, so the YAML decoder injects
__origin__ into them. Without stripping it, two specs loaded from
different file paths produce different extension values, causing
spurious diffs. Call stripExtensionsOrigin after delete(Extensions,
originKey) in all 21 UnmarshalJSON implementations, including the
root T type.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
fix: strip __origin__ from extension values to prevent spurious diffs
…st race

The package-level IncludeOrigin global was set without cleanup in HTTP
handlers, permanently contaminating all subsequent requests on the same
process. Add Loader.IncludeOrigin as the safe per-loader alternative;
each unmarshal call ORs it with the global for backward compatibility.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replace originFromMap with originFromSeq to handle the new flat
sequence format: [key_name, key_line, key_col, nf, f1_name, f1_delta,
f1_col, ..., ns, s1_name, s1_count, ...]. File is now stored in
OriginTree rather than repeated per location.

Also extend the Value/Schema pass-through in applyOriginsToStruct to
cover AdditionalProperties.Schema (no json tag), and add toInt helper
for yaml int types (int vs uint64).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…arshalJSON

The compact __origin__ sequence now carries the file path at index 0.
Update originFromSeq to read file from s[0] (remove file parameter).

Add Origin.UnmarshalJSON so __origin__ can be parsed directly during
JSON decoding when the caller does not use UnmarshalWithOriginTree.

Also add float64 handling in toInt for JSON-decoded []any sequences.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
perf: compact __origin__ format — 4× faster loading for large specs
Picks up the integer-key OriginTree fix (HTTP response codes like 200)
and the compact __origin__ format with file path at index 0.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
chore: bump yaml to v0.0.7, yaml3 to v0.0.5
…okup

Sequence items now encode (value_str, delta, col); update parser to set
Location.Name from the value string so NewSourceFromSequenceItem can
match required/enum items by value.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
fix: sequence item Name + bump yaml3 v0.0.6
extractOrigins strips __origin__ before JSON marshaling, making the
following per-type calls in UnmarshalJSON unreachable:
- stripExtensionsOrigin(x.Extensions) — 21 call sites
- stripOriginFromAny(...) on any-typed fields (Schema.Enum/Default/Example,
  Link.RequestBody, Example.Value, MediaType.Example, Parameter.Example)
- if k == originKey { ... } blocks in maplike.go (Responses, Paths, Callback)
- popOrigin() in stringmap.go replaced with delete(m, originKey), then
  removed entirely since __origin__ never reaches these unmarshalers

Also adds origin tests: RequiredSequence, YAMLAlias, Headers,
IntegerStatusCode, Disabled, AnyFieldsStripped, MaplikeNoOriginKey,
WithExternalRef (uncommented assertions), and a bulk LoadAllTestdata
test that loads 26 specs with IncludeOrigin=true to catch regressions.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Upstream added stripExtensionsOrigin/stripOriginFromAny calls and bumped
yaml/yaml3 to v0.0.4; our OriginTree approach supersedes the explicit
stripping and our yaml versions are newer (v0.0.6/v0.0.7).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants