Document `#[NotExposed]` for nested DTOs in design.md and dto.md
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 85/100
- Tipo di issue
- Documentazione
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Tranquilla
- Stack tecnologico
- php
- Ambito
- documentation
Direzione di ricerca
Leggi core/dto.md e core/design.md, quindi confronta il riferimento NotExposed esistente in core/jsonapi.md. Aggiungi la spiegazione richiesta, l’esempio PHP e il collegamento incrociato; il lavoro è completo quando gli utenti possono scoprire come vengono documentati i metadati dei DTO annidati senza esporre endpoint pubblici.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Context
#[NotExposed] is currently documented only in jsonapi.md (for JSON:API relations) and briefly mentioned in openapi.md. It is missing from the two pages most users land on when designing DTOs:
Problem
API Platform's metadata pipeline (Hydra docs, OpenAPI, JSON Schema, property security, etc.) walks #[ApiResource] classes only. Nested POPOs referenced via property typehints are invisible to the doc generators. Users hit this repeatedly (e.g. https://github.com/api-platform/core/issues/8187, https://github.com/api-platform/core/issues/8087) and the typical answer — "mark the nested DTO with #[NotExposed]" — is not discoverable from the DTO docs.
Suggested addition
Short subsection in dto.md (and a mention in design.md) covering:
- Nested DTOs referenced from an output DTO are not introspected for docs unless they are themselves resources
- Use
#[NotExposed]on a nested DTO to register its metadata (Hydra/OpenAPI/property factories) without exposing public endpoints - Brief example:
use ApiPlatform\Metadata\ApiResource;
use ApiPlatform\Metadata\Get;
use ApiPlatform\Metadata\NotExposed;
#[ApiResource(operations: [new Get(/* ... */)])]
class Response
{
/** @var Nested[] */
public array $data = [];
}
#[NotExposed]
class Nested
{
public function __construct(public int $id) {}
}
- Cross-link to the existing
NotExposedreference injsonapi.md
- Lingua principale
- Nessun dato sulla lingua
- Stelle
- 181
- Fork
- 1.1k
- Merge medio
- 1g 10h
- PR unite (30g)
- 24
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di api-platform/docs
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
api-platform/docs#2318 ·
-
Graphql documentation Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
api-platform/docs#2310 ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
api-platform/docs#2280 · 2 commenti ·
-
Needs Work
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
api-platform/docs#2133 · 9 commenti · 1 reazione ·
-
good first issue
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 58/100
api-platform/docs#1450 · 2 commenti ·
Tutte le issue di api-platform/docs
Issue simili
-
Link Checker Report Apertaautomated issue report
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
Humanity AI Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
numfocus/project-fundraising#166 ·
-
area:proxy bug security severity:low track:open-source
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100