Forum Discussion

DamienDev's avatar
DamienDev
Occasional Visitor
4 years ago

Question regarding Arrays and Objects in Query Parameters

Hello!

 

I am a bit confused about the end result of an URL when using arrays and objects for query parameters. Could someone show me URL examples of the below setup?

 

Example 1 - Arrays

 

{
    "/pet/findByStatus": {
        "get": {
            "parameters": [{
                "in": "query",
                "name": "test",
                "description": "Pet object that needs to be added to the store",
                "schema": {
                    "type": "array",
                    "items": {
                        "properties": {
                            "id": {
                                "type": "integer",
                                "format": "int64"
                            },
                            "category": {
                                "type": "object",
                                "properties": {
                                    "id": {
                                        "type": "integer",
                                        "format": "int64"
                                    },
                                    "name": {
                                        "type": "string"
                                    }
                                }
                            },
                            "name": {
                                "type": "string",
                                "example": "doggie"
                            },
                            "photoUrls": {
                                "type": "array",
                                "items": {
                                    "type": "string"
                                }
                            },
                            "tags": {
                                "type": "array",
                                "items": {
                                    "type": "object",
                                    "properties": {
                                        "id": {
                                            "type": "integer",
                                            "format": "int64"
                                        },
                                        "name": {
                                            "type": "string"
                                        }
                                    }
                                }
                            },
                            "status": {
                                "type": "string",
                                "description": "pet status in the store",
                                "enum": ["available", "pending", "sold"]
                            }
                        }
                    }
                }
            }]
        }
    }
}

 

 

 

Example 2 - Object

 

{
    "/pet/findByStatus": {
        "get": {
            "parameters": [{
                "in": "query",
                "name": "test",
                "description": "Pet object that needs to be added to the store",
                "schema": {
                    "type": "object",
                    "properties": {
                        "id": {
                            "type": "integer",
                            "format": "int64"
                        },
                        "category": {
                            "type": "object",
                            "properties": {
                                "id": {
                                    "type": "integer",
                                    "format": "int64"
                                },
                                "name": {
                                    "type": "string"
                                }
                            }
                        },
                        "name": {
                            "type": "string",
                            "example": "doggie"
                        },
                        "photoUrls": {
                            "type": "array",
                            "items": {
                                "type": "string"
                            }
                        },
                        "tags": {
                            "type": "array",
                            "items": {
                                "type": "object",
                                "properties": {
                                    "id": {
                                        "type": "integer",
                                        "format": "int64"
                                    },
                                    "name": {
                                        "type": "string"
                                    }
                                }
                            }
                        },
                        "status": {
                            "type": "string",
                            "description": "pet status in the store",
                            "enum": ["available", "pending", "sold"]
                        }
                    }
                }
            }]
        }
    }
}

 

 

 

Thanks!

No RepliesBe the first to reply