fixed #124 : fix inter-document cross-references in security schemes

Added inter-document cross-references tests in AsciiDoc and Markdown format
This commit is contained in:
Hugo de Paix de Coeur
2016-04-08 17:39:40 +02:00
parent 293132e6a4
commit 6282459905
18 changed files with 2274 additions and 2 deletions

View File

@@ -609,7 +609,7 @@ public class PathsDocumentBuilder extends MarkupDocumentBuilder {
type = securityDefinitions.get(securityKey).getType();
}
List<String> content = Arrays.asList(boldText(type), boldText(docBuilder.copy(false).crossReference(securityKey, securityKey).toString()),
List<String> content = Arrays.asList(boldText(type), boldText(docBuilder.copy(false).crossReference(securityDocumentResolver(), securityKey, securityKey).toString()),
Joiner.on(",").join(securityEntry.getValue()));
cells.add(content);
}
@@ -618,6 +618,17 @@ public class PathsDocumentBuilder extends MarkupDocumentBuilder {
}
}
/**
* Resolve Security document for use in cross-references.
* @return document or null if cross-reference is not inter-document
*/
private String securityDocumentResolver() {
if (!config.isInterDocumentCrossReferencesEnabled() || outputPath == null)
return null;
else
return defaultString(config.getInterDocumentCrossReferencesPrefix()) + markupDocBuilder.addFileExtension(config.getSecurityDocument());
}
private List<ObjectType> buildResponsesSection(PathOperation operation, MarkupDocBuilder docBuilder) {
Map<String, Response> responses = operation.getOperation().getResponses();
List<ObjectType> inlineDefinitions = new ArrayList<>();

View File

@@ -97,7 +97,7 @@ public class SecurityDocumentBuilder extends MarkupDocumentBuilder {
}
private MarkupDocBuilder buildSecuritySchemeDefinitionTitle(String definitionName) {
return markupDocBuilder.sectionTitleLevel2(definitionName);
return markupDocBuilder.sectionTitleWithAnchorLevel2(definitionName);
}
private void buildSecurityScheme(SecuritySchemeDefinition securityScheme) {

View File

@@ -80,6 +80,29 @@ public class AsciidocConverterTest {
DiffUtils.assertThatAllFilesAreEqual(expectedFilesDirectory, outputDirectory, "testSwagger2AsciiDocConversion.html");
}
@Test
public void testSwagger2AsciiDocConversionWithInterDocumentCrossReferences() throws IOException, URISyntaxException {
//Given
Path file = Paths.get(AsciidocConverterTest.class.getResource("/yaml/swagger_petstore.yaml").toURI());
Path outputDirectory = Paths.get("build/test/asciidoc/idxref");
FileUtils.deleteQuietly(outputDirectory.toFile());
//When
Swagger2MarkupConfig config = new Swagger2MarkupConfigBuilder()
.withInterDocumentCrossReferences()
.build();
Swagger2MarkupConverter.from(file).withConfig(config).build()
.toFolder(outputDirectory);
//Then
String[] files = outputDirectory.toFile().list();
assertThat(files).hasSize(4).containsAll(expectedFiles);
Path expectedFilesDirectory = Paths.get(AsciidocConverterTest.class.getResource("/expected/asciidoc/idxref").toURI());
DiffUtils.assertThatAllFilesAreEqual(expectedFilesDirectory, outputDirectory, "testSwagger2AsciiDocConversionWithInterDocumentCrossReferences.html");
}
@Test
public void testSwagger2AsciiDocConversionFromString() throws IOException, URISyntaxException {
//Given
@@ -434,4 +457,6 @@ public class AsciidocConverterTest {
Path expectedFilesDirectory = Paths.get(AsciidocConverterTest.class.getResource("/expected/asciidoc/polymorphism").toURI());
DiffUtils.assertThatAllFilesAreEqual(expectedFilesDirectory, outputDirectory, "testSwagger2AsciiDocConversionWithPolymorphism.html");
}
}

View File

@@ -78,6 +78,30 @@ public class MarkdownConverterTest {
DiffUtils.assertThatAllFilesAreEqual(expectedFilesDirectory, outputDirectory, "testSwagger2MarkdownConversion.html");
}
@Test
public void testSwagger2MarkdownConversionWithInterDocumentCrossReferences() throws IOException, URISyntaxException {
//Given
Path file = Paths.get(AsciidocConverterTest.class.getResource("/yaml/swagger_petstore.yaml").toURI());
Path outputDirectory = Paths.get("build/test/markdown/idxref");
FileUtils.deleteQuietly(outputDirectory.toFile());
//When
Swagger2MarkupConfig config = new Swagger2MarkupConfigBuilder()
.withMarkupLanguage(MarkupLanguage.MARKDOWN)
.withInterDocumentCrossReferences()
.build();
Swagger2MarkupConverter.from(file).withConfig(config).build()
.toFolder(outputDirectory);
//Then
String[] files = outputDirectory.toFile().list();
assertThat(files).hasSize(4).containsAll(expectedFiles);
Path expectedFilesDirectory = Paths.get(AsciidocConverterTest.class.getResource("/expected/markdown/idxref").toURI());
DiffUtils.assertThatAllFilesAreEqual(expectedFilesDirectory, outputDirectory, "testSwagger2MarkdownConversionWithInterDocumentCrossReferences.html");
}
@Test
public void testSwagger2MarkdownConversionWithSeparatedDefinitions() throws IOException, URISyntaxException {
//Given

View File

@@ -2,6 +2,7 @@
[[_securityscheme]]
== Security
[[_api_key]]
=== api_key
[%hardbreaks]
_Type_ : apiKey
@@ -9,6 +10,7 @@ _Name_ : api_key
_In_ : HEADER
[[_petstore_auth]]
=== petstore_auth
[%hardbreaks]
_Type_ : oauth2

View File

@@ -2,6 +2,7 @@
[[_securityscheme]]
== Security
[[_api_key]]
=== api_key
[%hardbreaks]
_Type_ : apiKey
@@ -9,6 +10,7 @@ _Name_ : api_key
_In_ : HEADER
[[_petstore_auth]]
=== petstore_auth
[%hardbreaks]
_Type_ : oauth2

View File

@@ -2,6 +2,7 @@
[[_securityscheme]]
== Security
[[_api_key]]
=== api_key
[%hardbreaks]
_Type_ : apiKey
@@ -9,6 +10,7 @@ _Name_ : api_key
_In_ : HEADER
[[_petstore_auth]]
=== petstore_auth
[%hardbreaks]
_Type_ : oauth2

View File

@@ -2,6 +2,7 @@
[[_securityscheme]]
== Security
[[_api_key]]
=== api_key
[%hardbreaks]
_Type_ : apiKey
@@ -9,6 +10,7 @@ _Name_ : api_key
_In_ : HEADER
[[_petstore_auth]]
=== petstore_auth
[%hardbreaks]
_Type_ : oauth2

View File

@@ -0,0 +1,98 @@
[[_definitions]]
== Definitions
[[_category]]
=== Category
[options="header", cols=".^1,.^4,.^2,.^1"]
|===
|Name|Description|Schema|Default
|*id* +
_optional_||integer(int64)|
|*name* +
_optional_||string|
|===
[[_order]]
=== Order
[options="header", cols=".^1,.^4,.^2,.^1"]
|===
|Name|Description|Schema|Default
|*complete* +
_optional_||boolean|
|*id* +
_optional_||integer(int64)|
|*petId* +
_optional_||integer(int64)|
|*quantity* +
_optional_||integer(int32)|
|*shipDate* +
_optional_||string(date-time)|
|*status* +
_optional_|Order Status|enum (Ordered, Cancelled)|
|===
[[_pet]]
=== Pet
[options="header", cols=".^1,.^4,.^2,.^1"]
|===
|Name|Description|Schema|Default
|*category* +
_optional_||<<definitions.adoc#_category,Category>>|
|*id* +
_optional_||integer(int64)|
|*name* +
_required_|*Example* : `"doggie"`|string|
|*photoUrls* +
_required_||<string> array|
|*status* +
_optional_|pet status in the store,|enum (Dead, Alive)|
|*tags* +
_optional_||< <<definitions.adoc#_tag,Tag>>> array|
|===
[[_tag]]
=== Tag
[options="header", cols=".^1,.^4,.^2,.^1"]
|===
|Name|Description|Schema|Default
|*id* +
_optional_||integer(int64)|
|*name* +
_optional_||string|
|===
[[_user]]
=== User
[options="header", cols=".^1,.^4,.^2,.^1"]
|===
|Name|Description|Schema|Default
|*email* +
_optional_||string|
|*firstName* +
_optional_||string|
|*id* +
_optional_||integer(int64)|
|*lastName* +
_optional_||string|
|*password* +
_optional_||string|
|*phone* +
_optional_||string|
|*userStatus* +
_optional_|User Status|integer(int32)|
|*username* +
_optional_||string|
|===

View File

@@ -0,0 +1,44 @@
= Swagger Petstore
[[_overview]]
== Overview
This is a sample server Petstore server.
http://swagger.io[Learn about Swagger] or join the IRC channel `#swagger` on irc.freenode.net.
For this sample, you can use the api key `special-key` to test the authorization filters
=== Version information
[%hardbreaks]
_Version_ : 1.0.0
=== Contact information
[%hardbreaks]
_Contact_ : apiteam@swagger.io
=== License information
[%hardbreaks]
_License_ : Apache 2.0
_License URL_ : http://www.apache.org/licenses/LICENSE-2.0.html
_Terms of service_ : http://helloreverb.com/terms/
=== URI scheme
[%hardbreaks]
_Host_ : petstore.swagger.io
_BasePath_ : /v2
_Schemes_ : HTTP
=== Tags
* pet : Pet resource
* store : Store resource
* user : User resource

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,29 @@
[[_securityscheme]]
== Security
[[_api_key]]
=== api_key
[%hardbreaks]
_Type_ : apiKey
_Name_ : api_key
_In_ : HEADER
[[_petstore_auth]]
=== petstore_auth
[%hardbreaks]
_Type_ : oauth2
_Flow_ : implicit
_Token URL_ : http://petstore.swagger.io/api/oauth/dialog
[options="header", cols="1,6"]
|===
|Name|Description
|write_pets|modify pets in your account
|read_pets|read your pets
|===

View File

@@ -1593,6 +1593,7 @@ _optional_|*Example* : `"string"`|string|
[[_securityscheme]]
== Security
[[_api_key]]
=== api_key
[%hardbreaks]
_Type_ : apiKey
@@ -1600,6 +1601,7 @@ _Name_ : api_key
_In_ : HEADER
[[_petstore_auth]]
=== petstore_auth
[%hardbreaks]
_Type_ : oauth2

View File

@@ -2,12 +2,14 @@
<a name="securityscheme"></a>
## Security
<a name="api_key"></a>
### api_key
*Type* : apiKey
*Name* : api_key
*In* : HEADER
<a name="petstore_auth"></a>
### petstore_auth
*Type* : oauth2
*Flow* : implicit

View File

@@ -0,0 +1,64 @@
<a name="definitions"></a>
## Definitions
<a name="category"></a>
### Category
|Name|Description|Schema|Default|
|---|---|---|---|
|**id** <br>*optional*||integer(int64)||
|**name** <br>*optional*||string||
<a name="order"></a>
### Order
|Name|Description|Schema|Default|
|---|---|---|---|
|**complete** <br>*optional*||boolean||
|**id** <br>*optional*||integer(int64)||
|**petId** <br>*optional*||integer(int64)||
|**quantity** <br>*optional*||integer(int32)||
|**shipDate** <br>*optional*||string(date-time)||
|**status** <br>*optional*|Order Status|enum (Ordered, Cancelled)||
<a name="pet"></a>
### Pet
|Name|Description|Schema|Default|
|---|---|---|---|
|**category** <br>*optional*||[Category](definitions.md#category)||
|**id** <br>*optional*||integer(int64)||
|**name** <br>*required*|**Example** : `"doggie"`|string||
|**photoUrls** <br>*required*||<string> array||
|**status** <br>*optional*|pet status in the store,|enum (Dead, Alive)||
|**tags** <br>*optional*||<[Tag](definitions.md#tag)> array||
<a name="tag"></a>
### Tag
|Name|Description|Schema|Default|
|---|---|---|---|
|**id** <br>*optional*||integer(int64)||
|**name** <br>*optional*||string||
<a name="user"></a>
### User
|Name|Description|Schema|Default|
|---|---|---|---|
|**email** <br>*optional*||string||
|**firstName** <br>*optional*||string||
|**id** <br>*optional*||integer(int64)||
|**lastName** <br>*optional*||string||
|**password** <br>*optional*||string||
|**phone** <br>*optional*||string||
|**userStatus** <br>*optional*|User Status|integer(int32)||
|**username** <br>*optional*||string||

View File

@@ -0,0 +1,40 @@
# Swagger Petstore
<a name="overview"></a>
## Overview
This is a sample server Petstore server.
[Learn about Swagger](http://swagger.io) or join the IRC channel `#swagger` on irc.freenode.net.
For this sample, you can use the api key `special-key` to test the authorization filters
### Version information
*Version* : 1.0.0
### Contact information
*Contact* : apiteam@swagger.io
### License information
*License* : Apache 2.0
*License URL* : http://www.apache.org/licenses/LICENSE-2.0.html
*Terms of service* : http://helloreverb.com/terms/
### URI scheme
*Host* : petstore.swagger.io
*BasePath* : /v2
*Schemes* : HTTP
### Tags
* pet : Pet resource
* store : Store resource
* user : User resource

View File

@@ -0,0 +1,875 @@
<a name="paths"></a>
## Paths
<a name="addpet"></a>
### Add a new pet to the store
```
POST /pets
```
#### Parameters
|Type|Name|Description|Schema|Default|
|---|---|---|---|---|
|**Body**|**body** <br>*optional*|Pet object that needs to be added to the store|[Pet](definitions.md#pet)||
#### Responses
##### HTTP Code 405
|HTTP Code|Description|Schema|
|---|---|---|
|**405**|Invalid input|No Content|
#### Consumes
* `application/json`
* `application/xml`
#### Produces
* `application/json`
* `application/xml`
#### Tags
* pet
#### Security
|Type|Name|Scopes|
|---|---|---|
|**oauth2**|**[petstore_auth](security.md#petstore_auth)**|write_pets,read_pets|
<a name="updatepet"></a>
### Update an existing pet
```
PUT /pets
```
#### Parameters
|Type|Name|Description|Schema|Default|
|---|---|---|---|---|
|**Body**|**body** <br>*optional*|Pet object that needs to be added to the store|[Pet](definitions.md#pet)||
#### Responses
##### HTTP Code 400
|HTTP Code|Description|Schema|
|---|---|---|
|**400**|Invalid ID supplied|No Content|
##### HTTP Code 404
|HTTP Code|Description|Schema|
|---|---|---|
|**404**|Pet not found|No Content|
##### HTTP Code 405
|HTTP Code|Description|Schema|
|---|---|---|
|**405**|Validation exception|No Content|
#### Consumes
* `application/json`
* `application/xml`
#### Produces
* `application/json`
* `application/xml`
#### Tags
* pet
#### Security
|Type|Name|Scopes|
|---|---|---|
|**oauth2**|**[petstore_auth](security.md#petstore_auth)**|write_pets,read_pets|
<a name="findpetsbystatus"></a>
### Finds Pets by status
```
GET /pets/findByStatus
```
#### Description
Multiple status values can be provided with comma seperated strings
#### Parameters
|Type|Name|Description|Schema|Default|
|---|---|---|---|---|
|**Query**|**status** <br>*optional*|Status values that need to be considered for filter|<string> array(multi)||
#### Responses
##### HTTP Code 200
|HTTP Code|Description|Schema|
|---|---|---|
|**200**|successful operation|<[Pet](definitions.md#pet)> array|
**Headers**
|Name|Description|Schema|Default|
|---|---|---|---|
|**X-Rate-Limit-Limit**|The number of allowed requests in the current period|integer||
|**X-Rate-Limit-Remaining**|The number of remaining requests in the current period|integer||
|**X-Rate-Limit-Reset**|The number of seconds left in the current period|integer||
##### HTTP Code 400
|HTTP Code|Description|Schema|
|---|---|---|
|**400**|Invalid status value|No Content|
#### Produces
* `application/json`
* `application/xml`
#### Tags
* pet
#### Security
|Type|Name|Scopes|
|---|---|---|
|**oauth2**|**[petstore_auth](security.md#petstore_auth)**|write_pets,read_pets|
<a name="findpetsbytags"></a>
### Finds Pets by tags
```
GET /pets/findByTags
```
#### Description
Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.
#### Parameters
|Type|Name|Description|Schema|Default|
|---|---|---|---|---|
|**Query**|**tags** <br>*optional*|Tags to filter by|<string> array(multi)||
#### Responses
##### HTTP Code 200
|HTTP Code|Description|Schema|
|---|---|---|
|**200**|successful operation|<[Pet](definitions.md#pet)> array|
**Headers**
|Name|Description|Schema|Default|
|---|---|---|---|
|**X-Rate-Limit-Limit**|The number of allowed requests in the current period|integer||
|**X-Rate-Limit-Remaining**|The number of remaining requests in the current period|integer||
|**X-Rate-Limit-Reset**|The number of seconds left in the current period|integer||
##### HTTP Code 400
|HTTP Code|Description|Schema|
|---|---|---|
|**400**|Invalid tag value|No Content|
#### Produces
* `application/json`
* `application/xml`
#### Tags
* pet
#### Security
|Type|Name|Scopes|
|---|---|---|
|**oauth2**|**[petstore_auth](security.md#petstore_auth)**|write_pets,read_pets|
<a name="updatepetwithform"></a>
### Updates a pet in the store with form data
```
POST /pets/{petId}
```
#### Parameters
|Type|Name|Description|Schema|Default|
|---|---|---|---|---|
|**Path**|**petId** <br>*required*|ID of pet that needs to be updated|string||
|**FormData**|**name** <br>*required*|Updated name of the pet|string||
|**FormData**|**status** <br>*required*|Updated status of the pet|string||
#### Responses
##### HTTP Code 405
|HTTP Code|Description|Schema|
|---|---|---|
|**405**|Invalid input|No Content|
#### Consumes
* `application/x-www-form-urlencoded`
#### Produces
* `application/json`
* `application/xml`
#### Tags
* pet
#### Security
|Type|Name|Scopes|
|---|---|---|
|**oauth2**|**[petstore_auth](security.md#petstore_auth)**|write_pets,read_pets|
<a name="getpetbyid"></a>
### Find pet by ID
```
GET /pets/{petId}
```
#### Description
Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
#### Parameters
|Type|Name|Description|Schema|Default|
|---|---|---|---|---|
|**Path**|**petId** <br>*required*|ID of pet that needs to be fetched|integer(int64)||
#### Responses
##### HTTP Code 200
|HTTP Code|Description|Schema|
|---|---|---|
|**200**|successful operation|[Pet](definitions.md#pet)|
**Headers**
|Name|Description|Schema|Default|
|---|---|---|---|
|**X-Rate-Limit-Limit**|The number of allowed requests in the current period|integer||
|**X-Rate-Limit-Remaining**|The number of remaining requests in the current period|integer||
|**X-Rate-Limit-Reset**|The number of seconds left in the current period|integer||
##### HTTP Code 400
|HTTP Code|Description|Schema|
|---|---|---|
|**400**|Invalid ID supplied|No Content|
##### HTTP Code 404
|HTTP Code|Description|Schema|
|---|---|---|
|**404**|Pet not found|No Content|
#### Produces
* `application/json`
* `application/xml`
#### Tags
* pet
#### Security
|Type|Name|Scopes|
|---|---|---|
|**apiKey**|**[api_key](security.md#api_key)**||
|**oauth2**|**[petstore_auth](security.md#petstore_auth)**|write_pets,read_pets|
<a name="deletepet"></a>
### Deletes a pet
```
DELETE /pets/{petId}
```
#### Parameters
|Type|Name|Description|Schema|Default|
|---|---|---|---|---|
|**Header**|**api_key** <br>*required*||string||
|**Path**|**petId** <br>*required*|Pet id to delete|integer(int64)||
#### Responses
##### HTTP Code 400
|HTTP Code|Description|Schema|
|---|---|---|
|**400**|Invalid pet value|No Content|
#### Produces
* `application/json`
* `application/xml`
#### Tags
* pet
#### Security
|Type|Name|Scopes|
|---|---|---|
|**oauth2**|**[petstore_auth](security.md#petstore_auth)**|write_pets,read_pets|
<a name="placeorder"></a>
### Place an order for a pet
```
POST /stores/order
```
#### Parameters
|Type|Name|Description|Schema|Default|
|---|---|---|---|---|
|**Body**|**body** <br>*optional*|order placed for purchasing the pet|[Order](definitions.md#order)||
#### Responses
##### HTTP Code 200
|HTTP Code|Description|Schema|
|---|---|---|
|**200**|successful operation|[Order](definitions.md#order)|
**Headers**
|Name|Description|Schema|Default|
|---|---|---|---|
|**X-Rate-Limit-Limit**|The number of allowed requests in the current period|integer||
|**X-Rate-Limit-Remaining**|The number of remaining requests in the current period|integer||
|**X-Rate-Limit-Reset**|The number of seconds left in the current period|integer||
##### HTTP Code 400
|HTTP Code|Description|Schema|
|---|---|---|
|**400**|Invalid Order|No Content|
#### Produces
* `application/json`
* `application/xml`
#### Tags
* store
<a name="getorderbyid"></a>
### Find purchase order by ID
```
GET /stores/order/{orderId}
```
#### Description
For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
#### Parameters
|Type|Name|Description|Schema|Default|
|---|---|---|---|---|
|**Path**|**orderId** <br>*required*|ID of pet that needs to be fetched|string||
#### Responses
##### HTTP Code 200
|HTTP Code|Description|Schema|
|---|---|---|
|**200**|successful operation|[Order](definitions.md#order)|
**Headers**
|Name|Description|Schema|Default|
|---|---|---|---|
|**X-Rate-Limit-Limit**|The number of allowed requests in the current period|integer||
|**X-Rate-Limit-Remaining**|The number of remaining requests in the current period|integer||
|**X-Rate-Limit-Reset**|The number of seconds left in the current period|integer||
##### HTTP Code 400
|HTTP Code|Description|Schema|
|---|---|---|
|**400**|Invalid ID supplied|No Content|
##### HTTP Code 404
|HTTP Code|Description|Schema|
|---|---|---|
|**404**|Order not found|No Content|
#### Produces
* `application/json`
* `application/xml`
#### Tags
* store
<a name="deleteorder"></a>
### Delete purchase order by ID
```
DELETE /stores/order/{orderId}
```
#### Description
For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
#### Parameters
|Type|Name|Description|Schema|Default|
|---|---|---|---|---|
|**Path**|**orderId** <br>*required*|ID of the order that needs to be deleted|string||
#### Responses
##### HTTP Code 400
|HTTP Code|Description|Schema|
|---|---|---|
|**400**|Invalid ID supplied|No Content|
##### HTTP Code 404
|HTTP Code|Description|Schema|
|---|---|---|
|**404**|Order not found|No Content|
#### Produces
* `application/json`
* `application/xml`
#### Tags
* store
<a name="createuser"></a>
### Create user
```
POST /users
```
#### Description
This can only be done by the logged in user.
#### Parameters
|Type|Name|Description|Schema|Default|
|---|---|---|---|---|
|**Body**|**body** <br>*optional*|Created user object|[User](definitions.md#user)||
#### Responses
##### HTTP Code default
|HTTP Code|Description|Schema|
|---|---|---|
|**default**|successful operation|No Content|
#### Produces
* `application/json`
* `application/xml`
#### Tags
* user
<a name="createuserswitharrayinput"></a>
### Creates list of users with given input array
```
POST /users/createWithArray
```
#### Parameters
|Type|Name|Description|Schema|Default|
|---|---|---|---|---|
|**Body**|**body** <br>*optional*|List of user object|<[User](definitions.md#user)> array||
#### Responses
##### HTTP Code default
|HTTP Code|Description|Schema|
|---|---|---|
|**default**|successful operation|No Content|
#### Produces
* `application/json`
* `application/xml`
#### Tags
* user
<a name="createuserswithlistinput"></a>
### Creates list of users with given input array
```
POST /users/createWithList
```
#### Parameters
|Type|Name|Description|Schema|Default|
|---|---|---|---|---|
|**Body**|**body** <br>*optional*|List of user object|<[User](definitions.md#user)> array||
#### Responses
##### HTTP Code default
|HTTP Code|Description|Schema|
|---|---|---|
|**default**|successful operation|No Content|
#### Produces
* `application/json`
* `application/xml`
#### Tags
* user
<a name="loginuser"></a>
### Logs user into the system
```
GET /users/login
```
#### Parameters
|Type|Name|Description|Schema|Default|
|---|---|---|---|---|
|**Query**|**password** <br>*optional*|The password for login in clear text|string||
|**Query**|**username** <br>*optional*|The user name for login|string||
#### Responses
##### HTTP Code 200
|HTTP Code|Description|Schema|
|---|---|---|
|**200**|successful operation|string|
**Headers**
|Name|Description|Schema|Default|
|---|---|---|---|
|**X-Rate-Limit-Limit**|The number of allowed requests in the current period|integer||
|**X-Rate-Limit-Remaining**|The number of remaining requests in the current period|integer||
|**X-Rate-Limit-Reset**|The number of seconds left in the current period|integer||
##### HTTP Code 400
|HTTP Code|Description|Schema|
|---|---|---|
|**400**|Invalid username/password supplied|No Content|
#### Produces
* `application/json`
* `application/xml`
#### Tags
* user
<a name="logoutuser"></a>
### Logs out current logged in user session
```
GET /users/logout
```
#### Responses
##### HTTP Code default
|HTTP Code|Description|Schema|
|---|---|---|
|**default**|successful operation|No Content|
#### Produces
* `application/json`
* `application/xml`
#### Tags
* user
<a name="getuserbyname"></a>
### Get user by user name
```
GET /users/{username}
```
#### Parameters
|Type|Name|Description|Schema|Default|
|---|---|---|---|---|
|**Path**|**username** <br>*required*|The name that needs to be fetched. Use user1 for testing.|string||
#### Responses
##### HTTP Code 200
|HTTP Code|Description|Schema|
|---|---|---|
|**200**|successful operation|[User](definitions.md#user)|
**Headers**
|Name|Description|Schema|Default|
|---|---|---|---|
|**X-Rate-Limit-Limit**|The number of allowed requests in the current period|integer||
|**X-Rate-Limit-Remaining**|The number of remaining requests in the current period|integer||
|**X-Rate-Limit-Reset**|The number of seconds left in the current period|integer||
##### HTTP Code 400
|HTTP Code|Description|Schema|
|---|---|---|
|**400**|Invalid username supplied|No Content|
##### HTTP Code 404
|HTTP Code|Description|Schema|
|---|---|---|
|**404**|User not found|No Content|
#### Produces
* `application/json`
* `application/xml`
#### Tags
* user
<a name="updateuser"></a>
### Updated user
```
PUT /users/{username}
```
#### Description
This can only be done by the logged in user.
#### Parameters
|Type|Name|Description|Schema|Default|
|---|---|---|---|---|
|**Path**|**username** <br>*required*|name that need to be deleted|string||
|**Body**|**body** <br>*optional*|Updated user object|[User](definitions.md#user)||
#### Responses
##### HTTP Code 400
|HTTP Code|Description|Schema|
|---|---|---|
|**400**|Invalid user supplied|No Content|
##### HTTP Code 404
|HTTP Code|Description|Schema|
|---|---|---|
|**404**|User not found|No Content|
#### Produces
* `application/json`
* `application/xml`
#### Tags
* user
<a name="deleteuser"></a>
### Delete user
```
DELETE /users/{username}
```
#### Description
This can only be done by the logged in user.
#### Parameters
|Type|Name|Description|Schema|Default|
|---|---|---|---|---|
|**Path**|**username** <br>*required*|The name that needs to be deleted|string||
#### Responses
##### HTTP Code 400
|HTTP Code|Description|Schema|
|---|---|---|
|**400**|Invalid username supplied|No Content|
##### HTTP Code 404
|HTTP Code|Description|Schema|
|---|---|---|
|**404**|User not found|No Content|
#### Produces
* `application/json`
* `application/xml`
#### Tags
* user

View File

@@ -0,0 +1,25 @@
<a name="securityscheme"></a>
## Security
<a name="api_key"></a>
### api_key
*Type* : apiKey
*Name* : api_key
*In* : HEADER
<a name="petstore_auth"></a>
### petstore_auth
*Type* : oauth2
*Flow* : implicit
*Token URL* : http://petstore.swagger.io/api/oauth/dialog
|Name|Description|
|---|---|
|write_pets|modify pets in your account|
|read_pets|read your pets|