I'm building a fuzzer for a REST API that has an OpenAPI (Swagger) definition.
I want to test all available path from the OpenAPI definition, generate data to test the servers, analyse responses code and content, and to verify if the responses are conform to the API definition.
I'm looking for a way to generate data (JSON object) from model definitions.
For example, given this model:
...
"Pet": {
"type": "object",
"required": [
"name",
"photoUrls"
],
"properties": {
"id": {
"type": "integer",
"format": "int64"
},
"category": {
"$ref": "#/definitions/Category"
},
"name": {
"type": "string",
"example": "doggie"
},
"photoUrls": {
"type": "array",
"items": {
"type": "string"
}
},
"tags": {
"type": "array",
"items": {
"$ref": "#/definitions/Tag"
}
},
"status": {
"type": "string",
"description": "pet status in the store"
}
}
}
I want to generate random data and get something like this:
{
"id": 0,
"category": {
"id": 0,
"name": "string"
},
"name": "doggie",
"photoUrls": [
"string"
],
"tags": [
{
"id": 0,
"name": "string"
}
],
"status": "string"
}
My experience:
In short: generating client (java-client in my case) based on Swagger definition, filling it's model and marshalling the result.