小编Jaz*_*idt的帖子

Nelmio Api Doc Bundle:记录所需参数

我目前正在使用 NelmioApiDocBundle,我对它还不是很熟悉。我正在编写的 API 必须提供更改特定用户密码的途径。文档应说明,更改密码既需要旧密码,也需要新密码。因为我没有发现之间的区别的解释RequirementsParameters,我想首先是用于从路由数据,而后者用于API调用本身。

归档此类文档的第一次尝试是实现一个简单的模型,然后 JMSSerializerBundle 会自动转换该模型:

class ChangePasswordParam
{
    /**
     * @Type("string")
     * @var string
     */
    protected $oldPassword;

    /**
     * @Type("string")
     * @var string
     */
    protected $newPassword;

}
Run Code Online (Sandbox Code Playgroud)

Controller 通过这个 action 方法接受 API 调用:

/**
 * Changes the password for a specific user.
 *
 * @Post("/{username}/changepassword")
 * @View()
 * @ApiDoc(
 *  description="Changes the password of a User",
 *  input="FQCN\ChangePasswordParam"
 * )
 *
 * @param string              $username
 * @param ChangePasswordParam $passwordParam
 *
 * @return Response
 */ …
Run Code Online (Sandbox Code Playgroud)

php symfony fosrestbundle jmsserializerbundle nelmioapidocbundle

5
推荐指数
1
解决办法
6809
查看次数

@NonCPS在第一个构建步骤后停止

在带@NonCPS注释的函数中,只执行第一个jenkins构建步骤的代码.有没有人有同样的问题?我错过了什么吗?我正在使用Jenkins LTS ...只是说'(2.73.2).

这是我的代码:

@NonCPS
def hello() {
    println 'Output "hello":'
    sh 'echo Hello'
    println 'Output "World":'
    sh 'echo World'
}

node {
    stage('Test') {
        hello()
    }
}
Run Code Online (Sandbox Code Playgroud)

我希望这段代码能够正常运行,但输出结果如下:

[Pipeline] node
Running on Jenkins in /var/lib/jenkins/workspace/Sandbox/pipeline-test
[Pipeline] {
[Pipeline] stage
[Pipeline] { (Test)
[Pipeline] echo
Output "hello":
[Pipeline] sh
[pipeline-test] Running shell script
+ echo Hello
Hello
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
Finished: SUCCESS
Run Code Online (Sandbox Code Playgroud)

groovy jenkins jenkins-pipeline

2
推荐指数
1
解决办法
1696
查看次数