This repository has been archived by the owner on Feb 28, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: improve swagger basepath handling (#269)
- Loading branch information
Showing
5 changed files
with
166 additions
and
6 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
swagger: '2.0' | ||
|
||
info: | ||
version: "0.0.1" | ||
title: Products API | ||
|
||
consumes: | ||
- text/plain | ||
|
||
produces: | ||
- application/json | ||
|
||
paths: | ||
/products: | ||
get: | ||
tags: | ||
- products | ||
operationId: getAll | ||
description: Get all products | ||
responses: | ||
200: | ||
$ref: '#/responses/getAllProducts' | ||
post: | ||
tags: | ||
- products | ||
operationId: add | ||
description: Add new product | ||
parameters: | ||
- $ref: '#/parameters/productNameParam' | ||
responses: | ||
200: | ||
$ref: '#/responses/getOneProduct' | ||
|
||
/products/{id}: | ||
get: | ||
tags: | ||
- products | ||
operationId: get | ||
description: Get product by ID | ||
parameters: | ||
- $ref: '#/parameters/idParam' | ||
responses: | ||
200: | ||
$ref: '#/responses/getOneProduct' | ||
|
||
delete: | ||
tags: | ||
- products | ||
operationId: delete | ||
description: Delete product by ID | ||
parameters: | ||
- $ref: '#/parameters/idParam' | ||
responses: | ||
200: | ||
$ref: '#/responses/getOneProduct' | ||
|
||
put: | ||
tags: | ||
- products | ||
operationId: update | ||
description: Update product by ID | ||
parameters: | ||
- $ref: '#/parameters/idParam' | ||
- $ref: '#/parameters/productNameParam' | ||
responses: | ||
200: | ||
$ref: '#/responses/getOneProduct' | ||
|
||
|
||
definitions: | ||
product: | ||
type: object | ||
description: A product object | ||
required: | ||
- id | ||
- name | ||
properties: | ||
id: | ||
type: integer | ||
format: int64 | ||
name: | ||
type: string | ||
|
||
responses: | ||
getOneProduct: | ||
description: One product | ||
schema: | ||
$ref: '#/definitions/product' | ||
|
||
getAllProducts: | ||
description: List of all products | ||
schema: | ||
type: array | ||
items: | ||
$ref: '#/definitions/product' | ||
|
||
parameters: | ||
idParam: | ||
name: id | ||
in: path | ||
description: Product ID | ||
required: true | ||
type: integer | ||
format: int64 | ||
|
||
productNameParam: | ||
name: productName | ||
in: body | ||
description: Product name | ||
required: true | ||
schema: | ||
type: string |
This file contains 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