Hacktoberfest 2026: die Issues, die Maintainer für den Oktober markiert haben – offen und einsteigerfreundlich. Hacktoberfest-Issues durchsuchen

[2.1.0-beta.6 and oas-3.1.0] Request body property data type change is detected as compatible or no_change

Offen
#528 1 Kommentar 3 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Anfängerfreundlichkeit
38/100
Issue-Typ
Bug
Klarheit
Größtenteils klar
Aktivitätsstatus
Veraltet
Tech-Stack
java
Bereich
api

Rechercherichtung

Beginne damit, den Bericht mit old.yml und new.yml unter Verwendung des angegebenen openapi-diff-Docker-Befehls zu reproduzieren und die Ergebnisse von OpenAPI 3.1.0 mit dem Verhalten von 3.0.3 zu vergleichen. Verfolge den Vergleich des Typs des Request-Body-Schemas und füge Regressionstests für Änderungen von string/object und string/integer hinzu; abgeschlossen ist die Aufgabe, wenn diese Änderungen als inkompatibel gemeldet werden.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

Breaking/Non-Breaking classification
  1. string to object (actual: compatible, expected: incompatible)
  2. string to integer/integer to string (actual: no_change, expected: incompatible)

Case 1:
old.yml

openapi: 3.1.0
info:
  title: Demo API
  version: v1
paths:
  /endpoint:
    post:
      requestBody:
        content:
          application/json:
            schema:
              type: object
              required:
                - requiredProp
                - requiredToRemoveProp
                - dataTypeChangedRequiredProp
                - requiredToOptionalProp
              properties:
                requiredProp:
                  type: string
                optionalProp:
                  type: string
                optionalToRemoveProp:
                  type: string
                requiredToRemoveProp:
                  type: string
                dataTypeChangedRequiredProp:
                  type: string
                dataTypeChangedOptionalProp:
                  type: string
                optionalToRequiredProp:
                  type: string
                requiredToOptionalProp:
                  type: string
      responses:
        default:
          description: successful operation
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: integer
                    format: int64
                    example: 201

new.yml

openapi: 3.1.0
info:
  title: Demo API
  version: v1
paths:
  /endpoint:
    post:
      requestBody:
        content:
          application/json:
            schema:
              type: object
              required:
                - requiredProp
                - requiredToRemoveProp
                - dataTypeChangedRequiredProp
                - requiredToOptionalProp
              properties:
                requiredProp:
                  type: string
                optionalProp:
                  type: string
                optionalToRemoveProp:
                  type: string
                requiredToRemoveProp:
                  type: string
                dataTypeChangedRequiredProp:
                  type: object
                  properties:
                    id:
                      type: string
                dataTypeChangedOptionalProp:
                  type: string
                optionalToRequiredProp:
                  type: string
                requiredToOptionalProp:
                  type: string
      responses:
        default:
          description: successful operation
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: integer
                    format: int64
                    example: 201

Case 2:
old.yml

openapi: 3.1.0
info:
  title: Demo API
  version: v1
paths:
  /endpoint:
    post:
      requestBody:
        content:
          application/json:
            schema:
              type: object
              required:
                - requiredProp
                - requiredToRemoveProp
                - dataTypeChangedRequiredProp
                - requiredToOptionalProp
              properties:
                requiredProp:
                  type: string
                optionalProp:
                  type: string
                optionalToRemoveProp:
                  type: string
                requiredToRemoveProp:
                  type: string
                dataTypeChangedRequiredProp:
                  type: integer
                dataTypeChangedOptionalProp:
                  type: string
                optionalToRequiredProp:
                  type: string
                requiredToOptionalProp:
                  type: string
      responses:
        default:
          description: successful operation
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: integer
                    format: int64
                    example: 201

new.yml

openapi: 3.1.0
info:
  title: Demo API
  version: v1
paths:
  /endpoint:
    post:
      requestBody:
        content:
          application/json:
            schema:
              type: object
              required:
                - requiredProp
                - requiredToRemoveProp
                - dataTypeChangedRequiredProp
                - requiredToOptionalProp
              properties:
                requiredProp:
                  type: string
                optionalProp:
                  type: string
                optionalToRemoveProp:
                  type: string
                requiredToRemoveProp:
                  type: string
                dataTypeChangedRequiredProp:
                  type: string
                dataTypeChangedOptionalProp:
                  type: string
                optionalToRequiredProp:
                  type: string
                requiredToOptionalProp:
                  type: string
      responses:
        default:
          description: successful operation
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: integer
                    format: int64
                    example: 201

Examples are having data-type change only for required property but tested the same for optional property giving same output
Command used: docker run --rm -t -v $(pwd):/specs openapitools/openapi-diff:2.1.0-beta.6 /specs/old.yml /specs/new.yml --state

EDIT: The same changes are considered as incompatible with openapi: 3.0.3 and below

Vorherrschende Sprache
Java
Sterne
1.1k
Forks
190
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus OpenAPITools/openapi-diff

Alle Issues in OpenAPITools/openapi-diff

Ähnliche Issues

Weitere Issues zu Java

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.