Skip to content
This repository was archived by the owner on Mar 16, 2025. It is now read-only.

Commit 353bd61

Browse files
committed
1 parent 254c603 commit 353bd61

File tree

5 files changed

+29
-1
lines changed

5 files changed

+29
-1
lines changed

src/main/kotlin/io/openapiprocessor/core/converter/SchemaInfo.kt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class SchemaInfo(
5353
* schema.
5454
*
5555
* The swagger parser (resolve option) creates schemas for intermediate $refs where the name is
56-
* based on the filename. This breaks code generation because the original/public name of the
56+
* based on the filename. It breaks code generation because the original/public name of the
5757
* schema is lost.
5858
*/
5959
private var refName: Boolean = false
@@ -219,6 +219,12 @@ class SchemaInfo(
219219
val pattern: String?
220220
get() = schema?.pattern
221221

222+
val readOnly: Boolean
223+
get() = schema?.readOnly ?: false
224+
225+
val writeOnly: Boolean
226+
get() = schema?.writeOnly ?: false
227+
222228
/**
223229
* iterate over properties
224230
*/

src/main/kotlin/io/openapiprocessor/core/parser/Schema.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,6 @@ interface Schema {
5858

5959
val pattern: String?
6060

61+
val readOnly: Boolean
62+
val writeOnly: Boolean
6163
}

src/main/kotlin/io/openapiprocessor/core/parser/openapi4j/Schema.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,4 +106,10 @@ class Schema(val schema: O4jSchema) : ParserSchema {
106106
override val pattern: String?
107107
get() = schema.pattern
108108

109+
override val readOnly: Boolean
110+
get() = schema.readOnly ?: false
111+
112+
override val writeOnly: Boolean
113+
get() = schema.writeOnly ?: false
114+
109115
}

src/main/kotlin/io/openapiprocessor/core/parser/swagger/Schema.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,5 +116,10 @@ class Schema(private val schema: SwaggerSchema<*>): ParserSchema {
116116
override val pattern: String?
117117
get() = schema.pattern
118118

119+
override val readOnly: Boolean
120+
get() = schema.readOnly ?: false
121+
122+
override val writeOnly: Boolean
123+
get() = schema.writeOnly ?: false
119124

120125
}

src/test/groovy/com/github/hauner/openapi/core/test/TestSchema.groovy

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,4 +70,13 @@ class TestSchema implements Schema {
7070
[]
7171
}
7272

73+
@Override
74+
boolean getReadOnly () {
75+
return false
76+
}
77+
78+
@Override
79+
boolean getWriteOnly () {
80+
return false
81+
}
7382
}

0 commit comments

Comments
 (0)