Bird
0
0

Which of the following is the correct way to define a simple string property called name in an OpenAPI schema?

easy📝 Syntax Q12 of 15
Rest API - API Documentation
Which of the following is the correct way to define a simple string property called name in an OpenAPI schema?
Aname: string
Bname: { type: 'string' }
Cname: 'string' type
Dname: { string: true }
Step-by-Step Solution
Solution:
  1. Step 1: Recall OpenAPI property syntax

    Properties are defined as key-value pairs with a type inside an object, e.g., name: { type: 'string' }.
  2. Step 2: Compare options

    Only name: { type: 'string' } matches the correct syntax for defining a string property.
  3. Final Answer:

    name: { type: 'string' } -> Option B
  4. Quick Check:

    Property syntax = key: { type: 'string' } [OK]
Quick Trick: Use key: { type: 'string' } for string properties [OK]
Common Mistakes:
MISTAKES
  • Writing type outside an object
  • Using plain string without type key
  • Confusing property name with type

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes