Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

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

Aperta
#6,986 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

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

Direzione di ricerca

Inizia dal punto di ingresso della generazione della documentazione OpenAPI per i metadati dell’host di ApiResource, utilizzando la documentazione API per tenant e main-domain descritta nel report. Confronta le specifiche generate per entrambi gli host; il lavoro è completo quando gli endpoint limitati all’host vengono omessi dalla documentazione del tenant e l’URL del server riflette l’host applicabile.

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

Descrizione

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

Lingua principale
PHP
Stelle
2.6k
Fork
989
Merge medio
1g 23h
PR unite (30g)
102

Preparare l'ambiente

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.

Altre issue di api-platform/core

Tutte le issue di api-platform/core

Issue simili

Altre issue su PHP

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.