better null check in getSchemaFromResponse (#17003)

This commit is contained in:
William Cheng 2023-11-08 14:08:19 +08:00 committed by GitHub
parent ced9660123
commit e9507077fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1010,11 +1010,16 @@ public class ModelUtils {
* Return the first defined Schema for a ApiResponse
*
* @param openAPI OpenAPI spec.
* @param response api response of the operation
* @param response API response of the operation
* @return firstSchema
*/
public static Schema getSchemaFromResponse(OpenAPI openAPI, ApiResponse response) {
return getSchemaFromContent(getReferencedApiResponse(openAPI, response).getContent());
ApiResponse result = getReferencedApiResponse(openAPI, response);
if (result == null) {
return null;
} else {
return getSchemaFromContent(result.getContent());
}
}
/**