Changing request field type from `string` to `oneOf: string, number` shouldn't break
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 50/100
Direzione di ricerca
Riproduci il report con base.yml e revision.yml usando openapi-diff base.yml revision.yml, quindi traccia la gestione della compatibilità dello schema del corpo della richiesta per la proprietà name. Il lavoro è completato quando la modifica da integer a oneOf con integer e string non appare più come una breaking change.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Describe the bug
In the request body, if you change the following field:
requestBody:
content:
application/json:
schema:
type: object
properties:
name:
type: integer
required:
- name
required: true
to:
requestBody:
content:
application/json:
schema:
type: object
properties:
name:
oneOf:
- type: integer
- type: string
required:
- name
required: true
Then openapi-diff reports this as a breaking change.
To Reproduce
base.yml
openapi: 3.0.1
info:
title: User Service
version: 1.0.0
paths:
/users:
post:
requestBody:
content:
application/json:
schema:
type: object
properties:
name:
type: integer
required:
- name
required: true
responses:
201:
description: Created
content:
application/json:
schema:
properties:
id:
type: integer
required:
- id
type: object
revision.yml
openapi: 3.0.1
info:
title: User Service
version: 1.0.0
paths:
/users:
post:
requestBody:
content:
application/json:
schema:
type: object
properties:
name:
oneOf:
- type: integer
- type: string
required:
- name
required: true
responses:
201:
description: Created
content:
application/json:
schema:
properties:
id:
type: integer
required:
- id
type: object
- Download the two files base.yml and revision.yml
- Run
openapi-diff base.yml revision.yml - Observe the following output:
==========================================================================
== API CHANGE LOG ==
==========================================================================
User Service
--------------------------------------------------------------------------
-- What's Changed --
--------------------------------------------------------------------------
- POST /users
Request:
- Changed application/json
Schema: Broken compatibility
Changed property type: name (integer -> object)
--------------------------------------------------------------------------
-- Result --
--------------------------------------------------------------------------
API changes broke backward compatibility
--------------------------------------------------------------------------
Expected behavior
openapi-diff shouldn't mark this as a breaking change. Actually, the request body should be considered as a contravariant contract: widening a field type isn't a breaking change.
- Lingua principale
- Java
- Stelle
- 1.1k
- Fork
- 190
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di OpenAPITools/openapi-diff
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
OpenAPITools/openapi-diff#506 ·
-
good first issue help wanted
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
OpenAPITools/openapi-diff#364 ·
-
bug OpenAP 3.1.0 Support
Difficoltà 3/5 1-2 giorni Idoneità per principianti 68/100
OpenAPITools/openapi-diff#910 · 1 commento ·
-
Render capabilities
Difficoltà 3/5 1-2 giorni Idoneità per principianti 55/100
OpenAPITools/openapi-diff#893 · 1 commento ·
-
Breaking/Non-Breaking classification
Difficoltà 3/5 1-2 giorni Idoneità per principianti 55/100
OpenAPITools/openapi-diff#886 ·
Tutte le issue di OpenAPITools/openapi-diff
Issue simili
-
Bug Java Platform: Java
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
getsentry/sentry-java#6138 · 1 commento ·
-
bug needs triage p2
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
GoogleCloudPlatform/DataflowTemplates#4273 · 1 commento ·
-
[Studio][Bug] Bulk-deleting a full page of alert rules steps the page back while more rules remain Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
apache/rocketmq-dashboard#4654 · 1 commento ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100