Bug: erroneous detection of changes with mediaTypes, failure to generate html/markdown reports
還沒有人認領這個 Issue。
評估
研究方向
首先,使用提供的 OpenAPI YAML 和命令 java -jar openapi-diff-cli-2.1.2-all.jar anothertest.yaml samefile.yaml --html blah.html --fail-on-incompatible 重現該報告。檢查 mediaTypes 比較以及 HTML/Markdown 報告路徑;當相同的規格不顯示任何變更,且兩種報告格式都能產生而不會出現空指標例外時,即表示完成。
由索引模型根據 Issue 內容生成。
描述
Hello
I've run into an interesting problem with version 2.1.2 of openapi-diff. I've redacted/dumbed down this example spec to be the smallest piece possible.
It would seem that in this case, where the content of then endpoint is uses mediaType's, changes are being detected (though not breaking) but even when the specs are identical.
I boiled the repro to the simplest form, you can take this example, put it in two separate files, and diff them with 2.1.2 (or 2.1.1 - but for instance, 2.1.0.beta-11 does NOT exhibit this)
openapi: '3.0.3'
info:
license:
name: ''
termsOfService: ''
title: "my test service"
version: 'Latest'
tags:
- name: mytestTag
description: endpoints
paths:
/v4/mytest/formats/{downloadFormat}/records/{recordId}:
get:
tags:
- mytestTag
summary: Converts record to provided format
operationId: getV4DownloadsFormatsRecords
deprecated: false
x-ebsco-secured-endpoint:
requiredScopes: [ ]
security:
- Authorization: [ ]
parameters:
- name: downloadFormat
in: path
description: Export format
required: true
schema:
type: string
example: 'csv'
- name: recordId
in: path
description: Unique record identifier
required: true
example: 'ax74x2wyin'
schema:
type: string
responses:
'200':
description: OK
content:
text/csv:
schema:
type: string
format: byte
example: 'blah'
application/vnd.openxmlformats-officedocument.wordprocessingml.document:
schema:
type: string
format: byte
example: 'blah'
application/pdf:
schema:
type: string
format: byte
example: 'blah'
application/x-bibtex:
schema:
type: string
format: byte
example: 'blah'
application/marc:
schema:
type: string
format: byte
example: 'blah'
text/xml:
schema:
type: string
format: byte
example: 'blah'
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
'403':
$ref: '#/components/responses/Forbidden'
'404':
$ref: '#/components/responses/NotFound'
components:
responses:
BadRequest:
description: 'BadRequest'
content:
application/json:
example:
name: BAD_REQUEST
details:
- field: '#/login/username'
issue: BAD_REQUEST
location: body
debugId: '123456789'
message: Request contains errors
informationLink: 'http://developer.foo.com/apidoc/blah#BAD_REQUEST'
schema:
$ref: '#/components/schemas/ErrorResponse'
NotFound:
description: 'NotFound'
content:
application/json:
example:
name: NOT_FOUND
details:
- field: '#/login/username'
issue: USERNAME_IS_NOT_FOUND
location: body
debugId: '123456789'
message: Item is not found
informationLink: 'http://developer.foo.com/apidoc/blah#USERNAME_IS_NOT_FOUND'
schema:
$ref: '#/components/schemas/ErrorResponse'
Unauthorized:
description: 'Unauthorized'
content:
application/json:
example:
name: UNAUTHORIZED
details:
- field: '#/login/username'
issue: NOT_AUTHORIZED
location: body
debugId: '123456789'
message: User is not authorized
informationLink: 'http://developer.foo.com/apidoc/blah#NOT_AUTHORIZED'
schema:
$ref: '#/components/schemas/ErrorResponse'
Forbidden:
description: 'Forbidden'
content:
application/json:
example:
name: FORBIDDEN
details:
- field: '#/login/username'
issue: FORBIDDEN
location: body
debugId: '123456789'
message: Access denied
informationLink: 'http://developer.foo.com/apidoc/blah#FORBIDDEN'
schema:
$ref: '#/components/schemas/ErrorResponse'
schemas:
ErrorResponse:
type: object
description: Common Error response
x-examples:
example-1:
name: VALIDATION_ERROR
details:
- field: '#/login/username'
issue: REQUIRED_FIELD_MISSING
location: body
debugId: '123456789'
message: Invalid data provided
informationLink: 'http://developer.foo.com/apidoc/blah#VALIDATION_ERROR'
securitySchemes:
Authorization:
description: Authorization token
type: http
scheme: bearer
bearerFormat: JWT
This will result in changes being detected, specifically around the mediaTypes
So the detection of changes when the files are identical is curious.. but furthermore, attempting to generate the html or markdown version of the report fails generate with the following exception (for markdown)
Unexpected exception. Reason: Cannot invoke "org.openapitools.openapidiff.core.model.ChangedSchema.isDiscriminatorPropertyChanged()" because "schema" is null
and for html
Unexpected exception. Reason: Cannot invoke "org.openapitools.openapidiff.core.model.ChangedSchema.isIncompatible()" because "schema" is null
When running the command like so:
java -jar openapi-diff-cli-2.1.2-all.jar anothertest.yaml samefile.yaml --html blah.html --fail-on-incompatible
- 主要語言
- Java
- 星號
- 1.1k
- 分支
- 190
- PR 合併指標
- 30 天內沒有已合併 PR
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
OpenAPITools/openapi-diff 的其他 Issue
-
enhancement
難度 2/5 1-3 小時 新手友好度 68/100
OpenAPITools/openapi-diff#506 ·
-
good first issue help wanted
難度 2/5 1-3 小時 新手友好度 68/100
OpenAPITools/openapi-diff#364 ·
-
bug OpenAP 3.1.0 Support
難度 3/5 1-2 天 新手友好度 68/100
OpenAPITools/openapi-diff#910 · 1 則留言 ·
-
Render capabilities
難度 3/5 1-2 天 新手友好度 55/100
OpenAPITools/openapi-diff#893 · 1 則留言 ·
-
Breaking/Non-Breaking classification
難度 3/5 1-2 天 新手友好度 55/100
OpenAPITools/openapi-diff#886 ·
查看 OpenAPITools/openapi-diff 的全部 Issue
相似的 Issue
-
area/plugin
難度 2/5 1-3 小時 新手友好度 75/100
kestra-io/plugin-kestra#190 ·
-
難度 2/5 1-3 小時 新手友好度 70/100
google-ai-edge/LiteRT-LM#3739 ·
-
bug
難度 2/5 1-3 小時 新手友好度 75/100
-
難度 2/5 1-3 小時 新手友好度 75/100
integra-team-red/meet-map#249 ·
-
[Studio][Bug] Cancelled create-user dialog keeps the password and admin switch for the next attempt 未關閉
難度 2/5 1-3 小時 新手友好度 75/100
apache/rocketmq-dashboard#5064 ·