@@ -7,6 +7,7 @@ package io.openapiparser
77
88import io.kotest.core.spec.style.StringSpec
99import io.kotest.matchers.booleans.shouldBeTrue
10+ import io.kotest.matchers.collections.shouldContainExactly
1011import io.kotest.matchers.shouldBe
1112import io.openapiparser.support.ApiBuilder
1213import io.openapiparser.support.getParameters
@@ -29,6 +30,30 @@ class RefSpec: StringSpec({
2930 ref.properties[" bar" ]!!.type shouldBe " string"
3031 }
3132
33+ " parses ref into another file, v31" {
34+ val api = ApiBuilder ().buildOpenApi31("/ref/v3x/ref-into-another-file/openapi.yaml")
35+
36+ val schema = api.getResponseSchema("/foo", "200", "application/json")
37+ schema.ref shouldBe " foo.yaml#/Foo"
38+
39+ val ref = schema.refObject
40+ ref.type shouldContainExactly listOf("object")
41+ ref.properties.size shouldBe 1
42+ ref.properties[" bar" ]!!.type shouldContainExactly listOf("string")
43+ }
44+
45+ " parses ref into another file, v32" {
46+ val api = ApiBuilder ().buildOpenApi32("/ref/v3x/ref-into-another-file/openapi.yaml")
47+
48+ val schema = api.getResponseSchema("/foo", "200", "application/json")
49+ schema.ref shouldBe " foo.yaml#/Foo"
50+
51+ val ref = schema.refObject
52+ ref.type shouldContainExactly listOf("object")
53+ ref.properties.size shouldBe 1
54+ ref.properties[" bar" ]!!.type shouldContainExactly listOf("string")
55+ }
56+
3257 " parses ref array items with nested ref" {
3358 val api = ApiBuilder ()
3459 .buildOpenApi30("/v30/ref-array-items-nested/openapi.yaml")
0 commit comments