How to write an OpenAPI definition for the following JSON? Bazically it is an array consisting of two objects with similar attributes but different fields.
[
{
"studentname": "somename",
"studentrollno": "somerollno",
"studentsubjects": [
{
"level": "third",
"physics": "xyz",
"maths": "somevalue"
},
{
"level": "second",
"physics": "abc",
"maths": "somevalue11"
}
],
"studentresult": "pass"
},
{
"studentname": "newname",
"studentrollno": "newrollno",
"studentsubjects": [
{
"level": "third",
"physics": "xyz",
"maths": "somevalue"
},
{
"level": "second",
"physics": "abc",
"maths": "somevalue11"
}
],
"studentresult": "fail"
}
]
type: array
items:
type: object
properties:
studentname:
type: string
example: somename
studentrollno:
type: string
example: somerollno
studentsubjects:
type: array
items:
type:object
properties:
level:
type: string
example: third
physics:
type: string
example: xyz
maths:
type: string
example: somevalue
type: object
This is how i have written , i have written it for the first object in studentsubjects array , but not able to code it for second object in the same array , when i am trying to do it , it is throwing me erro saying duplication of type at last line