[BUG] Swagger 2.0 unresolved schema references are not detected during client generation

オープン
#24,832 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
65/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
java
領域
api

調査の方向性

提供された Swagger 2.0 YAML を使ってクライアント生成を再現し、Swagger 2.0 と 3.0 の宣言で未解決のスキーマ参照がどのように扱われるかを調査します。ジェネレーターの参照解決および検証のエントリーポイントを追跡し、定義が欠落している場合に、モデルが欠落したクライアントを生成するのではなくエラーが発生することを示すテストカバレッジを追加します。

索引モデルが issue の本文から書いたものです。

説明

Issue: Bug
Bug Report Checklist
  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

When generating a client from a Swagger 2.0 specification containing a $ref to a schema that is not defined, OpenAPI Generator completes successfully instead of reporting an unresolved reference.

The generated library contains references to the missing model, but no corresponding model file is generated.

openapi-generator version

v7.25.0

OpenAPI declaration file content or url
swagger: '2.0'
info:
  title: Undefined Schema Reproduction
  version: '1.0.0'

paths:
  /test:
    post:
      parameters:
        - name: body
          in: body
          required: true
          schema:
            $ref: '#/definitions/DoesNotExist'
      responses:
        '200':
          description: OK
Generation Details

The issue appears to be language-independent

Steps to reproduce

Generate a client library using the above schema and inspect the results.

Related issues/PRs
Suggest a fix

When a schema definition is missing an error should be raised as is done for 3.0.x declarations

主要言語
Java
スター
26.9k
フォーク
7.8k
平均マージ
2日 10時間
マージ済み PR(30日)
180

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

OpenAPITools/openapi-generator のほかの issue

OpenAPITools/openapi-generator の issue をすべて見る

似ている issue

Java の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。