[bug] [polymorphism] Changes in child schema are ignored when only parent schema is directly referenced
還沒有人認領這個 Issue。
評估
研究方向
首先,使用提供的 OpenAPI 文件重現回報的案例,並比較加入 Ball.material 後的 differ 輸出。追蹤 GET /pet/findByStatus 參照如何到達多型 schemas,並確認間接參照的子 schemas 中的變更會被包含。輸出回報 Ball 的變更,且回歸測試涵蓋此情境,即表示完成。
由索引模型根據 Issue 內容生成。
描述
When using AllOf for polymorphism, when a property references a parent schema using ref and a change is done to a child schema which is not referenced directly anywhere in the OAS file, changes done to child schema are ignored in the differ output.
Example schema:
openapi: 3.0.0
servers:
- url: 'http://petstore.swagger.io/v2'
info:
description: >-
This is a sample server Petstore server. You can find out more about
Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net,
#swagger](http://swagger.io/irc/). For this sample, you can use the api key
`special-key` to test the authorization filters.
version: 1.0.0
title: Swagger Petstore
termsOfService: 'http://swagger.io/terms/'
contact:
email: [email protected]
license:
name: Apache 2.0
url: 'http://www.apache.org/licenses/LICENSE-2.0.html'
tags:
- name: pet
description: Everything about your Pets
externalDocs:
description: Find out more
url: 'http://swagger.io'
- name: store
description: Access to Petstore orders
- name: user
description: Operations about user
externalDocs:
description: Find out more about our store
url: 'http://swagger.io'
paths:
/pet/findByStatus:
get:
tags:
- pet
summary: Finds Pets by status
description: Multiple status values can be provided with comma separated strings
operationId: findPetsByStatus
parameters:
- name: status
in: query
description: Status values that need to be considered for filter
required: true
explode: true
schema:
type: array
items:
type: string
enum:
- available
- pending
- sold
default: available
responses:
'200':
description: successful operation
content:
application/json:
schema:
type: object
properties:
pets:
type: array
items:
$ref: '#/components/schemas/Pet'
'400':
description: Invalid status value
security:
- petstore_auth:
- 'write:pets'
- 'read:pets'
externalDocs:
description: Find out more about Swagger
url: 'http://swagger.io'
components:
requestBodies:
Pet:
content:
application/json:
schema:
$ref: '#/components/schemas/Pet'
description: Pet object that needs to be added to the store
required: true
securitySchemes:
petstore_auth:
type: oauth2
flows:
implicit:
authorizationUrl: 'http://petstore.swagger.io/oauth/dialog'
scopes:
'write:pets': modify pets in your account
'read:pets': read your pets
api_key:
type: apiKey
name: api_key
in: header
schemas:
BasePet:
type: object
properties:
pet_color:
type: string
Pet:
allOf:
- $ref: '#/components/schemas/BasePet'
type: object
discriminator:
propertyName: pet_type
mapping:
dog: '#/components/schemas/Dog'
cat: '#/components/schemas/Cat'
required:
- pet_type
properties:
pet_type:
nullable: false
allOf:
- type: string
Cat:
description: Cat class
allOf:
- $ref: '#/components/schemas/Pet'
type: object
discriminator:
propertyName: pet_type
mapping:
dog: '#/components/schemas/Cat'
properties:
name:
type: string
toy:
$ref: '#/components/schemas/Toy'
Dog:
description: Dog class
allOf:
- $ref: '#/components/schemas/Pet'
type: object
discriminator:
propertyName: pet_type
mapping:
dog: '#/components/schemas/Cat'
properties:
bark:
type: string
Toy:
description: Toy class
type: object
discriminator:
propertyName: toy_type
mapping:
ball: '#/components/schemas/Ball'
properties:
toy_type:
type: string
price:
type: number
Ball:
description: Ball class
allOf:
- $ref: '#/components/schemas/Toy'
- type: object
properties:
size:
type: string
discriminator:
propertyName: toy_type
mapping:
ball: '#/components/schemas/Ball'
If I add new property material to Ball, I would expect to see changes in GET /pet/findByStatus operation, while the actual situation is, that the changes are ignored.
Tested with 2.1.0-SNAPSHOT.
- 主要語言
- Java
- 星號
- 1.1k
- 分支
- 190
- PR 合併指標
- 30 天內沒有已合併 PR
環境準備
- 提供 Dockerfile 或 Docker Compose 檔案
- 沒有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 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 則留言 ·
-
[Bug] Backward compatibility check fails on reordered discriminator mappings可能已有人在做 @MoChiUaena 於 15 天前認領。 未關閉Breaking/Non-Breaking classification
難度 3/5 1-2 天 新手友好度 55/100
OpenAPITools/openapi-diff#886 ·
查看 OpenAPITools/openapi-diff 的全部 Issue
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 86/100
apache/rocketmq-dashboard#6331 ·
維護者通常 5 天內回覆
-
status: team-only type: dependency-upgrade
難度 2/5 1-3 小時 新手友好度 68/100
spring-projects/spring-boot#52143 · 1 則留言 ·
維護者通常 1 天內回覆
-
area/frontend good first issue kind/cooldown
難度 2/5 1-3 小時 新手友好度 78/100
kestra-io/kestra#20704 · 1 則留言 ·
維護者通常 1 天內回覆