cancel
Showing results for 
Search instead for 
Did you mean: 

Specify a mandatory object in an array

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

3 REPLIES
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

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others.↓↓↓↓↓



Occasional Visitor

Re: Specify a mandatory object in an array

Am too having the same problem. 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 don't find it as the best solution. Any suggestions to make it better are appreciated. Thanks in advance. Regards, panda helper 3ds emulator KissAnime

Highlighted
Community Manager

Re: Specify a mandatory object in an array

Hi helloamalexpark,

 

Which SmartBear product do you use? I'll move your question to the corresponding forum where our experts will assist you.

 

 

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

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others.↓↓↓↓↓



Watch a Video Interview
Are You In?

Meet the Community Leaders!

SmartBear Connect is an excellent opportunity for training, in-person support, and networking.

GET YOUR TICKET WITH $100 OFF