Skip to content

Commit

Permalink
fix(kotlin): properly generate ByteArray property
Browse files Browse the repository at this point in the history
this removes an incorrect wrapper around bytearray
properties.

Fixes N/A
  • Loading branch information
codymikol committed Jun 1, 2022
1 parent 1b1e652 commit 1e2f428
Show file tree
Hide file tree
Showing 3 changed files with 116 additions and 0 deletions.
@@ -0,0 +1,34 @@
/*
*
* * Copyright 2019-2022 the original author or authors.
* *
* * Licensed under the Apache License, Version 2.0 (the "License");
* * you may not use this file except in compliance with the License.
* * You may obtain a copy of the License at
* *
* * https://www.apache.org/licenses/LICENSE-2.0
* *
* * Unless required by applicable law or agreed to in writing, software
* * distributed under the License is distributed on an "AS IS" BASIS,
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* * See the License for the specific language governing permissions and
* * limitations under the License.
*
*/

package test.org.springdoc.api.app6

import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController

data class Foo(val data: ByteArray)

@RestController
@RequestMapping("/test")
class ByteArrayTestController {

@GetMapping("/")
fun foo(): Foo = Foo(byteArrayOf(0))

}
@@ -0,0 +1,31 @@
/*
*
* * Copyright 2019-2020 the original author or authors.
* *
* * Licensed under the Apache License, Version 2.0 (the "License");
* * you may not use this file except in compliance with the License.
* * You may obtain a copy of the License at
* *
* * https://www.apache.org/licenses/LICENSE-2.0
* *
* * Unless required by applicable law or agreed to in writing, software
* * distributed under the License is distributed on an "AS IS" BASIS,
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* * See the License for the specific language governing permissions and
* * limitations under the License.
*
*/

package test.org.springdoc.api.app5

import org.springframework.boot.autoconfigure.SpringBootApplication
import org.springframework.context.annotation.ComponentScan
import test.org.springdoc.api.AbstractKotlinSpringDocTest

class SpringDocApp6Test : AbstractKotlinSpringDocTest() {

@SpringBootApplication
@ComponentScan(basePackages = ["org.springdoc", "test.org.springdoc.api.app6"])
open class DemoApplication

}
51 changes: 51 additions & 0 deletions springdoc-openapi-kotlin/src/test/resources/results/app6.json
@@ -0,0 +1,51 @@
{
"openapi": "3.0.1",
"info": {
"title": "OpenAPI definition",
"version": "v0"
},
"servers": [
{
"url": "",
"description": "Generated server url"
}
],
"paths": {
"/test/": {
"get": {
"tags": [
"byte-array-test-controller"
],
"operationId": "foo",
"responses": {
"200": {
"description": "OK",
"content": {
"*/*": {
"schema": {
"$ref": "#/components/schemas/Foo"
}
}
}
}
}
}
}
},
"components": {
"schemas": {
"Foo": {
"required": [
"data"
],
"type": "object",
"properties": {
"data": {
"type": "string",
"format": "byte"
}
}
}
}
}
}

0 comments on commit 1e2f428

Please sign in to comment.