OpenAPITools / OpenAPITools/openapi-diff

ChangedSchema in a readOnly property for requestBody is not filtered out from the result.

Aperta
#357 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Lingua principale
Java
Stelle
1.1k
Fork
190
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

Old API
{
  "openapi":"3.0.0",
  "info":{
    "title":"API",
    "version":"0.1.0"
  },
  "paths":{
    "/resource":{
      "post":{
        "responses":{
          "200":{
            "description":"Created resource",
            "content":{
              "application/json":{
                "schema":{
                  "$ref":"#/components/schemas/CreateResourceResponse"
                }
              }
            }
          }
        },
        "summary":"Create resource",
        "requestBody":{
          "content":{
            "application/json":{
              "schema":{
                "$ref":"#/components/schemas/CreateResourceRequest"
              }
            }
          },
          "description":"Definition of the resource"
        }
      }
    }
  },
  "components": {
    "schemas": {
      "CreateResourceResponse": {
        "type": "object",
        "properties": {
          "resources": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "CreateResourceRequest": {
        "type": "object",
        "properties": {
          "foo": {
            "$ref": "#/components/schemas/Foo"
          }
        }
      },
      "Foo": {
        "type": "object",
        "properties": {
          "bar": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Bar"
            },
            "readOnly": true
          }
        }
      },
      "Bar": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          }
        }
      }
    }
  }
}
New API
{
  "openapi":"3.0.0",
  "info":{
    "title":"API",
    "version":"0.1.0"
  },
  "paths":{
    "/resource":{
      "post":{
        "responses":{
          "200":{
            "description":"Created resource",
            "content":{
              "application/json":{
                "schema":{
                  "$ref":"#/components/schemas/CreateResourceResponse"
                }
              }
            }
          }
        },
        "summary":"Create resource",
        "requestBody":{
          "content":{
            "application/json":{
              "schema":{
                "$ref":"#/components/schemas/CreateResourceRequest"
              }
            }
          },
          "description":"Definition of the resource"
        }
      }
    }
  },
  "components": {
    "schemas": {
      "CreateResourceResponse": {
        "type": "object",
        "properties": {
          "resources": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "CreateResourceRequest": {
        "type": "object",
        "properties": {
          "foo": {
            "$ref": "#/components/schemas/Foo"
          }
        }
      },
      "Foo": {
        "type": "object",
        "properties": {
          "bar": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Bar"
            },
            "readOnly": true
          }
        }
      },
      "Bar": {
        "type": "object",
        "properties": {
          "name": {
            "type": "integer"
          }
        }
      }
    }
  }
}

In this example, the property bar in Foo schema is a readOnly property and Foo is referenced by request body of the endpoint.
When Bar schema is changed, it's filtered out from the request body but the change exists in the list of ChangedSchema in ChangedOpenApi, which results incompatible changes but shows nothing.

==========================================================================
==                            API CHANGE LOG                            ==
==========================================================================
                                   API                                    
--------------------------------------------------------------------------
--                                Result                                --
--------------------------------------------------------------------------
                 API changes broke backward compatibility                 
--------------------------------------------------------------------------

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia riproducendo il problema con gli esempi Old API e New API, concentrandoti sui risultati di ChangedSchema e ChangedOpenApi per la proprietà bar readOnly nel corpo della richiesta. Traccia il modo in cui lo schema Bar modificato viene filtrato dai controlli di compatibilità del corpo della richiesta, ma rimane in ChangedSchema; il lavoro è completato quando l'elenco delle modifiche risultante e l'output di compatibilità non riportano più quella modifica filtrata.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
java
Ambito
api, backend-api-design
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
48/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.