-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bump to K2, start implementing union name generation
- Loading branch information
Showing
22 changed files
with
748 additions
and
637 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
plugins { | ||
kotlin("multiplatform") version "1.9.23" apply false | ||
kotlin("multiplatform") version "2.0.0" apply false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
core/src/commonMain/kotlin/io/github/nomisrev/openapi/Components.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
214 changes: 107 additions & 107 deletions
214
core/src/jvmTest/kotlin/io/github/nomisrev/openapi/OpenAPISerializerEnd2EndTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,107 +1,107 @@ | ||
package io.github.nomisrev.openapi | ||
|
||
import io.github.nomisrev.openapi.OpenAPI.Companion.Json | ||
import java.io.BufferedReader | ||
import kotlin.test.Ignore | ||
import kotlin.test.Test | ||
import kotlin.test.assertEquals | ||
|
||
class OpenAPISerializerEnd2EndTest { | ||
|
||
fun resourceText(path: String): String = | ||
requireNotNull( | ||
OpenAPISerializerEnd2EndTest::class.java.classLoader | ||
.getResourceAsStream(path) | ||
?.bufferedReader() | ||
?.use(BufferedReader::readText) | ||
) { "Resource not found: $path" } | ||
|
||
@Test | ||
fun petstoreJson() { | ||
Json.decodeFromString( | ||
OpenAPI.serializer(), | ||
resourceText("petstore.json"), | ||
) | ||
} | ||
|
||
@Test | ||
// TODO Has default response, without default key?? | ||
@Ignore | ||
fun petstoreJsonIsomorphic() { | ||
val openAPI = Json.decodeFromString( | ||
OpenAPI.serializer(), | ||
resourceText("petstore.json"), | ||
) | ||
val json = Json.encodeToString(OpenAPI.serializer(), openAPI) | ||
assertEquals( | ||
openAPI, | ||
Json.decodeFromString(OpenAPI.serializer(), json) | ||
) | ||
} | ||
|
||
@Test | ||
fun petStoreMore() { | ||
Json.decodeFromString( | ||
OpenAPI.serializer(), | ||
resourceText("petstore_more.json"), | ||
) | ||
} | ||
|
||
@Test | ||
fun issue1801() { | ||
Json.decodeFromString( | ||
OpenAPI.serializer(), | ||
resourceText("issue-1801.json"), | ||
) | ||
} | ||
|
||
@Test | ||
@Ignore | ||
// TODO check https://github.com/swagger-api/swagger-parser/issues/1821 | ||
fun issue1821() { | ||
Json.decodeFromString( | ||
OpenAPI.serializer(), | ||
resourceText("issue-1821.json"), | ||
) | ||
} | ||
|
||
@Test | ||
fun issue1975() { | ||
Json.decodeFromString( | ||
OpenAPI.serializer(), | ||
resourceText("issue-1975.json"), | ||
) | ||
} | ||
|
||
@Test | ||
fun oas31() { | ||
Json.decodeFromString( | ||
OpenAPI.serializer(), | ||
resourceText("oas_3_1_0.json"), | ||
) | ||
} | ||
|
||
@Test | ||
fun basic() { | ||
Json.decodeFromString( | ||
OpenAPI.serializer(), | ||
resourceText("basic.json"), | ||
) | ||
} | ||
|
||
@Test | ||
fun schemaSiblings() { | ||
Json.decodeFromString( | ||
OpenAPI.serializer(), | ||
resourceText("schemaSiblings.json"), | ||
) | ||
} | ||
|
||
@Test | ||
fun securitySchemes() { | ||
Json.decodeFromString( | ||
OpenAPI.serializer(), | ||
resourceText("securitySchemes_3_1_0.json"), | ||
) | ||
} | ||
} | ||
//package io.github.nomisrev.openapi | ||
// | ||
//import io.github.nomisrev.openapi.OpenAPI.Companion.Json | ||
//import java.io.BufferedReader | ||
//import kotlin.test.Ignore | ||
//import kotlin.test.Test | ||
//import kotlin.test.assertEquals | ||
// | ||
//class OpenAPISerializerEnd2EndTest { | ||
// | ||
// fun resourceText(path: String): String = | ||
// requireNotNull( | ||
// OpenAPISerializerEnd2EndTest::class.java.classLoader | ||
// .getResourceAsStream(path) | ||
// ?.bufferedReader() | ||
// ?.use(BufferedReader::readText) | ||
// ) { "Resource not found: $path" } | ||
// | ||
// @Test | ||
// fun petstoreJson() { | ||
// Json.decodeFromString( | ||
// OpenAPI.serializer(), | ||
// resourceText("petstore.json"), | ||
// ) | ||
// } | ||
// | ||
// @Test | ||
// // TODO Has default response, without default key?? | ||
// @Ignore | ||
// fun petstoreJsonIsomorphic() { | ||
// val openAPI = Json.decodeFromString( | ||
// OpenAPI.serializer(), | ||
// resourceText("petstore.json"), | ||
// ) | ||
// val json = Json.encodeToString(OpenAPI.serializer(), openAPI) | ||
// assertEquals( | ||
// openAPI, | ||
// Json.decodeFromString(OpenAPI.serializer(), json) | ||
// ) | ||
// } | ||
// | ||
// @Test | ||
// fun petStoreMore() { | ||
// Json.decodeFromString( | ||
// OpenAPI.serializer(), | ||
// resourceText("petstore_more.json"), | ||
// ) | ||
// } | ||
// | ||
// @Test | ||
// fun issue1801() { | ||
// Json.decodeFromString( | ||
// OpenAPI.serializer(), | ||
// resourceText("issue-1801.json"), | ||
// ) | ||
// } | ||
// | ||
// @Test | ||
// @Ignore | ||
// // TODO check https://github.com/swagger-api/swagger-parser/issues/1821 | ||
// fun issue1821() { | ||
// Json.decodeFromString( | ||
// OpenAPI.serializer(), | ||
// resourceText("issue-1821.json"), | ||
// ) | ||
// } | ||
// | ||
// @Test | ||
// fun issue1975() { | ||
// Json.decodeFromString( | ||
// OpenAPI.serializer(), | ||
// resourceText("issue-1975.json"), | ||
// ) | ||
// } | ||
// | ||
// @Test | ||
// fun oas31() { | ||
// Json.decodeFromString( | ||
// OpenAPI.serializer(), | ||
// resourceText("oas_3_1_0.json"), | ||
// ) | ||
// } | ||
// | ||
// @Test | ||
// fun basic() { | ||
// Json.decodeFromString( | ||
// OpenAPI.serializer(), | ||
// resourceText("basic.json"), | ||
// ) | ||
// } | ||
// | ||
// @Test | ||
// fun schemaSiblings() { | ||
// Json.decodeFromString( | ||
// OpenAPI.serializer(), | ||
// resourceText("schemaSiblings.json"), | ||
// ) | ||
// } | ||
// | ||
// @Test | ||
// fun securitySchemes() { | ||
// Json.decodeFromString( | ||
// OpenAPI.serializer(), | ||
// resourceText("securitySchemes_3_1_0.json"), | ||
// ) | ||
// } | ||
//} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.