Chapter quiz · Schemas & Validation

Test what you learned.

8 questions on Schemas & Validation. Pass 70% to clear the chapter.

← Review chapter lessons

Quiz

Schemas & Validation — Chapter Quiz

Eight questions on JSON Schema for body, params, query, and response, TypeBox, Ajv tuning, error formats, and Swagger.

0/ 9
  1. Question 1
    1

    Which schema part validates URL path parameters like /users/:id?

  2. Question 2
    2

    What spec do Fastify schemas use under the hood?

  3. Question 3
    3

    A response schema can both shape the output and speed up JSON serialization.

  4. Question 4
    4

    What is TypeBox?

  5. Question 5
    5

    To enable string-to-number coercion in querystrings, set the Ajv option named ____ to true.

  6. Question 6
    6

    What status code does Fastify return when this body is rejected?

    app.post('/x', {
      schema: { body: { type: 'object', required: ['email'] } },
    }, async () => 'ok');
    // POST /x with body {}
    
  7. Question 7
    7

    What does @fastify/swagger (with @fastify/swagger-ui) generate?

  8. Question 8
    8

    Which of these are valid keys inside a route's schema option?

    Select all that apply.

Pick an answer — instant feedback as you go.