nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: platers/obsidian-linter
Pull request #678 (2023-04-08 20:27:48)

Fix Erroneous Empty Line Added to Math Block End in Callout/Blockquote
Relates to #597 

Changes Made:
- Added a test for a scenario I found where a blank line was always being added for a blockqupte/callout that had a math block in it
- Updated the logic in the ending math block check to make sure that if math block is in a blockquote/callout then it should only add a blank line if the start of the ending line is not just the blockquote indicators and then the math block indicators


Patch:
diff --git a/src/utils/mdast.ts b/src/utils/mdast.ts
index d1af02d..c09e948 100644
--- a/src/utils/mdast.ts
+++ b/src/utils/mdast.ts
@@ -717,6 +717,8 @@ export function makeSureMathBlockIndicatorsAreOnTheirOwnLines(text: string, numb
 
 function addBlankLinesAroundStartAndStopMathIndicators(text: string, mathBlockStartIndex: number, mathBlockEndIndex: number, mathOpeningIndicatorRegex: RegExp, mathEndingIndicatorRegex: RegExp): string {
   const startOfLine = text.substring(getStartOfLineIndex(text, mathBlockStartIndex), mathBlockStartIndex) ?? '';
+  const startOfEndingLine = text.substring(getStartOfLineIndex(text, mathBlockEndIndex), mathBlockEndIndex) ?? '';
+  const emptyLineBlockquoteRegex = /^(>( |\t)*)+\$+$/m;
   let mathBlock = text.substring(mathBlockStartIndex, mathBlockEndIndex);
   mathBlock = mathBlock.replace(mathOpeningIndicatorRegex, (_: string, $1: string, $2: string = '') => {
     // a new line is being added
@@ -726,9 +728,13 @@ function addBlankLinesAroundStartAndStopMathIndicators(text: string, mathBlockSt
 
     return $1 + '\n';
   });
-  mathBlock= mathBlock.replace(mathEndingIndicatorRegex, (_: string, $1: string = '', $2: string, $3: string) => {
-    // a new line is being added
-    if ($1 === '') {
+  mathBlock= mathBlock.replace(mathEndingIndicatorRegex, (match: string, $1: string = '', $2: string, $3: string) => {
+    const groupOneIsEmpty = $1 === '';
+
+    // make sure that a blank blockquote line is checked for in order to determine if a change needs to happen just for blockquotes
+    if (groupOneIsEmpty && emptyLineBlockquoteRegex.test(startOfEndingLine.trim())) {
+      return match;
+    } else if (groupOneIsEmpty) { // a new line is being added
       return '\n' + startOfLine + $2 + $3;
     }
 


Test patch:
diff --git a/__tests__/move-math-block-indicators-to-own-line.test.ts b/__tests__/move-math-block-indicators-to-own-line.test.ts
index 2240113..71bc8fe 100644
--- a/__tests__/move-math-block-indicators-to-own-line.test.ts
+++ b/__tests__/move-math-block-indicators-to-own-line.test.ts
@@ -44,6 +44,20 @@ ruleTest({
         text here
       `,
     },
-
+    { // accounts for an issue noticed when looking at https://github.com/platers/obsidian-linter/issues/597
+      testName: 'Math block in blockquote/callout should not get an empty blockquote line added',
+      before: dedent`
+        > [!note]
+        > $$
+        > \\frac{1}{2}
+        > $$
+      `,
+      after: dedent`
+        > [!note]
+        > $$
+        > \\frac{1}{2}
+        > $$
+      `,
+    },
   ],
 });
Repository: hamba/avro
Pull request #313 (2023-10-02 13:21:15)

Allow tag style "original" for additional tags
Some edge cases require using the tag style from avro as-is for other formats.
The tag style `original` explicitly does not do any processing on the tag before code generation.

This is mostly already supported in the code generation, but the CLI options would reject
any configuration value which would trigger this behaviour.


Patch:
diff --git a/cmd/avrogen/main.go b/cmd/avrogen/main.go
index c89f2d9..3d4cbe8 100644
--- a/cmd/avrogen/main.go
+++ b/cmd/avrogen/main.go
@@ -146,6 +146,8 @@ func parseTags(raw string) (map[string]gen.TagStyle, error) {
 			style = gen.Kebab
 		case string(gen.Snake):
 			style = gen.Snake
+		case string(gen.Original):
+			style = gen.Original
 		default:
 			return nil, fmt.Errorf("style %q is invalid in %q", parts[1], tag)
 		}
diff --git a/gen/gen.go b/gen/gen.go
index b57d495..5d8c081 100644
--- a/gen/gen.go
+++ b/gen/gen.go
@@ -27,6 +27,8 @@ type Config struct {
 type TagStyle string
 
 const (
+	// Original is a style like whAtEVer_IS_InthEInpuT.
+	Original TagStyle = "original"
 	// Snake is a style like im_written_in_snake_case.
 	Snake TagStyle = "snake"
 	// Camel is a style like imWrittenInCamelCase.
@@ -355,6 +357,8 @@ func formatTag(tag string, style TagStyle) string {
 		return strcase.ToCamel(tag)
 	case Snake:
 		return strcase.ToSnake(tag)
+	case Original:
+		fallthrough
 	default:
 		return tag
 	}


Test patch:
diff --git a/cmd/avrogen/main_test.go b/cmd/avrogen/main_test.go
index 97eb97d..dc6a5b6 100644
--- a/cmd/avrogen/main_test.go
+++ b/cmd/avrogen/main_test.go
@@ -164,6 +164,10 @@ func TestParseTags(t *testing.T) {
 			name: "kebab case",
 			tags: "json:kebab",
 		},
+		{
+			name: "original case",
+			tags: "json:original",
+		},
 	}
 
 	for _, test := range tests {
diff --git a/gen/gen_test.go b/gen/gen_test.go
index 2399880..6dd4411 100644
--- a/gen/gen_test.go
+++ b/gen/gen_test.go
@@ -98,7 +98,7 @@ func TestStruct_ConfigurableFieldTags(t *testing.T) {
   "type": "record",
   "name": "test",
   "fields": [
-    { "name": "someString", "type": "string" }
+    { "name": "someSTRING", "type": "string" }
   ]
 }`
 
@@ -110,7 +110,8 @@ func TestStruct_ConfigurableFieldTags(t *testing.T) {
 		{tagStyle: gen.Snake, expectedTag: "json:\"some_string\""},
 		{tagStyle: gen.Kebab, expectedTag: "json:\"some-string\""},
 		{tagStyle: gen.UpperCamel, expectedTag: "json:\"SomeString\""},
-		{tagStyle: gen.TagStyle(""), expectedTag: "json:\"someString\""},
+		{tagStyle: gen.Original, expectedTag: "json:\"someSTRING\""},
+		{tagStyle: gen.TagStyle(""), expectedTag: "json:\"someSTRING\""},
 	}
 
 	for _, test := range tests {
@@ -127,7 +128,7 @@ func TestStruct_ConfigurableFieldTags(t *testing.T) {
 			for _, expected := range []string{
 				"package something",
 				"type Test struct {",
-				"SomeString string `avro:\"someString\" " + test.expectedTag + "`",
+				"SomeString string `avro:\"someSTRING\" " + test.expectedTag + "`",
 				"}",
 			} {
 				assert.Contains(t, lines, expected)
Repository: hamba/avro
Pull request #315 (2023-10-20 13:42:10)

Added Types methods to Protocol
Added method `Types` to return Protocol `Types`.
Added method `OriginalString` to return Protocol original schema

EliaBracciSumo: @nrwiersma thank you for your review 🙏 
However, I would like to add also another field in Protocol struct.

I called it `OriginalString` but we can change it. The intent is to save the string of the protocol as is, using its non-canonical form. WDYT?

I need this to generate Protocol hash
nrwiersma: You can open an issue or discussion about `OriginalString`.

Patch:
diff --git a/protocol.go b/protocol.go
index cba1997..28608eb 100644
--- a/protocol.go
+++ b/protocol.go
@@ -97,6 +97,11 @@ func (p *Protocol) Hash() string {
 	return p.hash
 }
 
+// Types returns the types of the protocol.
+func (p *Protocol) Types() []NamedSchema {
+	return p.types
+}
+
 // String returns the canonical form of the protocol.
 func (p *Protocol) String() string {
 	types := ""


Test patch:
diff --git a/protocol_test.go b/protocol_test.go
index c9cc0a3..4eb2b97 100644
--- a/protocol_test.go
+++ b/protocol_test.go
@@ -190,3 +190,17 @@ func TestParseProtocolFile_InvalidPath(t *testing.T) {
 
 	assert.Error(t, err)
 }
+
+func TestParseProtocol_Types(t *testing.T) {
+	protocol, err := avro.ParseProtocolFile("testdata/echo.avpr")
+
+	wantPing := `{"name":"org.hamba.avro.Ping","type":"record","fields":[{"name":"timestamp","type":"long"},{"name":"text","type":"string"}]}`
+	wantPong := `{"name":"org.hamba.avro.Pong","type":"record","fields":[{"name":"timestamp","type":"long"},{"name":"ping","type":"org.hamba.avro.Ping"}]}`
+	wantPongError := `{"name":"org.hamba.avro.PongError","type":"error","fields":[{"name":"timestamp","type":"long"},{"name":"reason","type":"string"}]}`
+	wantLen := 3
+	require.NoError(t, err)
+	assert.Equal(t, wantLen, len(protocol.Types()))
+	assert.Equal(t, wantPing, protocol.Types()[0].String())
+	assert.Equal(t, wantPong, protocol.Types()[1].String())
+	assert.Equal(t, wantPongError, protocol.Types()[2].String())
+}
Repository: hamba/avro
Pull request #358 (2024-03-08 19:06:09)

Fix: Union reader schema resolution
In the Union reader case, we check that the writer schema is compatible with at least one reader schema and resolve the composite schema against the first compatible found one.

We may pass through some incompatible schemas first; we need to explicitly check compatibility for each iteration by calling the `compatible` function (or `Resolve` instead of `resolve`).

The `compatible` function does cache its results, and the added calls will likely hit the cache, so I'm optimistic about the performance :) 

nrwiersma: So I completely understand the issue, We know one of them is a match because of the initial `compatible` but we are assume the first one as `resolve` is not returning an error. In an edge case this is in fact the wrong one "chosen" by `compatible`. Is that correct?

Patch:
diff --git a/schema_compatibility.go b/schema_compatibility.go
index 3ba7948..864a52f 100644
--- a/schema_compatibility.go
+++ b/schema_compatibility.go
@@ -292,6 +292,11 @@ func (c *SchemaCompatibility) resolve(reader, writer Schema) (schema Schema, res
 	if writer.Type() != reader.Type() {
 		if reader.Type() == Union {
 			for _, schema := range reader.(*UnionSchema).Types() {
+				// Compatibility is not guaranteed for every Union reader schema.
+				// Therefore, we need to check compatibility in every iteration.
+				if err := c.compatible(schema, writer); err != nil {
+					continue
+				}
 				sch, _, err := c.resolve(schema, writer)
 				if err != nil {
 					continue


Test patch:
diff --git a/schema_compatibility_test.go b/schema_compatibility_test.go
index 3a9b93e..a570db7 100644
--- a/schema_compatibility_test.go
+++ b/schema_compatibility_test.go
@@ -862,3 +862,44 @@ func TestSchemaCompatibility_ResolveWithRefs(t *testing.T) {
 	want := map[string]any{"a": "foo"}
 	assert.Equal(t, want, result)
 }
+
+func TestSchemaCompatibility_ResolveWithComplexUnion(t *testing.T) {
+	r := avro.MustParse(`[
+				{
+					"type":"record",
+					"name":"testA",
+					"aliases": ["test1"], 
+					"namespace": "org.hamba.avro", 
+					"fields":[{"name": "a", "type": "long"}]
+				},
+				{
+					"type":"record",
+					"name":"testB",
+					"aliases": ["test2"], 
+					"namespace": "org.hamba.avro", 
+					"fields":[{"name": "b", "type": "bytes"}]
+				}
+			]`)
+
+	w := avro.MustParse(`{
+				"type":"record",
+				"name":"test2",
+				"namespace": "org.hamba.avro", 
+				"fields":[{"name": "b", "type": "string"}]
+			}`)
+
+	value := map[string]any{"b": "foo"}
+	b, err := avro.Marshal(w, value)
+	assert.NoError(t, err)
+
+	sc := avro.NewSchemaCompatibility()
+	sch, err := sc.Resolve(r, w)
+	assert.NoError(t, err)
+
+	var result any
+	err = avro.Unmarshal(sch, b, &result)
+	assert.NoError(t, err)
+
+	want := map[string]any{"b": []byte("foo")}
+	assert.Equal(t, want, result)
+}
Repository: hamba/avro
Pull request #374 (2024-04-20 00:32:02)

Check for max allocation
Issue: https://github.com/hamba/avro/issues/373

This PR checks to see if the `size` to allocate the array exceeds the max allocation size. This prevents getting `panic: runtime: allocation size out of range` when decoding arrays with an invalid size.

This is the code to reproduce the error before the fix:
```
package main

import "github.com/hamba/avro/v2"

func main() {
	rawSchema := []byte("{\"items\":{\"type\":\"boolean\"},\"type\":\"array\"}")

	schema, _ := avro.ParseBytes(rawSchema)

	data := []byte("\x02\x00\xe9\xe9\xe9\xe9\xe9\xe9\xe9\xe9\x00")
	var container any
	avro.Unmarshal(schema, data, &container)
}
```

This is the [line of code](https://github.com/hamba/avro/blob/7a2eb5fdc5a4c5abf9712c0e12c3806691f866d5/codec_array.go#L54) that leads to the error. The size is 29787588086545014 while the maxAlloc size is 281474976710656 (const maxAlloc untyped int = (1 << heapAddrBits) - (1-_64bit)*1)


Patch:
diff --git a/codec_array.go b/codec_array.go
index 658ae58..3dd82fe 100644
--- a/codec_array.go
+++ b/codec_array.go
@@ -39,6 +39,10 @@ type arrayDecoder struct {
 	decoder ValDecoder
 }
 
+// Max allocation size for an array due to the limit in number of bits in a heap address:
+// https://github.com/golang/go/blob/7f76c00fc5678fa782708ba8fece63750cb89d03/src/runtime/malloc.go#L183
+var maxAllocSize = uint64(1 << 48)
+
 func (d *arrayDecoder) Decode(ptr unsafe.Pointer, r *Reader) {
 	var size int
 	sliceType := d.typ
@@ -51,6 +55,10 @@ func (d *arrayDecoder) Decode(ptr unsafe.Pointer, r *Reader) {
 
 		start := size
 		size += int(l)
+		if size > int(maxAllocSize) {
+			r.ReportError("decode array", "size exceeded max allocation size")
+			return
+		}
 		sliceType.UnsafeGrow(ptr, size)
 
 		for i := start; i < size; i++ {


Test patch:
diff --git a/decoder_array_test.go b/decoder_array_test.go
index 57107ba..f50ec3b 100644
--- a/decoder_array_test.go
+++ b/decoder_array_test.go
@@ -78,3 +78,16 @@ func TestDecoder_ArraySliceItemError(t *testing.T) {
 
 	assert.Error(t, err)
 }
+
+func TestDecoder_ArrayMaxAllocationError(t *testing.T) {
+	defer ConfigTeardown()
+	data := []byte{0x2, 0x0, 0xe9, 0xe9, 0xe9, 0xe9, 0xe9, 0xe9, 0xe9, 0xe9, 0x0}
+	schema := `{"type":"array", "items": { "type": "boolean" }}`
+	dec, err := avro.NewDecoder(schema, bytes.NewReader(data))
+	require.NoError(t, err)
+
+	var got []bool
+	err = dec.Decode(&got)
+
+	assert.Error(t, err)
+}
Repository: hamba/avro
Pull request #383 (2024-04-23 05:42:51)

fix: readByte returns errors on unexpected EOF
This ensures that readByte (unexpected EOF) returns errors properly in the reader.


Patch:
diff --git a/reader.go b/reader.go
index 80cdb55..6eabb09 100644
--- a/reader.go
+++ b/reader.go
@@ -99,6 +99,7 @@ func (r *Reader) loadMore() bool {
 func (r *Reader) readByte() byte {
 	if r.head == r.tail {
 		if !r.loadMore() {
+			r.Error = io.ErrUnexpectedEOF
 			return 0
 		}
 	}


Test patch:
diff --git a/decoder_native_test.go b/decoder_native_test.go
index ce6dbf9..2e538f1 100644
--- a/decoder_native_test.go
+++ b/decoder_native_test.go
@@ -54,6 +54,20 @@ func TestDecoder_BoolInvalidSchema(t *testing.T) {
 	assert.Error(t, err)
 }
 
+func TestDecoder_BoolEof(t *testing.T) {
+	defer ConfigTeardown()
+
+	data := []byte{0x4}
+	schema := `{"fields":[{"name":"B","type":{"type":"int"}},{"name":"A","type":{"type":"boolean"}}],"name":"foo","type":"record"}`
+	dec, err := avro.NewDecoder(schema, bytes.NewReader(data))
+	require.NoError(t, err)
+
+	var b any
+	err = dec.Decode(&b)
+
+	assert.Error(t, err)
+}
+
 func TestDecoder_Int(t *testing.T) {
 	defer ConfigTeardown()
Repository: hamba/avro
Pull request #385 (2024-04-23 19:13:42)

fix: reader int/long setting head > tail
This fixes an issue that occurs when ReadInt/Long encounter an error across a buffer boundary, causing `r.head` to be greater than `r.tail`.


Patch:
diff --git a/reader.go b/reader.go
index 6eabb09..f2b74aa 100644
--- a/reader.go
+++ b/reader.go
@@ -171,20 +171,22 @@ func (r *Reader) ReadInt() int32 {
 		}
 
 		// Consume what it is in the buffer.
-		for i, b := range r.buf[r.head:tail] {
+		var i int
+		for _, b := range r.buf[r.head:tail] {
 			v |= uint32(b&0x7f) << s
 			if b&0x80 == 0 {
 				r.head += i + 1
 				return int32((v >> 1) ^ -(v & 1))
 			}
 			s += 7
-			n++
+			i++
 		}
 		if n >= maxIntBufSize {
 			r.ReportError("ReadInt", "int overflow")
 			return 0
 		}
-		r.head += n
+		r.head += i
+		n += i
 
 		// We ran out of buffer and are not at the end of the int,
 		// Read more into the buffer.
@@ -216,20 +218,22 @@ func (r *Reader) ReadLong() int64 {
 		}
 
 		// Consume what it is in the buffer.
-		for i, b := range r.buf[r.head:tail] {
+		var i int
+		for _, b := range r.buf[r.head:tail] {
 			v |= uint64(b&0x7f) << s
 			if b&0x80 == 0 {
 				r.head += i + 1
 				return int64((v >> 1) ^ -(v & 1))
 			}
 			s += 7
-			n++
+			i++
 		}
 		if n >= maxLongBufSize {
 			r.ReportError("ReadLong", "int overflow")
 			return 0
 		}
-		r.head += n
+		r.head += i
+		n += i
 
 		// We ran out of buffer and are not at the end of the long,
 		// Read more into the buffer.


Test patch:
diff --git a/reader_test.go b/reader_test.go
index b976021..6d318c9 100644
--- a/reader_test.go
+++ b/reader_test.go
@@ -254,6 +254,18 @@ func TestReader_ReadInt(t *testing.T) {
 	}
 }
 
+func TestReader_ReadIntShortReadAcrossBuffer(t *testing.T) {
+	data := []byte{0xe2, 0xa2, 0xf3, 0xad}
+	r := avro.NewReader(bytes.NewReader(data), 3)
+
+	_ = r.ReadInt()
+
+	assert.NotPanics(t, func() {
+		b := make([]byte, 3)
+		r.Read(b)
+	})
+}
+
 func TestReader_ReadLong(t *testing.T) {
 	tests := []struct {
 		name    string
@@ -359,6 +371,18 @@ func TestReader_ReadLong(t *testing.T) {
 	}
 }
 
+func TestReader_ReadLongShortReadAcrossBuffer(t *testing.T) {
+	data := []byte{0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}
+	r := avro.NewReader(bytes.NewReader(data), 8)
+
+	_ = r.ReadLong()
+
+	assert.NotPanics(t, func() {
+		b := make([]byte, 3)
+		r.Read(b)
+	})
+}
+
 func TestReader_ReadFloat(t *testing.T) {
 	tests := []struct {
 		data    []byte
Repository: hamba/avro
Pull request #387 (2024-04-26 20:18:38)

fix: Union Decoder uses readInt
According to the [Avro spec](https://avro.apache.org/docs/1.11.1/specification/#unions-1) for binary encoding of Union types, a union is encoded by first writing an int value.

<img width="786" alt="Screenshot 2024-04-26 at 4 17 54 PM" src="https://github.com/hamba/avro/assets/47339399/47f6cfad-204a-42c0-af59-39ffc64ba3ba">

However, the current decoder uses `ReadLong` instead of `ReadInt`, which causes some errors when `ReadInt` and `ReadFloat` returns different values.

nrwiersma: This seems to have changed in v1.10 of the spec. Could you also update the encoders?

Patch:
diff --git a/codec_union.go b/codec_union.go
index 9e3649a..b6fd192 100644
--- a/codec_union.go
+++ b/codec_union.go
@@ -152,7 +152,7 @@ func (e *mapUnionEncoder) Encode(ptr unsafe.Pointer, w *Writer) {
 		return
 	}
 
-	w.WriteLong(int64(pos))
+	w.WriteInt(int32(pos))
 
 	if schema.Type() == Null && val == nil {
 		return
@@ -259,8 +259,8 @@ func encoderOfNullableUnion(cfg *frozenConfig, schema Schema, typ reflect2.Type)
 		schema:  union,
 		encoder: encoder,
 		isPtr:   isPtr,
-		nullIdx: int64(nullIdx),
-		typeIdx: int64(typeIdx),
+		nullIdx: int32(nullIdx),
+		typeIdx: int32(typeIdx),
 	}
 }
 
@@ -268,17 +268,17 @@ type unionNullableEncoder struct {
 	schema  *UnionSchema
 	encoder ValEncoder
 	isPtr   bool
-	nullIdx int64
-	typeIdx int64
+	nullIdx int32
+	typeIdx int32
 }
 
 func (e *unionNullableEncoder) Encode(ptr unsafe.Pointer, w *Writer) {
 	if *((*unsafe.Pointer)(ptr)) == nil {
-		w.WriteLong(e.nullIdx)
+		w.WriteInt(e.nullIdx)
 		return
 	}
 
-	w.WriteLong(e.typeIdx)
+	w.WriteInt(e.typeIdx)
 	newPtr := ptr
 	if e.isPtr {
 		newPtr = *((*unsafe.Pointer)(ptr))
@@ -445,7 +445,7 @@ type unionResolverEncoder struct {
 }
 
 func (e *unionResolverEncoder) Encode(ptr unsafe.Pointer, w *Writer) {
-	w.WriteLong(int64(e.pos))
+	w.WriteInt(int32(e.pos))
 
 	e.encoder.Encode(ptr, w)
 }
@@ -453,7 +453,7 @@ func (e *unionResolverEncoder) Encode(ptr unsafe.Pointer, w *Writer) {
 func getUnionSchema(schema *UnionSchema, r *Reader) (int, Schema) {
 	types := schema.Types()
 
-	idx := int(r.ReadLong())
+	idx := int(r.ReadInt())
 	if idx < 0 || idx > len(types)-1 {
 		r.ReportError("decode union type", "unknown union type")
 		return 0, nil


Test patch:
diff --git a/codec_generic_internal_test.go b/codec_generic_internal_test.go
index 98a5855..a55f26b 100644
--- a/codec_generic_internal_test.go
+++ b/codec_generic_internal_test.go
@@ -173,6 +173,14 @@ func TestGenericDecode(t *testing.T) {
 			want:    map[string]any{"string": "foo"},
 			wantErr: require.NoError,
 		},
+		{
+			name: "Union Zero Index",
+			// 0x80 represents 128. So the bytes below will result in 0
+			// as a result of zig-zag encoding.
+			data:    []byte{0x80, 0x80, 0x80, 0x80, 0x30},
+			schema:  `["null"]`,
+			wantErr: require.NoError,
+		},
 		{
 			name:    "Union Nil",
 			data:    []byte{0x00},
Repository: hamba/avro
Pull request #404 (2024-05-18 17:32:56)

issue_403
Fixes https://github.com/hamba/avro/issues/403

timmyb32r: hm, maybe need to change test. I will check

Patch:
diff --git a/schema_compatibility.go b/schema_compatibility.go
index 864a52f..0b1d9ac 100644
--- a/schema_compatibility.go
+++ b/schema_compatibility.go
@@ -179,7 +179,7 @@ func (c *SchemaCompatibility) match(reader, writer Schema) error {
 }
 
 func (c *SchemaCompatibility) checkSchemaName(reader, writer NamedSchema) error {
-	if reader.FullName() != writer.FullName() {
+	if reader.Name() != writer.Name() {
 		if c.contains(reader.Aliases(), writer.FullName()) {
 			return nil
 		}


Test patch:
diff --git a/schema_compatibility_test.go b/schema_compatibility_test.go
index 73a6670..5ffae6e 100644
--- a/schema_compatibility_test.go
+++ b/schema_compatibility_test.go
@@ -239,6 +239,12 @@ func TestSchemaCompatibility_Compatible(t *testing.T) {
 			writer:  `{"type":"record", "name":"test", "namespace": "org.hamba.avro", "fields":[{"name": "a", "type": "test"}]}`,
 			wantErr: assert.NoError,
 		},
+		{
+			name:    "Comparison with different namespaces",
+			writer:  `{"type":"record", "name":"Obj", "namespace": "ns", "fields":[{"name": "a", "type": "int"}]}`,
+			reader:  `{"type":"record", "name":"Obj", "fields":[{"name": "a", "type": "int"}]}`,
+			wantErr: assert.NoError,
+		},
 	}
 
 	for _, test := range tests {