Skip to content

Commit

Permalink
springdoc#2477 buildApiResponses ignores produced ContentType in case…
Browse files Browse the repository at this point in the history
… of many @operation
  • Loading branch information
Tomasz Skowroński committed Jan 8, 2024
1 parent a714f41 commit d901cea
Show file tree
Hide file tree
Showing 5 changed files with 123 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
######################
/target/www/**
/src/test/javascript/coverage/
/**/RecordObject__Javadoc.json

######################
# Node
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -749,6 +749,7 @@ private boolean isValidHttpCode(String httpCode, MethodParameter methodParameter
result = true;
}
else if (httpCode.equals(evaluateResponseStatus(method, method.getClass(), false)))
// if (httpCode.equals(evaluateResponseStatus(method, method.getClass(), false)))
result = true;
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
*
* *
* * *
* * * * Copyright 2019-2023 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.v31.app11;

import io.swagger.v3.oas.annotations.Operation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class HelloController {

@Operation(description = "a")
@GetMapping(path = "/", produces = "a/a")
public String a() {
return "A";
}

@Operation(description = "b")
@GetMapping(path = "/", produces = "b/b")
public String b() {
return "B";
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
*
* *
* * *
* * * * Copyright 2019-2023 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.v31.app11;

import org.springframework.boot.autoconfigure.SpringBootApplication;
import test.org.springdoc.api.v31.AbstractSpringDocV31Test;

public class SpringDocApp11Test extends AbstractSpringDocV31Test {

@SpringBootApplication
static class SpringDocTestApp {

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"openapi":"3.1.0",
"info":{
"title":"OpenAPI definition",
"version":"v0"
},
"servers":[
{
"url":"http://localhost",
"description":"Generated server url"
}
],
"paths":{
"/":{
"get":{
"tags":[
"hello-controller"
],
"description":"a",
"operationId":"b_1",
"responses":{
"200":{
"description":"OK",
"content":{
"b/b":{
"schema":{
"type":"string"
}
}
// ,"a/a":{
// "schema":{
// "type":"string"
// }
// }
}
}
}
}
}
},
"components":{

}
}

0 comments on commit d901cea

Please sign in to comment.