【发布时间】:2018-12-12 18:41:38
【问题描述】:
我确实更改了我的文件:
--- a/lib/Mojolicious/Plugin/OpenAPI3.pm
+++ b/lib/Mojolicious/Plugin/OpenAPI3.pm
@@ -396,6 +396,7 @@ sub _check_response {
# Here we do not know what to do with all of this.
# Thus we just say: Not Implemented
# $c->stash->{ status } //= 404;
+ DB::x;
$c->render( status => 501, data => '' );
}
当尝试应用 stash 时出现错误:
error: Your local changes to the following files would be overwritten by merge:
lib/Mojolicious/Plugin/OpenAPI3.pm
Please commit your changes or stash them before you merge.
但 stash 对同一行没有交叉更改:
$ git stash show -p
--- a/lib/Mojolicious/Plugin/OpenAPI3.pm
+++ b/lib/Mojolicious/Plugin/OpenAPI3.pm
@@ -452,6 +463,7 @@ sub validate_response {
# NOTICE: Depending on status we will check normal or error response
my $status = $stash->{ status } //= 200;
my $schema = $stash->{ 'openapi3.schema' }{ responses };
+ $status = 'default' if !$schema->{ $status };
# TODO: Schema also not found for not found request:
# Request which come to not defined path. In this case we should provide
# something like default response, should not?
为什么会出现上述错误?为什么 stash 中的更改只是合并到工作目录中?
【问题讨论】: