cancel
Showing results for 
Search instead for 
Did you mean: 

Would the object be implicitly required if it has some required properties?

vdkrav
Occasional Visitor

Would the object be implicitly required if it has some required properties?

if we have an object with 1+ required properties, and then this object is listed in the properties of some other object.

Would this object be implicitly required?

1 REPLY 1
HKosova
Moderator

Re: Would the object be implicitly required if it has some required properties?


Would this object be implicitly required?


No.

To make this object required you'll need to include it in the "required" list of the parent object:

A:
  type: object
  required: [b]    # <----------
  properties:
    b:
      $ref: '#/components/schemas/B'

B:
  type: object
  required: [foo, bar]
  properties:
    ...

 


Helen Kosova
SmartBear Documentation Team Lead
________________________
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
New Here?
Join us and watch the welcome video:
Announcements