Created
August 30, 2017 22:14
-
-
Save DariuszLuber/38830e73a1c38eaeb21e7168c30b3adb to your computer and use it in GitHub Desktop.
api-platform - swagger anotation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@ApiResource( | |
attributes={ | |
"filters"={"apiOrder", "searchFilter"}, | |
"pagination_items_per_page"=50, | |
"normalization_context"={"groups"={"drugs_unified"}}, | |
}, | |
itemOperations={ | |
"get"={"method"="GET"}, | |
"put"={"method"="PUT"}, | |
"special"={ | |
"route_name"="api_drugunifieds_add_drug", | |
"swagger_context" = { | |
"parameters" = { | |
{ | |
"name" = "id", | |
"in" = "path", | |
"required" = "true", | |
"type" = "string" | |
}, | |
{ | |
"name" = "drugs", | |
"in" = "body", | |
"required" = "true", | |
"type" = "object", | |
"schema": { | |
"type": "object", | |
"properties": { | |
"id": { | |
"type": "string" | |
} | |
} | |
}, | |
"style": "simple" | |
} | |
}, | |
"responses" = { | |
"200" = { | |
"description" = "drugs added", | |
"schema" = { | |
"type" = "object", | |
"required" = { | |
"email", | |
"username" | |
}, | |
"properties" = { | |
"email" = { | |
"type" = "string" | |
}, | |
"fullname" = { | |
"type" = "string" | |
}, | |
"username" = { | |
"type" = "string" | |
} | |
} | |
} | |
}, | |
"400" = { | |
"description" = "Invalid input" | |
}, | |
"404" = { | |
"description" = "resource not found" | |
} | |
}, | |
"summary" = "Add drugs to drugs_unified", | |
"consumes" = { | |
"application/json", | |
"text/html", | |
}, | |
"produces" = { | |
"application/json" | |
} | |
} | |
} | |
} | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment