Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

OpenAPI (Swagger) documentation does not take into account the routes hostname

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

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

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

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
openapi, php, symfony
領域
api, backend

調査の方向性

レポートで説明されている tenant と main-domain の API ドキュメントを使用し、ApiResource のホストメタデータに対する OpenAPI ドキュメント生成のエントリーポイントから開始します。両方のホストについて生成された仕様を比較します。完了の条件は、ホストに制限されたエンドポイントが tenant のドキュメントから除外され、server URL が該当するホストを反映していることです。

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

説明

API Platform version(s) affected: ^3.1

Description
I have endpoints that needs to be accessible from different hosts for a multi-tenant app.
On the main domain (example.com/api), there are common data endpoints.
For tenant subdomain (tenant_identifier.example.com/api), there are the tenant data endpoints.

I tried to restrict the common data endpoints with the host parameter and it works as expected but the endpoints does not disappear from the tenant API documentation (tenant_identifier.example.com/api/docs). Therefore, the host does not seems to be taken into account for the OpenAPI specification.

How to reproduce
I have the following service configuration to inject the hostname dynamically:

# config/services.yaml
parameters:
  # Used for route host matching as %env(...)% syntax is not supported
  # @see https://stackoverflow.com/questions/47165113/environment-variables-in-route-annotations
  hostname: '%env(resolve:APP_HOST)%'
# .env
APP_HOST="example.com"

When I specify the host used for an ApiResource, for instance:

#[ApiResource(
    // ...
    host: '%hostname%',
    // ...
)]
class FooBar

The endpoints are still available from the tenant API documentation (tenant_identifier.example.com).

Possible Solution
The server url should be taken into account as it's shown in the OpenAPI specification.

Additional Context
Ask if necessary

主要言語
PHP
スター
2.6k
フォーク
989
平均マージ
1日 22時間
マージ済み PR(30日)
100

環境構築

はじめの一歩

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

api-platform/core のほかの issue

api-platform/core の issue をすべて見る

似ている issue

PHP の issue をもっと見る

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

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