|
5 | 5 |
|
6 | 6 | package io.openapiparser |
7 | 7 |
|
| 8 | +import io.kotest.assertions.throwables.shouldNotThrowAny |
8 | 9 | import io.kotest.core.spec.style.FreeSpec |
9 | 10 | import io.kotest.datatest.withData |
10 | 11 | import io.kotest.matchers.booleans.shouldBeFalse |
11 | 12 | import io.kotest.matchers.booleans.shouldBeTrue |
12 | 13 | import io.kotest.matchers.nulls.shouldNotBeNull |
13 | 14 | import io.kotest.matchers.shouldBe |
| 15 | +import io.openapiprocessor.jackson.JacksonConverter |
14 | 16 | import io.openapiprocessor.jsonschema.support.Types.asObject |
15 | 17 | import io.openapiprocessor.jsonschema.reader.UriReader |
16 | 18 | import io.openapiprocessor.jsonschema.schema.JsonPointer.from |
@@ -58,6 +60,38 @@ class OpenApiBundlerSpec : FreeSpec({ |
58 | 60 |
|
59 | 61 | data class Data(val api: String, val bundle: (result: ResolverResult) -> Bucket) |
60 | 62 |
|
| 63 | + "do not walk array on simple type" - { |
| 64 | + val context = Context(Scope.empty(), ReferenceRegistry()) |
| 65 | + |
| 66 | + val converter = JacksonConverter() |
| 67 | + val document = converter.convert(""" |
| 68 | + openapi: 3.0.2 |
| 69 | + info: |
| 70 | + title: do not walk tags |
| 71 | + version: 1.0.0 |
| 72 | + |
| 73 | + paths: |
| 74 | + /foo: |
| 75 | + get: |
| 76 | + tags: |
| 77 | + - a tag |
| 78 | + responses: |
| 79 | + '204': |
| 80 | + description: none |
| 81 | + """.trimIndent() |
| 82 | + ) |
| 83 | + |
| 84 | + val documents = DocumentStore() |
| 85 | + val scope = Scope.empty() |
| 86 | + documents.addId(scope.documentUri, document) |
| 87 | + |
| 88 | + val bucket = Bucket.createBucket(scope, document) |
| 89 | + |
| 90 | + shouldNotThrowAny { |
| 91 | + OpenApiBundler(context, documents, bucket!!).bundle() |
| 92 | + } |
| 93 | + } |
| 94 | + |
61 | 95 | withData( |
62 | 96 | mapOf( |
63 | 97 | $$"bundle handles $ref loop, 30" to Data("/bundle-ref-loop/openapi30.yaml", ::bundle30), |
|
0 commit comments