Specify a mandatory object in an array
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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 Yatskovskaya
SmartBear Community and Education Manager
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi helloamalexpark,
Which SmartBear product do you use? I'll move your question to the corresponding forum where our experts will assist you.
Tanya Yatskovskaya
SmartBear Community and Education Manager
