File tree Expand file tree Collapse file tree 3 files changed +4
-3
lines changed
commonMain/kotlin/community/flock/kotlinx/openapi/bindings Expand file tree Collapse file tree 3 files changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ import kotlinx.serialization.json.encodeToJsonElement
1111open class OpenAPIV2 (
1212 val json : Json = Json { prettyPrint = true },
1313) : OpenAPISpecification {
14+
1415 fun decodeFromString (string : String ): OpenAPIV2Model = json
1516 .decodeFromString<JsonObject >(string)
1617 .decode(V2 )
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ open class OpenAPIV3(
1212 val json : Json = Json { prettyPrint = true },
1313) : OpenAPISpecification {
1414
15- fun decodeFromJsonString (string : String ): OpenAPIV3Model = json
15+ fun decodeFromString (string : String ): OpenAPIV3Model = json
1616 .decodeFromString<JsonObject >(string)
1717 .decode(V3 )
1818 .let (json::decodeFromJsonElement)
Original file line number Diff line number Diff line change @@ -47,14 +47,14 @@ class OpenAPIV3Tests {
4747 fun `openapi v2 is not valid` () {
4848 val input = readFile(" petstore.json" , V2 )
4949 shouldThrow<IllegalStateException > {
50- OpenAPIV3 .decodeFromJsonString (input)
50+ OpenAPIV3 .decodeFromString (input)
5151 }.message shouldBe " No valid openapi v3 element 'openapi' is missing"
5252 }
5353
5454 private fun openAPIv3 (fileName : String ) {
5555 readFile(fileName, V3 ).let {
5656 it shouldEqualJson it
57- .let (OpenAPIV3 ::decodeFromJsonString )
57+ .let (OpenAPIV3 ::decodeFromString )
5858 .let (OpenAPIV3 ::encodeToString)
5959 }
6060 }
You can’t perform that action at this time.
0 commit comments