OpenAPITools / OpenAPITools/openapi-diff
TeamCity renderer
还没有人认领这个 Issue。
- 主要语言
- Java
- 星标
- 1.1k
- 派生
- 190
- PR 合并指标
- 30 天内没有已合并 PR
描述
It would be nice if there were a built-in TeamCity renderer, that can render TeamCity service messages, like for example
##teamcity[inspectionType category='openapi-diff' id='new-endpoint' name='New Endpoint' description='info -- New Endpoint']
##teamcity[inspection typeId='new-endpoint' file='build\openapi.json' message='info -- New Endpoint GET /showcase/v1/open/{id} - Query something totally open' SEVERITY='INFO']
##teamcity[inspection typeId='new-endpoint' file='build\openapi.json' message='info -- New Endpoint GET /showcase/v1/open/{open-id}/samples/{sample-id}/sub-samples/{sub-sample-id} - Query something else totally open' SEVERITY='INFO']
##teamcity[inspectionType category='openapi-diff' id='deleted-endpoint' name='Deleted Endpoint' description='error -- Deleted Endpoint']
##teamcity[inspection typeId='deleted-endpoint' file='build\openapi.json' message='error -- Deleted Endpoint GET /showcase/v1/whatever - Get whatever' SEVERITY='ERROR']
##teamcity[inspection typeId='deleted-endpoint' file='build\openapi.json' message='error -- Deleted Endpoint GET /showcase/v2/whatever - Get whatever else' SEVERITY='ERROR']
##teamcity[inspectionType category='openapi-diff' id='changed-operation' name='Changed Operation' description='Changed Operation']
##teamcity[inspection typeId='changed-operation' file='build\openapi.json' message='info -- Non-breakingly changed operation GET /showcase/v1/foo' SEVERITY='INFO']
##teamcity[inspection typeId='changed-operation' file='build\openapi.json' message='error -- Breakingly changed operation POST /showcase/v1/bar' SEVERITY='ERROR']
##teamcity[inspection typeId='changed-operation' file='build\openapi.json' message='error -- Breakingly changed operation POST /showcase/v1/bar/{bar-id}/baz/{baz-id}/boo' SEVERITY='ERROR']
In the CLI if enabled (or if TeamCity detected) this renderer should write to stdout.
When using via code, it should be a renderer like the others so that it can also be transformered or processed as necessary (like having one Gradle task that has it as output file and another that writes it to stdout so that the generation can be cached while the service messages will still be printed and thus processed).
The inspections can of course also be more fine-grained like for each specific change.
Or having more extensive messages which also support HTML (see linked docs).
Two things to keep in mind:
- While the docs list
SEVERITYas custom attribute it should still be used as TeamCity indeed considers it to differentiate between error and non-errors - Texts that could contain some special characters need a special escaping like this one:
// | => || must be handled first. or we will // escape the previously added escape character text .replace("|", "||") .replace("'", "|'") .replace("\n", "|n") .replace("\r", "|r") .replace("[", "|[") .replace("]", "|]")
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先检查现有的 renderer 和 CLI 输出路径,然后阅读链接的 TeamCity service-message 文档。定义从代码中使用 renderer 以及 CLI 输出的工作方式,包括 severity 和 escaping 要求。当能够生成、转换或将有效的 TeamCity inspection messages 写入 stdout 时,即视为完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- java
- 领域
- api, cli
- Issue 类型
- 功能
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100