Skip to content

Instantly share code, notes, and snippets.

@dimzeta
Created November 23, 2020 04:24
Show Gist options
  • Save dimzeta/a944a5614af90ecc30c25eb12bd2208c to your computer and use it in GitHub Desktop.
Save dimzeta/a944a5614af90ecc30c25eb12bd2208c to your computer and use it in GitHub Desktop.
Light swagger-php VSCode snippet
{
"OA Method": {
"prefix": ["oa.method", "oa.m"],
"description": "@OA\\Get/Post/Patch/Put/Delete Docblock",
"body": [
"$BLOCK_COMMENT_START*",
" * \t@OA\\\\${1|Get,Post,Patch,Delete|} (",
" * \t\tpath=\"${2:path}\",",
" * \t\tdescription=\"${3:description}\",",
" * \t\toperationId=\"${4:operationId}\",",
" * \t\ttags={\"${5:tag}\"},",
" * \t\t$99",
" * \t)",
" $BLOCK_COMMENT_END"
]
},
"OA Request Body": {
"prefix": ["oa.request", "oa.req"],
"description": "@OA\\RequestBody Docblock",
"body": [
"@OA\\RequestBody(",
"* \t\t\trequired=true,",
"* \t\t\tdescription=$1,",
"* \t\t\t@OA\\JsonContent(",
"* \t\t\t\t$99",
"* \t\t\t),",
"* \t\t),",
]
},
"OA Response": {
"prefix": ["oa.response", "oa.res"],
"description": "@OA\\Response Docblock",
"body": [
"@OA\\Response(",
"* \t\t\tresponse=\"${1|200,201,2022,204,301,302,303,307,400,401,402,403,404,405,406,410,413,422,426,429,500,501,502,503,504,507|}\",",
"* \t\t\tdescription=\"${2:description}\",",
"* \t\t\t@OA\\JsonContent(",
"* \t\t\t\t$99",
"* \t\t\t),",
"* \t\t),",
]
},
"OA Parameter": {
"prefix": ["oa.parameter", "oa.param", "oa.pm"],
"description": "@OA\\Parameter Docblock",
"body": [
"@OA\\Parameter(in=\"${1|query,path|}\", name=\"$2\", description=\"$3\", @OA\\Schema(type=\"${4:string}\", default=$5)),",
"* \t\t$99"
]
},
"OA Property": {
"prefix": ["oa.property", "oa.prop","oa.pt"],
"description": "@OA\\Property Docblock",
"body": [
"@OA\\Property(property=\"$1\", type=\"${2|string,integer,array,object|}\", default=\"$3\"),",
"* \t\t\t\t$99"
]
},
"OA Property Object": {
"prefix": ["oa.property.object", "oa.prop.obj","oa.pt.o"],
"description": "@OA\\Property Object Docblock",
"body": [
"@OA\\Property(property=\"$1\", type=\"object\",",
"* \t\t\t\t\t${99:ref=\"#/components/schemas/$100\"}",
"* \t\t\t\t),"
]
},
"OA Property Array": {
"prefix": ["oa.property.array", "oa.prop.arr","oa.pt.a"],
"description": "@OA\\Property Array Docblock",
"body": [
"@OA\\Property(property=\"$1\", type=\"array\", @OA\\Items(",
"* \t\t\t\t\ttype=\"${2|string,integer,array,object|}\",",
"* \t\t\t\t\t$99",
"* \t\t\t\t),"
]
},
"OA Schema": {
"prefix": ["oa.schema", "oa.s"],
"description": "@OA\\Schema Docblock",
"body": [
"$BLOCK_COMMENT_START*",
" * \t@OA\\Schema (",
" * \t\t@OA\\Xml(name=\"$1\"),",
" * \t\t${98:@OA\\Property(property=\"id\", type=\"integer\", readOnly=\"true\", example=123),}",
" * \t\t$99",
" * \t)",
" $BLOCK_COMMENT_END"
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment