mtrajano / laravel-swagger

Auto generates the swagger documentation of a laravel project based on best practices and simple assumptions
167 stars 71 forks source link

How to add parameter description and return value description #62

Open Summer90xia opened 3 years ago

Summer90xia commented 3 years ago

Description:

After I run the script, I get the following

"/archive/color/add": {
            "post": {
                "summary": "",
                "description": "",
                "deprecated": false,
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                },
                "parameters": [
                    {
                        "in": "body",
                        "name": "body",
                        "description": "",
                        "schema": {
                            "type": "object",
                            "required": [
                                "color_name",
                                "color_en_name",
                                "archive_status"
                            ],
                            "properties": {
                                "color_name": {
                                    "type": "string"
                                },
                                "color_en_name": {
                                    "type": "string"
                                },
                                "color_value": {
                                    "type": "string"
                                },
                                "color_remark": {
                                    "type": "string"
                                },
                                "archive_status": {
                                    "type": "string",
                                    "enum": [
                                        "enable",
                                        "disable"
                                    ]
                                }
                            }
                        }
                    }
                ]
            }
        }

There is no parameter description and return value description.The result waht I want is like this:

"\/archive\/color\/add": {
            "post": {
                "summary": "",
                "description": "",
                "deprecated": false,
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$schema": "http:\/\/json-schema.org\/draft-04\/schema#",
                            "type": "object",
                            "properties": {
                              "code": {
                                "type": "numeric",
                                "description": "description string",
                                "required": true
                              },
                              "msg": {
                                "type": "string",
                                "description": "description string",
                                "required": true
                              }
                            }
                       }
                    }
                },
                "parameters": [
                    {
                        "in": "body",
                        "name": "body",
                        "description": "",
                        "schema": {
                            "type": "object",
                            "required": [
                                "color_name",
                                "color_en_name",
                                "archive_status"
                            ],
                            "properties": {
                                "color_name": {
                                    "type": "string",
                                     "description": "description string",
                                },
                                "color_en_name": {
                                    "type": "string",
                                    "description": "description string",
                                },
                                "color_value": {
                                    "type": "string",
                                    "description": "description string",
                                },
                                "color_remark": {
                                    "type": "string",
                                    "description": "description string",
                                },
                                "archive_status": {
                                    "type": "string",
                                    "description": "description string",
                                    "enum": [
                                        "enable",
                                        "disable"
                                    ]
                                }
                            }
                        }
                    }
                ]
            }
        }

How can i do it?