or
We are struggling to create the the Swagger file which can meet our requirement, Any kind of help is appreciated.
@Ankit Dwivedi , What do you mean "duplicate key" ? can you give an example ?
Hi @Anil Sagar
Duplicate key means like i have shown in below image:
Here we are giving default value in the schema Ref-faultCharacteristics.
and here we have
Note:DK mean duplicate key
And we want it to be like the below image , is it possible to have multiple value. in requeat body of schema??
I am not sure what you mean by duplicate key.
For default value you can try using the default property as following.
Category: type: "object" properties: id: type: "integer" format: "int64" name: type: "string" default: "cat"
i am doing that but i need multiple default value for "type" and "name" in like:
Category: type: "object" properties: id: type: "integer" format: "int64" name: type: "string" default: "cat" id: type: "Float" format: "int64" name: type: "string" default: "Dog"
Like this....
I don't think it's a valid json, Either you go for array format or have different names. The names within an object SHOULD be unique.
Yes the that what i want to confirm that can we create multiple object in Array or in any other way as i need
thanks for clearing this 🙂
The yaml structure you mentioned is incorrect. each property has to be unique. I am not able to understand your requirement, but have a feeling that you want to enumerate possible values for a field. It can be done like this
Category: type: "object" properties: id: type: "integer" format: "int64" name: type: "string" enum: - cat - dog
thanks @snehal chakraborty thats what want to understand , The requirement is i want to create object that can have same "name/value pairs" in swagger(where we define default value in schema)
Like below mentioned
"faultCharacteristics": [{
"type":
"TroubleCode",
"value":
"ULL"
},
{
"type":
"Workable",
"value":
"No"
},
{
"type":
"AssociateOutage",
"value":
"No"
},
{
"type":
"ServiceNeverWorked?",
"value":
"No"
}]
Try this
faultCharacteristic: type: object properties: type: type: string description: >- Used to identify the problem faced by the service. Possible values TroubleCode, Workable, AssociateOutage, ACVoltage, OpenIn, ServiceNeverWorked, RequestedTask, DiagnosticTestId. enum: - TroubleCode - Workable - AssociateOutage - ACVoltage - OpenIn - ServiceNeverWorked - RequestedTask - DiagnosticTestId value: type: string description: >- 'Value of the identified parameter. Possible values are based on the type. TroubleCode NSY 'Workable : Yes/No' 'AssociateOutage: Yes/No' 'ACVoltage: Yes/No' 'OpenIn: Yes/No' 'ServiceNeverWorked: Yes/No' 'RequestedTask: Appointment/Commitment/Tester' 'DiagnosticTestId: 107828' 'Trouble Code listed is example code only. https://sdev.telstra. com/content/trouble-ticket-api-supporting-materials#TW Create Input Guidelines'. enum: - Yes - No - Appointment - Commitment - Tester faults: type: object properties: faultCharacteristics: type: array items: $ref:'#/definitions/faultCharacteristic'
User | Count |
---|---|
2 | |
2 | |
1 | |
1 | |
1 |