From d10a7254b0d7cedcb87c9f4a11815ccda05d5f4f Mon Sep 17 00:00:00 2001 From: Marcin Romaszewicz Date: Thu, 5 Feb 2026 11:37:33 -0800 Subject: [PATCH 1/2] Demonstrate problem with external ref skipping This is an example of where the fix for issue #519 fails. External references often have fragments after the external reference to pull in a specific schema. --- document_examples_test.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/document_examples_test.go b/document_examples_test.go index 33d89868..0a8ada6a 100644 --- a/document_examples_test.go +++ b/document_examples_test.go @@ -19,12 +19,13 @@ import ( "github.com/pb33f/libopenapi/index" "github.com/pb33f/libopenapi/orderedmap" + "github.com/stretchr/testify/assert" + "github.com/pb33f/libopenapi/datamodel/high" v3high "github.com/pb33f/libopenapi/datamodel/high/v3" low "github.com/pb33f/libopenapi/datamodel/low/base" v3 "github.com/pb33f/libopenapi/datamodel/low/v3" "github.com/pb33f/libopenapi/utils" - "github.com/stretchr/testify/assert" ) func ExampleNewDocument_fromOpenAPI3Document() { @@ -700,6 +701,8 @@ components: $ref: './models/product.yaml' customer: $ref: 'https://example.com/schemas/customer.yaml' + warehouse: + $ref: 'https://example.com/schemas/supplier.yaml#/components/schemas/Warehouse' required: - id - product From 86a6952f14334d3d4022fb05c0b461e324d8e6cb Mon Sep 17 00:00:00 2001 From: Marcin Romaszewicz Date: Thu, 5 Feb 2026 11:58:41 -0800 Subject: [PATCH 2/2] Fix tab/space issue --- document_examples_test.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/document_examples_test.go b/document_examples_test.go index 0a8ada6a..267e0e15 100644 --- a/document_examples_test.go +++ b/document_examples_test.go @@ -19,13 +19,12 @@ import ( "github.com/pb33f/libopenapi/index" "github.com/pb33f/libopenapi/orderedmap" - "github.com/stretchr/testify/assert" - "github.com/pb33f/libopenapi/datamodel/high" v3high "github.com/pb33f/libopenapi/datamodel/high/v3" low "github.com/pb33f/libopenapi/datamodel/low/base" v3 "github.com/pb33f/libopenapi/datamodel/low/v3" "github.com/pb33f/libopenapi/utils" + "github.com/stretchr/testify/assert" ) func ExampleNewDocument_fromOpenAPI3Document() { @@ -701,11 +700,12 @@ components: $ref: './models/product.yaml' customer: $ref: 'https://example.com/schemas/customer.yaml' - warehouse: - $ref: 'https://example.com/schemas/supplier.yaml#/components/schemas/Warehouse' + warehouse: + $ref: 'https://example.com/schemas/warehouse.yaml#/components/schemas/Warehouse' required: - id - product + - warehouse Pet: $ref: './models/pet.yaml' ErrorResponse: