Bird
0
0

What is wrong with this OpenAPI snippet? components: schemas: User: type: object properties: id: type: integer name: type: string required: id

medium📝 Debug Q7 of 15
Rest API - API Documentation
What is wrong with this OpenAPI snippet? components: schemas: User: type: object properties: id: type: integer name: type: string required: id
AType 'object' is invalid for schemas
BProperties must be inside components, not schemas
CThe required field should be a list, not a single value
DSchema names must be lowercase
Step-by-Step Solution
Solution:
  1. Step 1: Check the required field format

    The required field must be an array of strings, e.g., ['id'], not a single string.
  2. Step 2: Validate other schema rules

    Properties belong inside schemas, type 'object' is valid, and schema names are usually PascalCase.
  3. Final Answer:

    The required field should be a list, not a single value -> Option C
  4. Quick Check:

    Required is a list of property names [OK]
Quick Trick: Required properties must be in a list [OK]
Common Mistakes:
MISTAKES
  • Using string instead of list for required
  • Misplacing properties
  • Incorrect schema naming conventions

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes