cancel
Showing results for 
Search instead for 
Did you mean: 

Specify a mandatory object in an array

Highlighted
Occasional Visitor

Specify a mandatory object in an array

Hello,

 

I am trying to define an array of objects (Name = "Name" and  value= "value") using '$ref', where one particular object has to be defined as mandatory . The number of objects may vary in future. Below is the code snippet that I have built but dont find it as a best solution. Any suggestions to make it better are appreciated. Thanks in advance

 

 

characteristic:
type: array
items:
$ref: '#/definitions/createObject_characteristic'

createObject_characteristic:
allOf:
- $ref: '#/definitions/createObject_term'
- $ref: '#/definitions/createObject_service'
- $ref: '#/definitions/createObject_stage'
createObject_term:
type: object
properties:
name:
type: string
example: term
description: name of the charateristic
value:
type: string
example: 12 or 36
description: value of the characteristic given in name
createObject_service:
type: object
properties:
name:
type: string
example: service
description: name of the charateristic
value:
type: string
example: AVPN or MIS
description: value of the characteristic given in name
createObject_stage:
type: object
required:
- name
- value
properties:
name:
type: string
example: stage
description: name of the charateristic
value:
type: string
example: createAndRegisterObject
description: value of the characteristic given in name

1 REPLY
Community Manager

Re: Specify a mandatory object in an array

Hi @durga6,

 

This is a forum for the community-related quetsions. We have set of product forums - it's better to refer your question to the appropriate members. Could you please let me know which SmartBear product you are using and I'll move the topic?

---------
Tanya Gorbunova
SmartBear Community Manager


TanyaGorbunova



Reply to any questions to win

Top Kudoed Authors
Are You In?
Top Kudoed Posts