All quizzesHard
Advanced Dependency Graphs — Series 2
Preview — 3 of 10 questions
An endpoint declares Security(get_user, scopes=["read"]), and get_user depends on a token validator that accepts SecurityScopes. What can the validator inspect?
AOnly scopes from the response model
BOnly scopes embedded in the URL
CThe read requirement propagated through the dependency chain
DA token whose claims FastAPI has already verified
A security dependency receives SecurityScopes listing read and write, but the decoded token grants only read. What should application code do?
AReject access for the missing required scope
BAccept because FastAPI already checked the token
CRemove write from OpenAPI dynamically
DRun the route and let response validation decide
A nested dependency get_tenant is overridden in a test. Its original callable depends on get_db, but the replacement does not. Which graph does FastAPI resolve at that node?
ABoth original and replacement graphs
BOnly the original graph
CNeither graph; overrides require route edits
DThe replacement's declared dependencies
Sign up free to play
Answer all 10 questions (7 more), see explanations for every answer, and track your score.