Showing preview only (424K chars total). Download the full file or copy to clipboard to get everything.
Repository: abelsilva/swaggerwcf
Branch: master
Commit: 3b0bc754a2cc
Files: 102
Total size: 394.2 KB
Directory structure:
gitextract_tza6k42w/
├── .gitignore
├── .gitmodules
├── LICENSE
├── README.md
├── notes/
│ ├── samples/
│ │ ├── petstore-expanded.json
│ │ ├── petstore-minimal.json
│ │ ├── petstore-simple.json
│ │ ├── petstore-with-external-docs.json
│ │ └── petstore.json
│ ├── schema.json
│ └── spec-2.0.md
└── src/
├── SwaggerWcf/
│ ├── Attributes/
│ │ ├── SwaggerWcfAttribute.cs
│ │ ├── SwaggerWcfContactInfoAttribute.cs
│ │ ├── SwaggerWcfContentTypesAttribute.cs
│ │ ├── SwaggerWcfDefinitionAttribute.cs
│ │ ├── SwaggerWcfHeaderAttribute.cs
│ │ ├── SwaggerWcfHiddenAttribute.cs
│ │ ├── SwaggerWcfLicenseInfoAttribute.cs
│ │ ├── SwaggerWcfParameterAttribute.cs
│ │ ├── SwaggerWcfPathAttribute.cs
│ │ ├── SwaggerWcfPropertyAttribute.cs
│ │ ├── SwaggerWcfRegexAttribute.cs
│ │ ├── SwaggerWcfRequestTypeAttribute.cs
│ │ ├── SwaggerWcfResponseAttribute.cs
│ │ ├── SwaggerWcfReturnTypeAttribute.cs
│ │ ├── SwaggerWcfSecurityAttribute.cs
│ │ ├── SwaggerWcfServiceInfoAttribute.cs
│ │ └── SwaggerWcfTagAttribute.cs
│ ├── Configuration/
│ │ ├── SettingCollection.cs
│ │ ├── SettingElement.cs
│ │ ├── SwaggerWcfSection.cs
│ │ ├── TagCollection.cs
│ │ └── TagElement.cs
│ ├── ISwaggerWcfEndpoint.cs
│ ├── Models/
│ │ ├── CollectionFormat.cs
│ │ ├── Definition.cs
│ │ ├── DefinitionProperty.cs
│ │ ├── DefinitionSchema.cs
│ │ ├── Example.cs
│ │ ├── ExternalDocumentation.cs
│ │ ├── InType.cs
│ │ ├── Info.cs
│ │ ├── InfoContact.cs
│ │ ├── InfoLicense.cs
│ │ ├── ParameterBase.cs
│ │ ├── ParameterItems.cs
│ │ ├── ParameterPrimitive.cs
│ │ ├── ParameterSchema.cs
│ │ ├── ParameterType.cs
│ │ ├── Path.cs
│ │ ├── PathAction.cs
│ │ ├── Property.cs
│ │ ├── Response.cs
│ │ ├── Schema.cs
│ │ ├── SecurityAuthorization.cs
│ │ ├── SecurityDefinitions.cs
│ │ ├── Service.cs
│ │ └── TypeFormat.cs
│ ├── Properties/
│ │ └── AssemblyInfo.cs
│ ├── Support/
│ │ ├── DefinitionsBuilder.cs
│ │ ├── EnumerableExtensions.cs
│ │ ├── Helpers.cs
│ │ ├── ListExtensions.cs
│ │ ├── Mapper.cs
│ │ ├── MethodInfoExtensions.cs
│ │ ├── Serializer.cs
│ │ ├── ServiceBuilder.cs
│ │ ├── StaticContent.cs
│ │ ├── TypeBuilder.cs
│ │ ├── TypeExtensions.cs
│ │ ├── TypeFieldsProcessor.cs
│ │ └── TypePropertiesProcessor.cs
│ ├── SwaggerWcf.csproj
│ ├── SwaggerWcf.csproj.DotSettings
│ ├── SwaggerWcf.nuspec
│ ├── SwaggerWcfEndpoint.cs
│ ├── SwaggerWcfEndpointGeneric.cs
│ └── packages.config
├── SwaggerWcf.Test.Service/
│ ├── AuthorService.cs
│ ├── BaseService.cs
│ ├── Data/
│ │ ├── Author.cs
│ │ ├── Book.cs
│ │ ├── Language.cs
│ │ └── Store.cs
│ ├── Global.asax
│ ├── Global.asax.cs
│ ├── IAuthorService.cs
│ ├── IBaseCRUDService.cs
│ ├── IBaseService.cs
│ ├── IStore.cs
│ ├── Properties/
│ │ └── AssemblyInfo.cs
│ ├── Store.svc
│ ├── Store.svc.cs
│ ├── SwaggerWcf.Test.Service.csproj
│ ├── SwaggerWcf.Test.Service.csproj.DotSettings
│ ├── Web.Debug.config
│ ├── Web.Release.config
│ └── Web.config
├── SwaggerWcf.sln
├── SwaggerWcf.sln.DotSettings
└── packages/
├── .gitignore
└── repositories.config
================================================
FILE CONTENTS
================================================
================================================
FILE: .gitignore
================================================
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
# User-specific files
.vs
*.suo
*.user
*.sln.docstates
# build packages
*.nupkg
# Build results
[Dd]ebug/
[Rr]elease/
x64/
build/
[Bb]in/
[Oo]bj/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
*_i.c
*_p.c
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.log
*.scc
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opensdf
*.sdf
*.cachefile
# Visual Studio profiler
*.psess
*.vsp
*.vspx
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# NCrunch
*.ncrunch*
.*crunch*.local.xml
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.Publish.xml
*.pubxml
# NuGet Packages Directory
## TODO: If you have NuGet Package Restore enabled, uncomment the next line
#packages/
# Windows Azure Build Output
csx
*.build.csdef
# Windows Store app package directory
AppPackages/
# Others
sql/
*.Cache
ClientBin/
[Ss]tyle[Cc]op.*
~$*
*~
*.dbmdl
*.[Pp]ublish.xml
*.pfx
*.publishsettings
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file to a newer
# Visual Studio version. Backup files are not needed, because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
# SQL Server files
App_Data/*.mdf
App_Data/*.ldf
# =========================
# Windows detritus
# =========================
# Windows image file caches
Thumbs.db
ehthumbs.db
# Folder config file
Desktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
# Mac crap
.DS_Store
# custom entries
/src/SampleService/obj
================================================
FILE: .gitmodules
================================================
[submodule "src/SampleService/swagger-ui"]
path = src/SampleService/swagger-ui
url = https://github.com/wordnik/swagger-ui.git
================================================
FILE: LICENSE
================================================
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "{}"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright {yyyy} {name of copyright owner}
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
================================================
FILE: README.md
================================================
<h1 align="left">
SwaggerWcf <a href="https://www.nuget.org/packages/SwaggerWcf">
<img src="http://img.shields.io/nuget/v/SwaggerWcf.svg?style=flat" alt="nuget status">
</a>
</h1>
Generates [Swagger](http://swagger.io/) (2.0) for WCF services and also provides [swagger-ui](https://github.com/swagger-api/swagger-ui).
With an API described in Swagger you can use multiple Swagger tools like client generators, see [swagger-codegen](https://github.com/swagger-api/swagger-codegen) for more details.
This project has started as a fork from [superstator/Swaggeratr](https://github.com/superstator/Swaggeratr) to implement version 2.0 of Swagger.
## Getting Started
### Step 1: Install SwaggerWcf package
```
Install-Package SwaggerWcf
```
### Step 2: Configure WCF
#### ASP.NET
Add the route in the `Application_Start` method inside `Global.asax`
```csharp
protected void Application_Start(object sender, EventArgs e)
{
// [.......]
RouteTable.Routes.Add(new ServiceRoute("api-docs", new WebServiceHostFactory(), typeof(SwaggerWcfEndpoint)));
}
```
Note: You might need to add a reference to `System.ServiceModel.Activation`
Edit `Web.config` and add the following (if it doesn't exist yet) inside the `system.serviceModel` block
```xml
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true"/>
```
Edit again `Web.config` and add the following (if it doesn't exist yet) inside the `system.webServer` block
```xml
<modules runAllManagedModulesForAllRequests="true"/>
```
#### Self Hosted
Add an endpoint to your App.config file.
```xml
<services>
<service name="SwaggerWcf.SwaggerWcfEndpoint">
<endpoint address="http://localhost/docs" binding="webHttpBinding" contract="SwaggerWcf.ISwaggerWcfEndpoint" />
</service>
</services>
```
Create a WebServiceHost
```csharp
var swaggerHost = new WebServiceHost(typeof(SwaggerWcfEndpoint));
swaggerHost.Open();
```
### Step 3: Optionaly configure WCF response auto types
Add the following to your config file.
This will allow the WCF service to accept requests and send replies based on the `Content-Type` headers.
```xml
<system.serviceModel>
<behaviors>
<endpointBehaviors>
<behavior>
<webHttp automaticFormatSelectionEnabled="true" />
</behavior>
</endpointBehaviors>
<!-- [.......] -->
</behaviors>
</system.serviceModel>
```
### Step 4: Configure WCF services general information
#### Configure via config file
Add the following to your config file and change the values accordingly
```xml
<configSections>
<section name="swaggerwcf" type="SwaggerWcf.Configuration.SwaggerWcfSection, SwaggerWcf" />
</configSections>
<swaggerwcf>
<tags>
<tag name="LowPerformance" visible="false" />
</tags>
<settings>
<setting name="InfoDescription" value="Sample Service to test SwaggerWCF" />
<setting name="InfoVersion" value="0.0.1" />
<setting name="InfoTermsOfService" value="Terms of Service" />
<setting name="InfoTitle" value="SampleService" />
<setting name="InfoContactName" value="Abel Silva" />
<setting name="InfoContactUrl" value="http://github.com/abelsilva" />
<setting name="InfoContactEmail" value="no@e.mail" />
<setting name="InfoLicenseUrl" value="https://github.com/abelsilva/SwaggerWCF/blob/master/LICENSE" />
<setting name="InfoLicenseName" value="Apache License" />
</settings>
</swaggerwcf>
```
Notes:
* make sure the `configSections` block is the first child of `configuration`
* `tags` will be described further down
#### Configure via code
Configure the base properties via code. New: You can add security settings to your api (see also the new Security-Methodattribute)
```csharp
var info = new Info
{
Description = "Sample Service to test SwaggerWCF",
Version = "0.0.1"
// etc
};
var security = new SecurityDefinitions
{
{
"api-gateway", new SecurityAuthorization
{
Type = "oauth2",
Name = "api-gateway",
Description = "Forces authentication with credentials via an api gateway",
Flow = "password",
Scopes = new Dictionary<string, string="">
{
{ "author", "use author scope"},
{ "admin", "use admin scope"},
},
AuthorizationUrl = "http://yourapi.net/oauth/token"
}
}
};
SwaggerWcfEndpoint.Configure(info, security);
```
### Step 5: Decorate WCF services interfaces
For each method, configure the `WebInvoke` or `WebGet` attribute, and add a `SwaggerWcfPath` attribute.
```csharp
[ServiceContract]
public interface IStore
{
[SwaggerWcfPath("Create book", "Create a book on the store")]
[WebInvoke(UriTemplate = "/books",
BodyStyle = WebMessageBodyStyle.Bare,
Method = "POST",
RequestFormat = WebMessageFormat.Json,
ResponseFormat = WebMessageFormat.Json)]
[OperationContract]
Book CreateBook(Book value);
// [.......]
}
```
### Step 6: Decorate WCF services class
Add the `SwaggerWcf` and `AspNetCompatibilityRequirements` attributes to the class providing the base path for the service (the same as used in step 2).
Optinally, for each method, add the `SwaggerWcfTag` to categorize the method and the `SwaggerWcfResponse` for each possible response from the service.
```csharp
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
[SwaggerWcf("/v1/rest")]
public class BookStore : IStore
{
[SwaggerWcfTag("Books")]
[SwaggerWcfResponse(HttpStatusCode.Created, "Book created, value in the response body with id updated")]
[SwaggerWcfResponse(HttpStatusCode.BadRequest, "Bad request", true)]
[SwaggerWcfResponse(HttpStatusCode.InternalServerError,
"Internal error (can be forced using ERROR_500 as book title)", true)]
public Book CreateBook(Book value)
{
// [.......]
}
// [.......]
}
```
### Step 7: Decorate data types used in WCF services
```csharp
[DataContract(Name = "book")]
[Description("Book with title, first publish date, author and language")]
[SwaggerWcfDefinition(ExternalDocsUrl = "http://en.wikipedia.org/wiki/Book", ExternalDocsDescription = "Description of a book")]
public class Book
{
[DataMember(Name = "id")]
[Description("Book ID")]
public string Id { get; set; }
// [.......]
}
```
Note: make sure you add at least the `DataContract` and `DataMember` attributes in classes and properties
## Attributes
| Attribute | Used in | Description | Options |
| ------------------------ |------------------------------------------- | -------------------------------------- | --------------------------------------------------------------------------------------------------- |
| `SwaggerWcf` | `Class`, `Interface` | Enable parsing WCF service | `ServicePath` |
| `SwaggerWcfHidden` | `Class`, `Method`, `Property`, `Parameter` | Hide element from Swagger | |
| `SwaggerWcfTag` | `Class`, `Method`, `Property`, `Parameter` | Add a tag to an element | `TagName`, `HideFromSpec` |
| `SwaggerWcfHeader` | `Method` | Configure method HTTP headers | `Name`, `Required`, `Description`, `DefaultValue` |
| `SwaggerWcfPath` | `Method` | Configure a method in Swagger | `Summary`, `Description`, `OperationId`, `ExternalDocsDescription`, `ExternalDocsUrl`, `Deprecated` |
| `SwaggerWcfParameter` | `Parameter` | Configure method parameters | `Required`, `Description`, `ParameterType` |
| `SwaggerWcfProperty` | `Property` | Configure property parameters | `Required`, `Description`, `Minimum`, `Maximum`, `Default`, ... |
| `SwaggerWcfResponse` | `Method` | Configure method return value | `Code`, `Description`, `EmptyResponseOverride`, `Headers` |
| `SwaggerWcfDefinition` | `Class` | Configure a data type | `ExternalDocsDescription`, `ExternalDocsUrl` |
| `SwaggerWcfReturnType` | `Method` | Override method return type | `ReturnType` |
| `SwaggerWcfContentTypes` | `Method` | Override consume/produce content-types | `ConsumeTypes`, `ProduceTypes` |
| `SwaggerWcfSecurity` | `Method` | Add security background to this method | `SecurityDefinitionName`, `params Scopes` |
## Tags
Tags are used to create categories in Swagger UI.
In SwaggerWcf they can also be used to hide or show elements from the Swagger output using the configuration file.
Using the configuration from step 4, any elements with the tag `LowPerformance` will be hidden from Swagger.
When a `SwaggerWcfTag` is added to an element, it may be configured with `HideFromSpec`.
This will prevent this tag to be displayed in the Swagger output.
When combined with `SwaggerWcfHidden`, if the tag has the value `visible` as `true` in `web.config` file, the element will be visible
## Query Parameter
To specify query parameters to a function you may use the following syntax
```csharp
[WebGet(UriTemplate = "/books?filter={filter}", BodyStyle = WebMessageBodyStyle.Bare)]
Book[] ReadBooks(string filter = null);
```
## Optional Parameters
To specify a paramter as optional for swagger-ui provide a default value for the parameter on the interface.
```csharp
public string Foo(string bar = null);
```
## Optional Properties
To mark a property as optional or required, use the `IsRequired` parameter on the `DataMember` attribute.
## TODO
* Add some options to configuration in `Web.config`
* Tests
## How to Improve It
Fork this project [abelsilva/swaggerwcf](https://github.com/abelsilva/swaggerwcf) and submit pull requests.
================================================
FILE: notes/samples/petstore-expanded.json
================================================
{
"swagger": "2.0",
"info": {
"version": "1.0.0",
"title": "Swagger Petstore",
"description": "A sample API that uses a petstore as an example to demonstrate features in the swagger-2.0 specification",
"termsOfService": "http://swagger.io/terms/",
"contact": {
"name": "Swagger API Team",
"email": "apiteam@swagger.io",
"url": "http://swagger.io"
},
"license": {
"name": "MIT",
"url": "http://github.com/gruntjs/grunt/blob/master/LICENSE-MIT"
}
},
"host": "petstore.swagger.io",
"basePath": "/api",
"schemes": [
"http"
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"paths": {
"/pets": {
"get": {
"description": "Returns all pets from the system that the user has access to",
"operationId": "findPets",
"produces": [
"application/json",
"application/xml",
"text/xml",
"text/html"
],
"parameters": [
{
"name": "tags",
"in": "query",
"description": "tags to filter by",
"required": false,
"type": "array",
"items": {
"type": "string"
},
"collectionFormat": "csv"
},
{
"name": "limit",
"in": "query",
"description": "maximum number of results to return",
"required": false,
"type": "integer",
"format": "int32"
}
],
"responses": {
"200": {
"description": "pet response",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/Pet"
}
}
},
"default": {
"description": "unexpected error",
"schema": {
"$ref": "#/definitions/ErrorModel"
}
}
}
},
"post": {
"description": "Creates a new pet in the store. Duplicates are allowed",
"operationId": "addPet",
"produces": [
"application/json"
],
"parameters": [
{
"name": "pet",
"in": "body",
"description": "Pet to add to the store",
"required": true,
"schema": {
"$ref": "#/definitions/NewPet"
}
}
],
"responses": {
"200": {
"description": "pet response",
"schema": {
"$ref": "#/definitions/Pet"
}
},
"default": {
"description": "unexpected error",
"schema": {
"$ref": "#/definitions/ErrorModel"
}
}
}
}
},
"/pets/{id}": {
"get": {
"description": "Returns a user based on a single ID, if the user does not have access to the pet",
"operationId": "findPetById",
"produces": [
"application/json",
"application/xml",
"text/xml",
"text/html"
],
"parameters": [
{
"name": "id",
"in": "path",
"description": "ID of pet to fetch",
"required": true,
"type": "integer",
"format": "int64"
}
],
"responses": {
"200": {
"description": "pet response",
"schema": {
"$ref": "#/definitions/Pet"
}
},
"default": {
"description": "unexpected error",
"schema": {
"$ref": "#/definitions/ErrorModel"
}
}
}
},
"delete": {
"description": "deletes a single pet based on the ID supplied",
"operationId": "deletePet",
"parameters": [
{
"name": "id",
"in": "path",
"description": "ID of pet to delete",
"required": true,
"type": "integer",
"format": "int64"
}
],
"responses": {
"204": {
"description": "pet deleted"
},
"default": {
"description": "unexpected error",
"schema": {
"$ref": "#/definitions/ErrorModel"
}
}
}
}
}
},
"definitions": {
"Pet": {
"required": [
"id",
"name"
],
"properties": {
"id": {
"type": "integer",
"format": "int64"
},
"name": {
"type": "string"
},
"tag": {
"type": "string"
}
}
},
"NewPet": {
"allOf": [
{
"$ref": "#/definitions/Pet"
},
{
"required": [
"name"
],
"properties": {
"id": {
"type": "integer",
"format": "int64"
}
}
}
]
},
"ErrorModel": {
"required": [
"code",
"message"
],
"properties": {
"code": {
"type": "integer",
"format": "int32"
},
"message": {
"type": "string"
}
}
}
}
}
================================================
FILE: notes/samples/petstore-minimal.json
================================================
{
"swagger": "2.0",
"info": {
"version": "1.0.0",
"title": "Swagger Petstore",
"description": "A sample API that uses a petstore as an example to demonstrate features in the swagger-2.0 specification",
"termsOfService": "http://swagger.io/terms/",
"contact": {
"name": "Swagger API Team"
},
"license": {
"name": "MIT"
}
},
"host": "petstore.swagger.io",
"basePath": "/api",
"schemes": [
"http"
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"paths": {
"/pets": {
"get": {
"description": "Returns all pets from the system that the user has access to",
"produces": [
"application/json"
],
"responses": {
"200": {
"description": "A list of pets.",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/Pet"
}
}
}
}
}
}
},
"definitions": {
"Pet": {
"required": [
"id",
"name"
],
"properties": {
"id": {
"type": "integer",
"format": "int64"
},
"name": {
"type": "string"
},
"tag": {
"type": "string"
}
}
}
}
}
================================================
FILE: notes/samples/petstore-simple.json
================================================
{
"swagger": "2.0",
"info": {
"version": "1.0.0",
"title": "Swagger Petstore",
"description": "A sample API that uses a petstore as an example to demonstrate features in the swagger-2.0 specification",
"termsOfService": "http://swagger.io/terms/",
"contact": {
"name": "Swagger API Team"
},
"license": {
"name": "MIT"
}
},
"host": "petstore.swagger.io",
"basePath": "/api",
"schemes": [
"http"
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"paths": {
"/pets": {
"get": {
"description": "Returns all pets from the system that the user has access to",
"operationId": "findPets",
"produces": [
"application/json",
"application/xml",
"text/xml",
"text/html"
],
"parameters": [
{
"name": "tags",
"in": "query",
"description": "tags to filter by",
"required": false,
"type": "array",
"items": {
"type": "string"
},
"collectionFormat": "csv"
},
{
"name": "limit",
"in": "query",
"description": "maximum number of results to return",
"required": false,
"type": "integer",
"format": "int32"
}
],
"responses": {
"200": {
"description": "pet response",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/Pet"
}
}
},
"default": {
"description": "unexpected error",
"schema": {
"$ref": "#/definitions/ErrorModel"
}
}
}
},
"post": {
"description": "Creates a new pet in the store. Duplicates are allowed",
"operationId": "addPet",
"produces": [
"application/json"
],
"parameters": [
{
"name": "pet",
"in": "body",
"description": "Pet to add to the store",
"required": true,
"schema": {
"$ref": "#/definitions/PetInput"
}
}
],
"responses": {
"200": {
"description": "pet response",
"schema": {
"$ref": "#/definitions/Pet"
}
},
"default": {
"description": "unexpected error",
"schema": {
"$ref": "#/definitions/ErrorModel"
}
}
}
}
},
"/pets/{id}": {
"get": {
"description": "Returns a user based on a single ID, if the user does not have access to the pet",
"operationId": "findPetById",
"produces": [
"application/json",
"application/xml",
"text/xml",
"text/html"
],
"parameters": [
{
"name": "id",
"in": "path",
"description": "ID of pet to fetch",
"required": true,
"type": "integer",
"format": "int64"
}
],
"responses": {
"200": {
"description": "pet response",
"schema": {
"$ref": "#/definitions/Pet"
}
},
"default": {
"description": "unexpected error",
"schema": {
"$ref": "#/definitions/ErrorModel"
}
}
}
},
"delete": {
"description": "deletes a single pet based on the ID supplied",
"operationId": "deletePet",
"parameters": [
{
"name": "id",
"in": "path",
"description": "ID of pet to delete",
"required": true,
"type": "integer",
"format": "int64"
}
],
"responses": {
"204": {
"description": "pet deleted"
},
"default": {
"description": "unexpected error",
"schema": {
"$ref": "#/definitions/ErrorModel"
}
}
}
}
}
},
"definitions": {
"Pet": {
"required": [
"id",
"name"
],
"properties": {
"id": {
"type": "integer",
"format": "int64"
},
"name": {
"type": "string"
},
"tag": {
"type": "string"
}
}
},
"PetInput": {
"allOf": [
{
"$ref": "#/definitions/Pet"
},
{
"required": [
"name"
],
"properties": {
"id": {
"type": "integer",
"format": "int64"
}
}
}
]
},
"ErrorModel": {
"required": [
"code",
"message"
],
"properties": {
"code": {
"type": "integer",
"format": "int32"
},
"message": {
"type": "string"
}
}
}
}
}
================================================
FILE: notes/samples/petstore-with-external-docs.json
================================================
{
"swagger": "2.0",
"info": {
"version": "1.0.0",
"title": "Swagger Petstore",
"description": "A sample API that uses a petstore as an example to demonstrate features in the swagger-2.0 specification",
"termsOfService": "http://swagger.io/terms/",
"contact": {
"name": "Swagger API Team",
"email": "apiteam@swagger.io",
"url": "http://swagger.io"
},
"license": {
"name": "MIT",
"url": "http://github.com/gruntjs/grunt/blob/master/LICENSE-MIT"
}
},
"externalDocs": {
"description": "find more info here",
"url": "https://swagger.io/about"
},
"host": "petstore.swagger.io",
"basePath": "/api",
"schemes": [
"http"
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"paths": {
"/pets": {
"get": {
"description": "Returns all pets from the system that the user has access to",
"operationId": "findPets",
"externalDocs": {
"description": "find more info here",
"url": "https://swagger.io/about"
},
"produces": [
"application/json",
"application/xml",
"text/xml",
"text/html"
],
"parameters": [
{
"name": "tags",
"in": "query",
"description": "tags to filter by",
"required": false,
"type": "array",
"items": {
"type": "string"
},
"collectionFormat": "csv"
},
{
"name": "limit",
"in": "query",
"description": "maximum number of results to return",
"required": false,
"type": "integer",
"format": "int32"
}
],
"responses": {
"200": {
"description": "pet response",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/Pet"
}
}
},
"default": {
"description": "unexpected error",
"schema": {
"$ref": "#/definitions/ErrorModel"
}
}
}
},
"post": {
"description": "Creates a new pet in the store. Duplicates are allowed",
"operationId": "addPet",
"produces": [
"application/json"
],
"parameters": [
{
"name": "pet",
"in": "body",
"description": "Pet to add to the store",
"required": true,
"schema": {
"$ref": "#/definitions/NewPet"
}
}
],
"responses": {
"200": {
"description": "pet response",
"schema": {
"$ref": "#/definitions/Pet"
}
},
"default": {
"description": "unexpected error",
"schema": {
"$ref": "#/definitions/ErrorModel"
}
}
}
}
},
"/pets/{id}": {
"get": {
"description": "Returns a user based on a single ID, if the user does not have access to the pet",
"operationId": "findPetById",
"produces": [
"application/json",
"application/xml",
"text/xml",
"text/html"
],
"parameters": [
{
"name": "id",
"in": "path",
"description": "ID of pet to fetch",
"required": true,
"type": "integer",
"format": "int64"
}
],
"responses": {
"200": {
"description": "pet response",
"schema": {
"$ref": "#/definitions/Pet"
}
},
"default": {
"description": "unexpected error",
"schema": {
"$ref": "#/definitions/ErrorModel"
}
}
}
},
"delete": {
"description": "deletes a single pet based on the ID supplied",
"operationId": "deletePet",
"parameters": [
{
"name": "id",
"in": "path",
"description": "ID of pet to delete",
"required": true,
"type": "integer",
"format": "int64"
}
],
"responses": {
"204": {
"description": "pet deleted"
},
"default": {
"description": "unexpected error",
"schema": {
"$ref": "#/definitions/ErrorModel"
}
}
}
}
}
},
"definitions": {
"Pet": {
"required": [
"id",
"name"
],
"externalDocs": {
"description": "find more info here",
"url": "https://swagger.io/about"
},
"properties": {
"id": {
"type": "integer",
"format": "int64"
},
"name": {
"type": "string"
},
"tag": {
"type": "string"
}
}
},
"NewPet": {
"allOf": [
{
"$ref": "#/definitions/Pet"
},
{
"required": [
"name"
],
"properties": {
"id": {
"type": "integer",
"format": "int64"
}
}
}
]
},
"ErrorModel": {
"required": [
"code",
"message"
],
"properties": {
"code": {
"type": "integer",
"format": "int32"
},
"message": {
"type": "string"
}
}
}
}
}
================================================
FILE: notes/samples/petstore.json
================================================
{
"swagger": "2.0",
"info": {
"version": "1.0.0",
"title": "Swagger Petstore",
"contact": {
"name": "Swagger API Team",
"url": "http://swagger.io"
},
"license": {
"name": "Creative Commons 4.0 International",
"url": "http://creativecommons.org/licenses/by/4.0/"
}
},
"host": "petstore.swagger.io",
"basePath": "/api",
"schemes": [
"http"
],
"paths": {
"/pets": {
"get": {
"tags": [ "Pet Operations" ],
"summary": "finds pets in the system",
"responses": {
"200": {
"description": "pet response",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/Pet"
}
},
"headers": {
"x-expires": {
"type": "string"
}
}
},
"default": {
"description": "unexpected error",
"schema": {
"$ref": "#/definitions/Error"
}
}
}
}
}
},
"definitions": {
"Pet": {
"required": [
"id",
"name"
],
"properties": {
"id": {
"type": "integer",
"format": "int64"
},
"name": {
"type": "string"
},
"tag": {
"type": "string"
}
}
},
"Error": {
"required": [
"code",
"message"
],
"properties": {
"code": {
"type": "integer",
"format": "int32"
},
"message": {
"type": "string"
}
}
}
}
}
================================================
FILE: notes/schema.json
================================================
{
"title": "A JSON Schema for Swagger 2.0 API.",
"id": "http://swagger.io/v2/schema.json#",
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"required": [
"swagger",
"info",
"paths"
],
"additionalProperties": false,
"patternProperties": {
"^x-": {
"$ref": "#/definitions/vendorExtension"
}
},
"properties": {
"swagger": {
"type": "string",
"enum": [
"2.0"
],
"description": "The Swagger version of this document."
},
"info": {
"$ref": "#/definitions/info"
},
"host": {
"type": "string",
"format": "uri",
"pattern": "^[^{}/ :\\\\]+(?::\\d+)?$",
"description": "The fully qualified URI to the host of the API."
},
"basePath": {
"type": "string",
"pattern": "^/",
"description": "The base path to the API. Example: '/api'."
},
"schemes": {
"$ref": "#/definitions/schemesList"
},
"consumes": {
"description": "A list of MIME types accepted by the API.",
"$ref": "#/definitions/mediaTypeList"
},
"produces": {
"description": "A list of MIME types the API can produce.",
"$ref": "#/definitions/mediaTypeList"
},
"paths": {
"$ref": "#/definitions/paths"
},
"definitions": {
"$ref": "#/definitions/definitions"
},
"parameters": {
"$ref": "#/definitions/parameterDefinitions"
},
"responses": {
"$ref": "#/definitions/responseDefinitions"
},
"security": {
"$ref": "#/definitions/security"
},
"securityDefinitions": {
"$ref": "#/definitions/securityDefinitions"
},
"tags": {
"type": "array",
"items": {
"$ref": "#/definitions/tag"
},
"uniqueItems": true
},
"externalDocs": {
"$ref": "#/definitions/externalDocs"
}
},
"definitions": {
"info": {
"type": "object",
"description": "General information about the API.",
"required": [
"version",
"title"
],
"additionalProperties": false,
"patternProperties": {
"^x-": {
"$ref": "#/definitions/vendorExtension"
}
},
"properties": {
"title": {
"type": "string",
"description": "A unique and precise title of the API."
},
"version": {
"type": "string",
"description": "A semantic version number of the API."
},
"description": {
"type": "string",
"description": "A longer description of the API. Should be different from the title. Github-flavored markdown is allowed."
},
"termsOfService": {
"type": "string",
"description": "The terms of service for the API."
},
"contact": {
"$ref": "#/definitions/contact"
},
"license": {
"$ref": "#/definitions/license"
}
}
},
"contact": {
"type": "object",
"description": "Contact information for the owners of the API.",
"additionalProperties": false,
"properties": {
"name": {
"type": "string",
"description": "The identifying name of the contact person/organization."
},
"url": {
"type": "string",
"description": "The URL pointing to the contact information.",
"format": "uri"
},
"email": {
"type": "string",
"description": "The email address of the contact person/organization.",
"format": "email"
}
}
},
"license": {
"type": "object",
"required": [
"name"
],
"additionalProperties": false,
"properties": {
"name": {
"type": "string",
"description": "The name of the license type. It's encouraged to use an OSI compatible license."
},
"url": {
"type": "string",
"description": "The URL pointing to the license.",
"format": "uri"
}
}
},
"paths": {
"type": "object",
"description": "Relative paths to the individual endpoints. They must be relative to the 'basePath'.",
"patternProperties": {
"^x-": {
"$ref": "#/definitions/vendorExtension"
},
"^/": {
"$ref": "#/definitions/pathItem"
}
},
"additionalProperties": false
},
"definitions": {
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/schema"
},
"description": "One or more JSON objects describing the schemas being consumed and produced by the API."
},
"parameterDefinitions": {
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/parameter"
},
"description": "One or more JSON representations for parameters"
},
"responseDefinitions": {
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/response"
},
"description": "One or more JSON representations for parameters"
},
"externalDocs": {
"type": "object",
"additionalProperties": false,
"description": "information about external documentation",
"required": [
"url"
],
"properties": {
"description": {
"type": "string"
},
"url": {
"type": "string",
"format": "uri"
}
}
},
"examples": {
"type": "object",
"patternProperties": {
"^[a-z0-9-]+/[a-z0-9\\-+]+$": {}
},
"additionalProperties": false
},
"mimeType": {
"type": "string",
"description": "The MIME type of the HTTP message."
},
"operation": {
"type": "object",
"required": [
"responses"
],
"additionalProperties": false,
"patternProperties": {
"^x-": {
"$ref": "#/definitions/vendorExtension"
}
},
"properties": {
"tags": {
"type": "array",
"items": {
"type": "string"
},
"uniqueItems": true
},
"summary": {
"type": "string",
"description": "A brief summary of the operation."
},
"description": {
"type": "string",
"description": "A longer description of the operation, github-flavored markdown is allowed."
},
"externalDocs": {
"$ref": "#/definitions/externalDocs"
},
"operationId": {
"type": "string",
"description": "A friendly name of the operation"
},
"produces": {
"description": "A list of MIME types the API can produce.",
"$ref": "#/definitions/mediaTypeList"
},
"consumes": {
"description": "A list of MIME types the API can consume.",
"$ref": "#/definitions/mediaTypeList"
},
"parameters": {
"$ref": "#/definitions/parametersList"
},
"responses": {
"$ref": "#/definitions/responses"
},
"schemes": {
"$ref": "#/definitions/schemesList"
},
"deprecated": {
"type": "boolean",
"default": false
},
"security": {
"$ref": "#/definitions/security"
}
}
},
"pathItem": {
"type": "object",
"additionalProperties": false,
"patternProperties": {
"^x-": {
"$ref": "#/definitions/vendorExtension"
}
},
"properties": {
"$ref": {
"type": "string"
},
"get": {
"$ref": "#/definitions/operation"
},
"put": {
"$ref": "#/definitions/operation"
},
"post": {
"$ref": "#/definitions/operation"
},
"delete": {
"$ref": "#/definitions/operation"
},
"options": {
"$ref": "#/definitions/operation"
},
"head": {
"$ref": "#/definitions/operation"
},
"patch": {
"$ref": "#/definitions/operation"
},
"parameters": {
"$ref": "#/definitions/parametersList"
}
}
},
"responses": {
"type": "object",
"description": "Response objects names can either be any valid HTTP status code or 'default'.",
"minProperties": 1,
"additionalProperties": false,
"patternProperties": {
"^([0-9]{3})$|^(default)$": {
"$ref": "#/definitions/responseValue"
},
"^x-": {
"$ref": "#/definitions/vendorExtension"
}
},
"not": {
"type": "object",
"additionalProperties": false,
"patternProperties": {
"^x-": {
"$ref": "#/definitions/vendorExtension"
}
}
}
},
"responseValue": {
"oneOf": [
{
"$ref": "#/definitions/response"
},
{
"$ref": "#/definitions/jsonReference"
}
]
},
"response": {
"type": "object",
"required": [
"description"
],
"properties": {
"description": {
"type": "string"
},
"schema": {
"$ref": "#/definitions/schema"
},
"headers": {
"$ref": "#/definitions/headers"
},
"examples": {
"$ref": "#/definitions/examples"
}
},
"additionalProperties": false
},
"headers": {
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/header"
}
},
"header": {
"type": "object",
"additionalProperties": false,
"required": [
"type"
],
"properties": {
"type": {
"type": "string",
"enum": [
"string",
"number",
"integer",
"boolean",
"array"
]
},
"format": {
"type": "string"
},
"items": {
"$ref": "#/definitions/primitivesItems"
},
"collectionFormat": {
"$ref": "#/definitions/collectionFormat"
},
"default": {
"$ref": "#/definitions/default"
},
"maximum": {
"$ref": "#/definitions/maximum"
},
"exclusiveMaximum": {
"$ref": "#/definitions/exclusiveMaximum"
},
"minimum": {
"$ref": "#/definitions/minimum"
},
"exclusiveMinimum": {
"$ref": "#/definitions/exclusiveMinimum"
},
"maxLength": {
"$ref": "#/definitions/maxLength"
},
"minLength": {
"$ref": "#/definitions/minLength"
},
"pattern": {
"$ref": "#/definitions/pattern"
},
"maxItems": {
"$ref": "#/definitions/maxItems"
},
"minItems": {
"$ref": "#/definitions/minItems"
},
"uniqueItems": {
"$ref": "#/definitions/uniqueItems"
},
"enum": {
"$ref": "#/definitions/enum"
},
"multipleOf": {
"$ref": "#/definitions/multipleOf"
},
"description": {
"type": "string"
}
}
},
"vendorExtension": {
"description": "Any property starting with x- is valid.",
"additionalProperties": true,
"additionalItems": true
},
"bodyParameter": {
"type": "object",
"required": [
"name",
"in",
"schema"
],
"patternProperties": {
"^x-": {
"$ref": "#/definitions/vendorExtension"
}
},
"properties": {
"description": {
"type": "string",
"description": "A brief description of the parameter. This could contain examples of use. Github-flavored markdown is allowed."
},
"name": {
"type": "string",
"description": "The name of the parameter."
},
"in": {
"type": "string",
"description": "Determines the location of the parameter.",
"enum": [
"body"
]
},
"required": {
"type": "boolean",
"description": "Determines whether or not this parameter is required or optional.",
"default": false
},
"schema": {
"$ref": "#/definitions/schema"
}
},
"additionalProperties": false
},
"headerParameterSubSchema": {
"additionalProperties": false,
"patternProperties": {
"^x-": {
"$ref": "#/definitions/vendorExtension"
}
},
"properties": {
"required": {
"type": "boolean",
"description": "Determines whether or not this parameter is required or optional.",
"default": false
},
"in": {
"type": "string",
"description": "Determines the location of the parameter.",
"enum": [
"header"
]
},
"description": {
"type": "string",
"description": "A brief description of the parameter. This could contain examples of use. Github-flavored markdown is allowed."
},
"name": {
"type": "string",
"description": "The name of the parameter."
},
"type": {
"type": "string",
"enum": [
"string",
"number",
"boolean",
"integer",
"array"
]
},
"format": {
"type": "string"
},
"items": {
"$ref": "#/definitions/primitivesItems"
},
"collectionFormat": {
"$ref": "#/definitions/collectionFormat"
},
"default": {
"$ref": "#/definitions/default"
},
"maximum": {
"$ref": "#/definitions/maximum"
},
"exclusiveMaximum": {
"$ref": "#/definitions/exclusiveMaximum"
},
"minimum": {
"$ref": "#/definitions/minimum"
},
"exclusiveMinimum": {
"$ref": "#/definitions/exclusiveMinimum"
},
"maxLength": {
"$ref": "#/definitions/maxLength"
},
"minLength": {
"$ref": "#/definitions/minLength"
},
"pattern": {
"$ref": "#/definitions/pattern"
},
"maxItems": {
"$ref": "#/definitions/maxItems"
},
"minItems": {
"$ref": "#/definitions/minItems"
},
"uniqueItems": {
"$ref": "#/definitions/uniqueItems"
},
"enum": {
"$ref": "#/definitions/enum"
},
"multipleOf": {
"$ref": "#/definitions/multipleOf"
}
}
},
"queryParameterSubSchema": {
"additionalProperties": false,
"patternProperties": {
"^x-": {
"$ref": "#/definitions/vendorExtension"
}
},
"properties": {
"required": {
"type": "boolean",
"description": "Determines whether or not this parameter is required or optional.",
"default": false
},
"in": {
"type": "string",
"description": "Determines the location of the parameter.",
"enum": [
"query"
]
},
"description": {
"type": "string",
"description": "A brief description of the parameter. This could contain examples of use. Github-flavored markdown is allowed."
},
"name": {
"type": "string",
"description": "The name of the parameter."
},
"allowEmptyValue": {
"type": "boolean",
"default": false,
"description": "allows sending a parameter by name only or with an empty value."
},
"type": {
"type": "string",
"enum": [
"string",
"number",
"boolean",
"integer",
"array"
]
},
"format": {
"type": "string"
},
"items": {
"$ref": "#/definitions/primitivesItems"
},
"collectionFormat": {
"$ref": "#/definitions/collectionFormatWithMulti"
},
"default": {
"$ref": "#/definitions/default"
},
"maximum": {
"$ref": "#/definitions/maximum"
},
"exclusiveMaximum": {
"$ref": "#/definitions/exclusiveMaximum"
},
"minimum": {
"$ref": "#/definitions/minimum"
},
"exclusiveMinimum": {
"$ref": "#/definitions/exclusiveMinimum"
},
"maxLength": {
"$ref": "#/definitions/maxLength"
},
"minLength": {
"$ref": "#/definitions/minLength"
},
"pattern": {
"$ref": "#/definitions/pattern"
},
"maxItems": {
"$ref": "#/definitions/maxItems"
},
"minItems": {
"$ref": "#/definitions/minItems"
},
"uniqueItems": {
"$ref": "#/definitions/uniqueItems"
},
"enum": {
"$ref": "#/definitions/enum"
},
"multipleOf": {
"$ref": "#/definitions/multipleOf"
}
}
},
"formDataParameterSubSchema": {
"additionalProperties": false,
"patternProperties": {
"^x-": {
"$ref": "#/definitions/vendorExtension"
}
},
"properties": {
"required": {
"type": "boolean",
"description": "Determines whether or not this parameter is required or optional.",
"default": false
},
"in": {
"type": "string",
"description": "Determines the location of the parameter.",
"enum": [
"formData"
]
},
"description": {
"type": "string",
"description": "A brief description of the parameter. This could contain examples of use. Github-flavored markdown is allowed."
},
"name": {
"type": "string",
"description": "The name of the parameter."
},
"allowEmptyValue": {
"type": "boolean",
"default": false,
"description": "allows sending a parameter by name only or with an empty value."
},
"type": {
"type": "string",
"enum": [
"string",
"number",
"boolean",
"integer",
"array",
"file"
]
},
"format": {
"type": "string"
},
"items": {
"$ref": "#/definitions/primitivesItems"
},
"collectionFormat": {
"$ref": "#/definitions/collectionFormatWithMulti"
},
"default": {
"$ref": "#/definitions/default"
},
"maximum": {
"$ref": "#/definitions/maximum"
},
"exclusiveMaximum": {
"$ref": "#/definitions/exclusiveMaximum"
},
"minimum": {
"$ref": "#/definitions/minimum"
},
"exclusiveMinimum": {
"$ref": "#/definitions/exclusiveMinimum"
},
"maxLength": {
"$ref": "#/definitions/maxLength"
},
"minLength": {
"$ref": "#/definitions/minLength"
},
"pattern": {
"$ref": "#/definitions/pattern"
},
"maxItems": {
"$ref": "#/definitions/maxItems"
},
"minItems": {
"$ref": "#/definitions/minItems"
},
"uniqueItems": {
"$ref": "#/definitions/uniqueItems"
},
"enum": {
"$ref": "#/definitions/enum"
},
"multipleOf": {
"$ref": "#/definitions/multipleOf"
}
}
},
"pathParameterSubSchema": {
"additionalProperties": false,
"patternProperties": {
"^x-": {
"$ref": "#/definitions/vendorExtension"
}
},
"properties": {
"required": {
"type": "boolean",
"enum": [
true
],
"description": "Determines whether or not this parameter is required or optional."
},
"in": {
"type": "string",
"description": "Determines the location of the parameter.",
"enum": [
"path"
]
},
"description": {
"type": "string",
"description": "A brief description of the parameter. This could contain examples of use. Github-flavored markdown is allowed."
},
"name": {
"type": "string",
"description": "The name of the parameter."
},
"type": {
"type": "string",
"enum": [
"string",
"number",
"boolean",
"integer",
"array"
]
},
"format": {
"type": "string"
},
"items": {
"$ref": "#/definitions/primitivesItems"
},
"collectionFormat": {
"$ref": "#/definitions/collectionFormat"
},
"default": {
"$ref": "#/definitions/default"
},
"maximum": {
"$ref": "#/definitions/maximum"
},
"exclusiveMaximum": {
"$ref": "#/definitions/exclusiveMaximum"
},
"minimum": {
"$ref": "#/definitions/minimum"
},
"exclusiveMinimum": {
"$ref": "#/definitions/exclusiveMinimum"
},
"maxLength": {
"$ref": "#/definitions/maxLength"
},
"minLength": {
"$ref": "#/definitions/minLength"
},
"pattern": {
"$ref": "#/definitions/pattern"
},
"maxItems": {
"$ref": "#/definitions/maxItems"
},
"minItems": {
"$ref": "#/definitions/minItems"
},
"uniqueItems": {
"$ref": "#/definitions/uniqueItems"
},
"enum": {
"$ref": "#/definitions/enum"
},
"multipleOf": {
"$ref": "#/definitions/multipleOf"
}
}
},
"nonBodyParameter": {
"type": "object",
"required": [
"name",
"in",
"type"
],
"oneOf": [
{
"$ref": "#/definitions/headerParameterSubSchema"
},
{
"$ref": "#/definitions/formDataParameterSubSchema"
},
{
"$ref": "#/definitions/queryParameterSubSchema"
},
{
"$ref": "#/definitions/pathParameterSubSchema"
}
]
},
"parameter": {
"oneOf": [
{
"$ref": "#/definitions/bodyParameter"
},
{
"$ref": "#/definitions/nonBodyParameter"
}
]
},
"schema": {
"type": "object",
"description": "A deterministic version of a JSON Schema object.",
"patternProperties": {
"^x-": {
"$ref": "#/definitions/vendorExtension"
}
},
"properties": {
"$ref": {
"type": "string"
},
"format": {
"type": "string"
},
"title": {
"$ref": "http://json-schema.org/draft-04/schema#/properties/title"
},
"description": {
"$ref": "http://json-schema.org/draft-04/schema#/properties/description"
},
"default": {
"$ref": "http://json-schema.org/draft-04/schema#/properties/default"
},
"multipleOf": {
"$ref": "http://json-schema.org/draft-04/schema#/properties/multipleOf"
},
"maximum": {
"$ref": "http://json-schema.org/draft-04/schema#/properties/maximum"
},
"exclusiveMaximum": {
"$ref": "http://json-schema.org/draft-04/schema#/properties/exclusiveMaximum"
},
"minimum": {
"$ref": "http://json-schema.org/draft-04/schema#/properties/minimum"
},
"exclusiveMinimum": {
"$ref": "http://json-schema.org/draft-04/schema#/properties/exclusiveMinimum"
},
"maxLength": {
"$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveInteger"
},
"minLength": {
"$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0"
},
"pattern": {
"$ref": "http://json-schema.org/draft-04/schema#/properties/pattern"
},
"maxItems": {
"$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveInteger"
},
"minItems": {
"$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0"
},
"uniqueItems": {
"$ref": "http://json-schema.org/draft-04/schema#/properties/uniqueItems"
},
"maxProperties": {
"$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveInteger"
},
"minProperties": {
"$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0"
},
"required": {
"$ref": "http://json-schema.org/draft-04/schema#/definitions/stringArray"
},
"enum": {
"$ref": "http://json-schema.org/draft-04/schema#/properties/enum"
},
"additionalProperties": {
"$ref": "http://json-schema.org/draft-04/schema#/properties/additionalProperties"
},
"type": {
"$ref": "http://json-schema.org/draft-04/schema#/properties/type"
},
"items": {
"anyOf": [
{
"$ref": "#/definitions/schema"
},
{
"type": "array",
"minItems": 1,
"items": {
"$ref": "#/definitions/schema"
}
}
],
"default": {}
},
"allOf": {
"type": "array",
"minItems": 1,
"items": {
"$ref": "#/definitions/schema"
}
},
"properties": {
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/schema"
},
"default": {}
},
"discriminator": {
"type": "string"
},
"readOnly": {
"type": "boolean",
"default": false
},
"xml": {
"$ref": "#/definitions/xml"
},
"externalDocs": {
"$ref": "#/definitions/externalDocs"
},
"example": {}
},
"additionalProperties": false
},
"primitivesItems": {
"type": "object",
"additionalProperties": false,
"properties": {
"type": {
"type": "string",
"enum": [
"string",
"number",
"integer",
"boolean",
"array"
]
},
"format": {
"type": "string"
},
"items": {
"$ref": "#/definitions/primitivesItems"
},
"collectionFormat": {
"$ref": "#/definitions/collectionFormat"
},
"default": {
"$ref": "#/definitions/default"
},
"maximum": {
"$ref": "#/definitions/maximum"
},
"exclusiveMaximum": {
"$ref": "#/definitions/exclusiveMaximum"
},
"minimum": {
"$ref": "#/definitions/minimum"
},
"exclusiveMinimum": {
"$ref": "#/definitions/exclusiveMinimum"
},
"maxLength": {
"$ref": "#/definitions/maxLength"
},
"minLength": {
"$ref": "#/definitions/minLength"
},
"pattern": {
"$ref": "#/definitions/pattern"
},
"maxItems": {
"$ref": "#/definitions/maxItems"
},
"minItems": {
"$ref": "#/definitions/minItems"
},
"uniqueItems": {
"$ref": "#/definitions/uniqueItems"
},
"enum": {
"$ref": "#/definitions/enum"
},
"multipleOf": {
"$ref": "#/definitions/multipleOf"
}
}
},
"security": {
"type": "array",
"items": {
"$ref": "#/definitions/securityRequirement"
},
"uniqueItems": true
},
"securityRequirement": {
"type": "object",
"additionalProperties": {
"type": "array",
"items": {
"type": "string"
},
"uniqueItems": true
}
},
"xml": {
"type": "object",
"additionalProperties": false,
"properties": {
"name": {
"type": "string"
},
"namespace": {
"type": "string"
},
"prefix": {
"type": "string"
},
"attribute": {
"type": "boolean",
"default": false
},
"wrapped": {
"type": "boolean",
"default": false
}
}
},
"tag": {
"type": "object",
"additionalProperties": false,
"required": [
"name"
],
"properties": {
"name": {
"type": "string"
},
"description": {
"type": "string"
},
"externalDocs": {
"$ref": "#/definitions/externalDocs"
}
},
"patternProperties": {
"^x-": {
"$ref": "#/definitions/vendorExtension"
}
}
},
"securityDefinitions": {
"type": "object",
"additionalProperties": {
"oneOf": [
{
"$ref": "#/definitions/basicAuthenticationSecurity"
},
{
"$ref": "#/definitions/apiKeySecurity"
},
{
"$ref": "#/definitions/oauth2ImplicitSecurity"
},
{
"$ref": "#/definitions/oauth2PasswordSecurity"
},
{
"$ref": "#/definitions/oauth2ApplicationSecurity"
},
{
"$ref": "#/definitions/oauth2AccessCodeSecurity"
}
]
}
},
"basicAuthenticationSecurity": {
"type": "object",
"additionalProperties": false,
"required": [
"type"
],
"properties": {
"type": {
"type": "string",
"enum": [
"basic"
]
},
"description": {
"type": "string"
}
},
"patternProperties": {
"^x-": {
"$ref": "#/definitions/vendorExtension"
}
}
},
"apiKeySecurity": {
"type": "object",
"additionalProperties": false,
"required": [
"type",
"name",
"in"
],
"properties": {
"type": {
"type": "string",
"enum": [
"apiKey"
]
},
"name": {
"type": "string"
},
"in": {
"type": "string",
"enum": [
"header",
"query"
]
},
"description": {
"type": "string"
}
},
"patternProperties": {
"^x-": {
"$ref": "#/definitions/vendorExtension"
}
}
},
"oauth2ImplicitSecurity": {
"type": "object",
"additionalProperties": false,
"required": [
"type",
"flow",
"authorizationUrl"
],
"properties": {
"type": {
"type": "string",
"enum": [
"oauth2"
]
},
"flow": {
"type": "string",
"enum": [
"implicit"
]
},
"scopes": {
"$ref": "#/definitions/oauth2Scopes"
},
"authorizationUrl": {
"type": "string",
"format": "uri"
},
"description": {
"type": "string"
}
},
"patternProperties": {
"^x-": {
"$ref": "#/definitions/vendorExtension"
}
}
},
"oauth2PasswordSecurity": {
"type": "object",
"additionalProperties": false,
"required": [
"type",
"flow",
"tokenUrl"
],
"properties": {
"type": {
"type": "string",
"enum": [
"oauth2"
]
},
"flow": {
"type": "string",
"enum": [
"password"
]
},
"scopes": {
"$ref": "#/definitions/oauth2Scopes"
},
"tokenUrl": {
"type": "string",
"format": "uri"
},
"description": {
"type": "string"
}
},
"patternProperties": {
"^x-": {
"$ref": "#/definitions/vendorExtension"
}
}
},
"oauth2ApplicationSecurity": {
"type": "object",
"additionalProperties": false,
"required": [
"type",
"flow",
"tokenUrl"
],
"properties": {
"type": {
"type": "string",
"enum": [
"oauth2"
]
},
"flow": {
"type": "string",
"enum": [
"application"
]
},
"scopes": {
"$ref": "#/definitions/oauth2Scopes"
},
"tokenUrl": {
"type": "string",
"format": "uri"
},
"description": {
"type": "string"
}
},
"patternProperties": {
"^x-": {
"$ref": "#/definitions/vendorExtension"
}
}
},
"oauth2AccessCodeSecurity": {
"type": "object",
"additionalProperties": false,
"required": [
"type",
"flow",
"authorizationUrl",
"tokenUrl"
],
"properties": {
"type": {
"type": "string",
"enum": [
"oauth2"
]
},
"flow": {
"type": "string",
"enum": [
"accessCode"
]
},
"scopes": {
"$ref": "#/definitions/oauth2Scopes"
},
"authorizationUrl": {
"type": "string",
"format": "uri"
},
"tokenUrl": {
"type": "string",
"format": "uri"
},
"description": {
"type": "string"
}
},
"patternProperties": {
"^x-": {
"$ref": "#/definitions/vendorExtension"
}
}
},
"oauth2Scopes": {
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"mediaTypeList": {
"type": "array",
"items": {
"$ref": "#/definitions/mimeType"
},
"uniqueItems": true
},
"parametersList": {
"type": "array",
"description": "The parameters needed to send a valid API call.",
"additionalItems": false,
"items": {
"oneOf": [
{
"$ref": "#/definitions/parameter"
},
{
"$ref": "#/definitions/jsonReference"
}
]
},
"uniqueItems": true
},
"schemesList": {
"type": "array",
"description": "The transfer protocol of the API.",
"items": {
"type": "string",
"enum": [
"http",
"https",
"ws",
"wss"
]
},
"uniqueItems": true
},
"collectionFormat": {
"type": "string",
"enum": [
"csv",
"ssv",
"tsv",
"pipes"
],
"default": "csv"
},
"collectionFormatWithMulti": {
"type": "string",
"enum": [
"csv",
"ssv",
"tsv",
"pipes",
"multi"
],
"default": "csv"
},
"title": {
"$ref": "http://json-schema.org/draft-04/schema#/properties/title"
},
"description": {
"$ref": "http://json-schema.org/draft-04/schema#/properties/description"
},
"default": {
"$ref": "http://json-schema.org/draft-04/schema#/properties/default"
},
"multipleOf": {
"$ref": "http://json-schema.org/draft-04/schema#/properties/multipleOf"
},
"maximum": {
"$ref": "http://json-schema.org/draft-04/schema#/properties/maximum"
},
"exclusiveMaximum": {
"$ref": "http://json-schema.org/draft-04/schema#/properties/exclusiveMaximum"
},
"minimum": {
"$ref": "http://json-schema.org/draft-04/schema#/properties/minimum"
},
"exclusiveMinimum": {
"$ref": "http://json-schema.org/draft-04/schema#/properties/exclusiveMinimum"
},
"maxLength": {
"$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveInteger"
},
"minLength": {
"$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0"
},
"pattern": {
"$ref": "http://json-schema.org/draft-04/schema#/properties/pattern"
},
"maxItems": {
"$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveInteger"
},
"minItems": {
"$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0"
},
"uniqueItems": {
"$ref": "http://json-schema.org/draft-04/schema#/properties/uniqueItems"
},
"enum": {
"$ref": "http://json-schema.org/draft-04/schema#/properties/enum"
},
"jsonReference": {
"type": "object",
"additionalProperties": false,
"properties": {
"$ref": {
"type": "string"
}
}
}
}
}
================================================
FILE: notes/spec-2.0.md
================================================
# Swagger RESTful API Documentation Specification
#### Version 2.0
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [RFC 2119](http://www.ietf.org/rfc/rfc2119.txt).
The Swagger specification is licensed under [The Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.html).
## Introduction
Swagger™ is a project used to describe and document RESTful APIs.
The Swagger specification defines a set of files required to describe such an API. These files can then be used by the Swagger-UI project to display the API and Swagger-Codegen to generate clients in various languages. Additional utilities can also take advantage of the resulting files, such as testing tools.
## Revision History
Version | Date | Notes
--- | --- | ---
2.0 | 2014-09-08 | Release of Swagger 2.0
1.2 | 2014-03-14 | Initial release of the formal document.
1.1 | 2012-08-22 | Release of Swagger 1.1
1.0 | 2011-08-10 | First release of the Swagger Specification
## Definitions
##### <a name="pathTemplating"></a>Path Templating
Path templating refers to the usage of curly braces ({}) to mark a section of a URL path as replaceable using path parameters.
##### <a name="mimeTypes"></a>Mime Types
Mime type definitions are spread across several resources. The mime type definitions should be in compliance with [RFC 6838](http://tools.ietf.org/html/rfc6838).
Some examples of possible mime type definitions:
```
text/plain; charset=utf-8
application/json
application/vnd.github+json
application/vnd.github.v3+json
application/vnd.github.v3.raw+json
application/vnd.github.v3.text+json
application/vnd.github.v3.html+json
application/vnd.github.v3.full+json
application/vnd.github.v3.diff
application/vnd.github.v3.patch
```
##### <a name="httpCodes"></a>HTTP Status Codes
The HTTP Status Codes are used to indicate the status of the executed operation. The available status codes are described by [RFC 7231](http://tools.ietf.org/html/rfc7231#section-6) and in the [IANA Status Code Registry](http://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml).
## Specification
### Format
The files describing the RESTful API in accordance with the Swagger specification are represented as JSON objects and conform to the JSON standards. YAML, being a superset of JSON, can be used as well to
represent a Swagger specification file.
For example, if a field is said to have an array value, the JSON array representation will be used:
```js
{
"field" : [...]
}
```
While the API is described using JSON it does not impose a JSON input/output to the API itself.
All field names in the specification are **case sensitive**.
The schema exposes two types of fields. Fixed fields, which have a declared name, and Patterned fields, which declare a regex pattern for the field name. Patterned fields can have multiple occurrences as long as each has a unique name.
### File Structure
The Swagger representation of the API is made of a single file. However, parts of the definitions can be split into separate files, at the discretion of the user. This is applicable for `$ref` fields in the specification as follows from the [JSON Schema](http://json-schema.org) definitions.
By convention, the Swagger specification file is named `swagger.json`.
### Data Types
Primitive data types in the Swagger Specification are based on the types supported by the [JSON-Schema Draft 4](http://json-schema.org/latest/json-schema-core.html#anchor8). Models are described using the [Schema Object](#schemaObject) which is a subset of JSON Schema Draft 4.
An additional primitive data type `"file"` is used by the [Parameter Object](#parameterObject) and the [Response Object](#responseObject) to set the parameter type or the response as being a file.
<a name="dataTypeFormat"></a>Primitives have an optional modifier property `format`. Swagger uses several known formats to more finely define the data type being used. However, the `format` property is an open `string`-valued property, and can have any value to support documentation needs. Formats such as `"email"`, `"uuid"`, etc., can be used even though they are not defined by this specification. Types that are not accompanied by a `format` property follow their definition from the JSON Schema (except for `file` type which is defined above). The formats defined by the Swagger Specification are:
Common Name | [`type`](#dataTypeType) | [`format`](#dataTypeFormat) | Comments
----------- | ------ | -------- | --------
integer | `integer` | `int32` | signed 32 bits
long | `integer` | `int64` | signed 64 bits
float | `number` | `float` |
double | `number` | `double` |
string | `string` | |
byte | `string` | `byte` |
boolean | `boolean` | |
date | `string` | `date` | As defined by `full-date` - [RFC3339](http://xml2rfc.ietf.org/public/rfc/html/rfc3339.html#anchor14)
dateTime | `string` | `date-time` | As defined by `date-time` - [RFC3339](http://xml2rfc.ietf.org/public/rfc/html/rfc3339.html#anchor14)
password | `string` | `password` | Used to hint UIs the input needs to be obscured.
### Schema
#### <a name="swaggerObject"></a>Swagger Object
This is the root document object for the API specification. It combines what previously was the Resource Listing and API Declaration (version 1.2 and earlier) together into one document.
##### Fixed Fields
Field Name | Type | Description
---|:---:|---
<a name="swaggerSwagger"></a>swagger | `string` | **Required.** Specifies the Swagger Specification version being used. It can be used by the Swagger UI and other clients to interpret the API listing. The value MUST be `"2.0"`.
<a name="swaggerInfo"></a>info | [Info Object](#infoObject) | **Required.** Provides metadata about the API. The metadata can be used by the clients if needed.
<a name="swaggerHost"></a>host | `string` | The host (name or ip) serving the API. This MUST be the host only and does not include the scheme nor sub-paths. It MAY include a port. If the `host` is not included, the host serving the documentation is to be used (including the port). The `host` does not support [path templating](#pathTemplating).
<a name="swaggerBasePath"></a>basePath | `string` | The base path on which the API is served, which is relative to the [`host`](#swaggerHost). If it is not included, the API is served directly under the `host`. The value MUST start with a leading slash (`/`). The `basePath` does not support [path templating](#pathTemplating).
<a name="swaggerSchemes"></a>schemes | [`string`] | The transfer protocol of the API. Values MUST be from the list: `"http"`, `"https"`, `"ws"`, `"wss"`. If the `schemes` is not included, the default scheme to be used is the one used to access the specification.
<a name="swaggerConsumes"></a>consumes | [`string`] | A list of MIME types the APIs can consume. This is global to all APIs but can be overridden on specific API calls. Value MUST be as described under [Mime Types](#mimeTypes).
<a name="swaggerProduces"></a>produces | [`string`] | A list of MIME types the APIs can produce. This is global to all APIs but can be overridden on specific API calls. Value MUST be as described under [Mime Types](#mimeTypes).
<a name="swaggerPaths"></a>paths | [Paths Object](#pathsObject) | **Required.** The available paths and operations for the API.
<a name="swaggerDefinitions"></a>definitions | [Definitions Object](#definitionsObject) | An object to hold data types produced and consumed by operations.
<a name="swaggerParameters"></a>parameters | [Parameters Definitions Object](#parametersDefinitionsObject) | An object to hold parameters that can be used across operations. This property *does not* define global parameters for all operations.
<a name="swaggerResponses"></a>responses | [Responses Definitions Object](#responsesDefinitionsObject) | An object to hold responses that can be used across operations. This property *does not* define global responses for all operations.
<a name="swaggerSecurityDefinitions"></a>securityDefinitions | [Security Definitions Object](#securityDefinitionsObject) | Security scheme definitions that can be used across the specification.
<a name="swaggerSecurity"></a>security | [[Security Requirement Object](#securityRequirementObject)] | A declaration of which security schemes are applied for the API as a whole. The list of values describes alternative security schemes that can be used (that is, there is a logical OR between the security requirements). Individual operations can override this definition.
<a name="swaggerTags"></a>tags | [[Tag Object](#tagObject)] | A list of tags used by the specification with additional metadata. The order of the tags can be used to reflect on their order by the parsing tools. Not all tags that are used by the [Operation Object](#operationObject) must be declared. The tags that are not declared may be organized randomly or based on the tools' logic. Each tag name in the list MUST be unique.
<a name="swaggerExternalDocs"></a>externalDocs | [External Documentation Object](#externalDocumentationObject) | Additional external documentation.
#### <a name="infoObject"></a>Info Object
The object provides metadata about the API. The metadata can be used by the clients if needed, and can be presented in the Swagger-UI for convenience.
##### Fixed Fields
Field Name | Type | Description
---|:---:|---
<a name="infoTitle"></a>title | `string` | **Required.** The title of the application.
<a name="infoDescription"></a>description | `string` | A short description of the application. [GFM syntax](https://help.github.com/articles/github-flavored-markdown) can be used for rich text representation.
<a name="infoTermsOfService"></a>termsOfService | `string` | The Terms of Service for the API.
<a name="infoContact"></a>contact | [Contact Object](#contactObject) | The contact information for the exposed API.
<a name="infoLicense"></a>license | [License Object](#licenseObject) | The license information for the exposed API.
<a name="infoVersion"></a>version | `string` | **Required** Provides the version of the application API (not to be confused with the specification version).
##### Patterned Objects
Field Pattern | Type | Description
---|:---:|---
<a name="operationExtensions"></a>^x- | Any | Allows extensions to the Swagger Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Vendor Extensions](#vendorExtensions) for further details.
##### Info Object Example:
```js
{
"title": "Swagger Sample App",
"description": "This is a sample server Petstore server.",
"termsOfService": "http://swagger.io/terms/",
"contact": {
"name": "API Support",
"url": "http://www.swagger.io/support",
"email": "support@swagger.io"
},
"license": {
"name": "Apache 2.0",
"url": "http://www.apache.org/licenses/LICENSE-2.0.html"
},
"version": "1.0.1"
}
```
```yaml
title: Swagger Sample App
description: This is a sample server Petstore server.
termsOfService: http://swagger.io/terms/
contact:
name: API Support
url: http://www.swagger.io/support
email: support@swagger.io
license:
name: Apache 2.0
url: http://www.apache.org/licenses/LICENSE-2.0.html
version: 1.0.1
```
#### <a name="contactObject"></a>Contact Object
Contact information for the exposed API.
##### Fixed Fields
Field Name | Type | Description
---|:---:|---
<a name="contactName"></a>name | `string` | The identifying name of the contact person/organization.
<a name="contactUrl"></a>url | `string` | The URL pointing to the contact information. MUST be in the format of a URL.
<a name="contactEmail"></a>email | `string` | The email address of the contact person/organization. MUST be in the format of an email address.
##### Contact Object Example:
```js
{
"name": "API Support",
"url": "http://www.swagger.io/support",
"email": "support@swagger.io"
}
```
```yaml
name: API Support
url: http://www.swagger.io/support
email: support@swagger.io
```
#### <a name="licenseObject"></a>License Object
License information for the exposed API.
##### Fixed Fields
Field Name | Type | Description
---|:---:|---
<a name="licenseName"></a>name | `string` | **Required.** The license name used for the API.
<a name="licenseUrl"></a>url | `string` | A URL to the license used for the API. MUST be in the format of a URL.
##### License Object Example:
```js
{
"name": "Apache 2.0",
"url": "http://www.apache.org/licenses/LICENSE-2.0.html"
}
```
```yaml
name: Apache 2.0
url: http://www.apache.org/licenses/LICENSE-2.0.html
```
#### <a name="pathsObject"></a>Paths Object
Holds the relative paths to the individual endpoints. The path is appended to the [`basePath`](#swaggerBasePath) in order to construct the full URL.
The Paths may be empty, due to [ACL constraints](#securityFiltering).
##### Patterned Fields
Field Pattern | Type | Description
---|:---:|---
<a name="pathsPath"></a>/{path} | [Path Item Object](#pathItemObject) | A relative path to an individual endpoint. The field name MUST begin with a slash. The path is appended to the [`basePath`](#swaggerBasePath) in order to construct the full URL. [Path templating](#pathTemplating) is allowed.
<a name="pathsExtensions"></a>^x- | Any | Allows extensions to the Swagger Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Vendor Extensions](#vendorExtensions) for further details.
##### Paths Object Example
```js
{
"/pets": {
"get": {
"description": "Returns all pets from the system that the user has access to",
"produces": [
"application/json"
],
"responses": {
"200": {
"description": "A list of pets.",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/pet"
}
}
}
}
}
}
}
```
```yaml
/pets:
get:
description: Returns all pets from the system that the user has access to
produces:
- application/json
responses:
200:
description: A list of pets.
schema:
type: array
items:
$ref: '#/definitions/pet'
```
#### <a name="pathItemObject"></a>Path Item Object
Describes the operations available on a single path.
A Path Item may be empty, due to [ACL constraints](#securityFiltering). The path itself is still exposed to the documentation viewer but they will not know which operations and parameters are available.
##### Fixed Fields
Field Name | Type | Description
---|:---:|---
<a name="pathItemRef"></a>$ref | `string` | Allows for an external definition of this path item. The referenced structure MUST be in the format of a [Path Item Object](#pathItemObject). If there are conflicts between the referenced definition and this Path Item's definition, the behavior is *undefined*.
<a name="pathItemGet"></a>get | [Operation Object](#operationObject) | A definition of a GET operation on this path.
<a name="pathItemPut"></a>put | [Operation Object](#operationObject) | A definition of a PUT operation on this path.
<a name="pathItemPost"></a>post | [Operation Object](#operationObject) | A definition of a POST operation on this path.
<a name="pathItemDelete"></a>delete | [Operation Object](#operationObject) | A definition of a DELETE operation on this path.
<a name="pathItemOptions"></a>options | [Operation Object](#operationObject) | A definition of a OPTIONS operation on this path.
<a name="pathItemHead"></a>head | [Operation Object](#operationObject) | A definition of a HEAD operation on this path.
<a name="pathItemPatch"></a>patch | [Operation Object](#operationObject) | A definition of a PATCH operation on this path.
<a name="pathItemParameters"></a>parameters | [[Parameter Object](#parameterObject) <span>|</span> [Reference Object](#referenceObject)] | A list of parameters that are applicable for all the operations described under this path. These parameters can be overridden at the operation level, but cannot be removed there. The list MUST NOT include duplicated parameters. A unique parameter is defined by a combination of a [name](#parameterName) and [location](#parameterIn). The list can use the [Reference Object](#referenceObject) to link to parameters that are defined at the [Swagger Object's parameters](#swaggerParameters). There can be one "body" parameter at most.
##### Patterned Fields
Field Pattern | Type | Description
---|:---:|---
<a name="pathItemExtensions"></a>^x- | Any | Allows extensions to the Swagger Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Vendor Extensions](#vendorExtensions) for further details.
##### Path Item Object Example
```js
{
"get": {
"description": "Returns pets based on ID",
"summary": "Find pets by ID",
"operationId": "getPetsById",
"produces": [
"application/json",
"text/html"
],
"responses": {
"200": {
"description": "pet response",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/Pet"
}
}
},
"default": {
"description": "error payload",
"schema": {
"$ref": "#/definitions/ErrorModel"
}
}
}
},
"parameters": [
{
"name": "id",
"in": "path",
"description": "ID of pet to use",
"required": true,
"type": "array",
"items": {
"type": "string"
},
"collectionFormat": "csv"
}
]
}
```
```yaml
get:
description: Returns pets based on ID
summary: Find pets by ID
operationId: getPetsById
produces:
- application/json
- text/html
responses:
200:
description: pet response
schema:
type: array
items:
$ref: '#/definitions/Pet'
default:
description: error payload
schema:
$ref: '#/definitions/ErrorModel'
parameters:
- name: id
in: path
description: ID of pet to use
required: true
type: array
items:
type: string
collectionFormat: csv
```
#### <a name="operationObject"></a>Operation Object
Describes a single API operation on a path.
##### Fixed Fields
Field Name | Type | Description
---|:---:|---
<a name="operationTags"></a>tags | [`string`] | A list of tags for API documentation control. Tags can be used for logical grouping of operations by resources or any other qualifier.
<a name="operationSummary"></a>summary | `string` | A short summary of what the operation does. For maximum readability in the swagger-ui, this field SHOULD be less than 120 characters.
<a name="operationDescription"></a>description | `string` | A verbose explanation of the operation behavior. [GFM syntax](https://help.github.com/articles/github-flavored-markdown) can be used for rich text representation.
<a name="operationExternalDocs"></a>externalDocs | [External Documentation Object](#externalDocumentationObject) | Additional external documentation for this operation.
<a name="operationId"></a>operationId | `string` | A friendly name for the operation. The id MUST be unique among all operations described in the API. Tools and libraries MAY use the operation id to uniquely identify an operation.
<a name="operationConsumes"></a>consumes | [`string`] | A list of MIME types the operation can consume. This overrides the [`consumes`](#swaggerConsumes) definition at the Swagger Object. An empty value MAY be used to clear the global definition. Value MUST be as described under [Mime Types](#mimeTypes).
<a name="operationProduces"></a>produces | [`string`] | A list of MIME types the operation can produce. This overrides the [`produces`](#swaggerProduces) definition at the Swagger Object. An empty value MAY be used to clear the global definition. Value MUST be as described under [Mime Types](#mimeTypes).
<a name="operationParameters"></a>parameters | [[Parameter Object](#parameterObject) <span>|</span> [Reference Object](#referenceObject)] | A list of parameters that are applicable for this operation. If a parameter is already defined at the [Path Item](#pathItemParameters), the new definition will override it, but can never remove it. The list MUST NOT include duplicated parameters. A unique parameter is defined by a combination of a [name](#parameterName) and [location](#parameterIn). The list can use the [Reference Object](#referenceObject) to link to parameters that are defined at the [Swagger Object's parameters](#swaggerParameters). There can be one "body" parameter at most.
<a name="operationResponses"></a>responses | [Responses Object](#responsesObject) | **Required.** The list of possible responses as they are returned from executing this operation.
<a name="operationSchemes"></a>schemes | [`string`] | The transfer protocol for the operation. Values MUST be from the list: `"http"`, `"https"`, `"ws"`, `"wss"`. The value overrides the Swagger Object [`schemes`](#swaggerSchemes) definition.
<a name="operationDeprecated"></a>deprecated | `boolean` | Declares this operation to be deprecated. Usage of the declared operation should be refrained. Default value is `false`.
<a name="operationSecurity"></a>security | [[Security Requirement Object](#securityRequirementObject)] | A declaration of which security schemes are applied for this operation. The list of values describes alternative security schemes that can be used (that is, there is a logical OR between the security requirements). This definition overrides any declared top-level [`security`](#swaggerSecurity). To remove a top-level security declaration, an empty array can be used.
##### Patterned Objects
Field Pattern | Type | Description
---|:---:|---
<a name="operationExtensions"></a>^x- | Any | Allows extensions to the Swagger Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Vendor Extensions](#vendorExtensions) for further details.
##### Operation Object Example
```js
{
"tags": [
"pet"
],
"summary": "Updates a pet in the store with form data",
"description": "",
"operationId": "updatePetWithForm",
"consumes": [
"application/x-www-form-urlencoded"
],
"produces": [
"application/json",
"application/xml"
],
"parameters": [
{
"name": "petId",
"in": "path",
"description": "ID of pet that needs to be updated",
"required": true,
"type": "string"
},
{
"name": "name",
"in": "formData",
"description": "Updated name of the pet",
"required": false,
"type": "string"
},
{
"name": "status",
"in": "formData",
"description": "Updated status of the pet",
"required": false,
"type": "string"
}
],
"responses": {
"200": {
"description": "Pet updated."
},
"405": {
"description": "Invalid input"
}
},
"security": [
{
"petstore_auth": [
"write:pets",
"read:pets"
]
}
]
}
```
```yaml
tags:
- pet
summary: Updates a pet in the store with form data
description: ""
operationId: updatePetWithForm
consumes:
- application/x-www-form-urlencoded
produces:
- application/json
- application/xml
parameters:
- name: petId
in: path
description: ID of pet that needs to be updated
required: true
type: string
- name: name
in: formData
description: Updated name of the pet
required: false
type: string
- name: status
in: formData
description: Updated status of the pet
required: false
type: string
responses:
200:
description: Pet updated.
405:
description: Invalid input
security:
- petstore_auth:
- write:pets
- read:pets
```
#### <a name="externalDocumentationObject"></a>External Documentation Object
Allows referencing an external resource for extended documentation.
##### Fixed Fields
Field Name | Type | Description
---|:---:|---
<a name="externalDocDescription"></a>description | `string` | A short description of the target documentation. [GFM syntax](https://help.github.com/articles/github-flavored-markdown) can be used for rich text representation.
<a name="externalDocUrl"></a>url | `string` | **Required.** The URL for the target documentation. Value MUST be in the format of a URL.
##### External Documentation Object Example
```js
{
"description": "Find more info here",
"url": "https://swagger.io"
}
```
```yaml
description: Find more info here
url: https://swagger.io
```
#### <a name="parameterObject"></a>Parameter Object
Describes a single operation parameter.
A unique parameter is defined by a combination of a [name](#parameterName) and [location](#parameterIn).
There are five possible parameter types.
* Path - Used together with [Path Templating](#pathTemplating), where the parameter value is actually part of the operation's URL. This does not include the host or base path of the API. For example, in `/items/{itemId}`, the path parameter is `itemId`.
* Query - Parameters that are appended to the URL. For example, in `/items?id=###`, the query parameter is `id`.
* Header - Custom headers that are expected as part of the request.
* Body - The payload that's appended to the HTTP request. Since there can only be one payload, there can only be *one* body parameter. The name of the body parameter has no effect on the parameter itself and is used for documentation purposes only. Since Form parameters are also in the payload, body and form parameters cannot exist together for the same operation.
* Form - Used to describe the payload of an HTTP request when either `application/x-www-form-urlencoded` or `multipart/form-data` are used as the content type of the request (in Swagger's definition, the [`consumes`](#operationConsumes) property of an operation). This is the only parameter type that can be used to send files, thus supporting the `file` type. Since form parameters are sent in the payload, they cannot be declared together with a body parameter for the same operation. Form parameters have a different format based on the content-type used (for further details, consult http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4):
* `application/x-www-form-urlencoded` - Similar to the format of Query parameters but as a payload. For example, `foo=1&bar=swagger` - both `foo` and `bar` are form parameters. This is normally used for simple parameters that are being transferred.
* `multipart/form-data` - each parameter takes a section in the payload with an internal header. For example, for the header `Content-Disposition: form-data; name="submit-name"` the name of the parameter is `submit-name`. This type of form parameters is more commonly used for file transfers.
##### Fixed Fields
Field Name | Type | Description
---|:---:|---
<a name="parameterName"></a>name | `string` | **Required.** The name of the parameter. Parameter names are *case sensitive*. <ul><li>If [`in`](#parameterIn) is `"path"`, the `name` field MUST correspond to the associated path segment from the [path](#pathsPath) field in the [Paths Object](#pathsObject). See [Path Templating](#pathTemplating) for further information.<li>For all other cases, the `name` corresponds to the parameter name used based on the [`in`](#parameterIn) property.</ul>
<a name="parameterIn"></a>in | `string` | **Required.** The location of the parameter. Possible values are "query", "header", "path", "formData" or "body".
<a name="parameterDescription"></a>description | `string` | A brief description of the parameter. This could contain examples of use. [GFM syntax](https://help.github.com/articles/github-flavored-markdown) can be used for rich text representation.
<a name="parameterRequired"></a>required | `boolean` | Determines whether this parameter is mandatory. If the parameter is [`in`](#parameterIn) "path", this property is **required** and its value MUST be `true`. Otherwise, the property MAY be included and its default value is `false`.
If [`in`](#parameterIn) is `"body"`:
Field Name | Type | Description
---|:---:|---
<a name="parameterSchema"></a>schema | [Schema Object](#schemaObject) | **Required.** The schema defining the type used for the body parameter.
If [`in`](#parameterIn) is any value other than `"body"`:
Field Name | Type | Description
---|:---:|---
<a name="parameterType"></a>type | `string` | **Required.** The type of the parameter. Since the parameter is not located at the request body, it is limited to simple types (that is, not an object). The value MUST be one of `"string"`, `"number"`, `"integer"`, `"boolean"`, `"array"` or `"file"`. If `type` is `"file"`, the [`consumes`](#operationConsumes) MUST be either `"multipart/form-data"` or `" application/x-www-form-urlencoded"` and the parameter MUST be [`in`](#parameterIn) `"formData"`.
<a name="parameterFormat"></a>format | `string` | The extending format for the previously mentioned [`type`](#parameterType). See [Data Type Formats](#dataTypeFormat) for further details.
<a name="parameterAllowEmptyValue"/>allowEmptyValue | `boolean` | Sets the ability to pass empty-valued parameters. This is valid only for either `query` or `formData` parameters and allows you to send a parameter with a name only or an empty value. Default value is `false`.
<a name="parameterItems"></a>items | [Items Object](#itemsObject) | **Required if [`type`](#parameterType) is "array".** Describes the type of items in the array.
<a name="parameterCollectionFormat"></a>collectionFormat | `string` | Determines the format of the array if type array is used. Possible values are: <ul><li>`csv` - comma separated values `foo,bar`. <li>`ssv` - space separated values `foo bar`. <li>`tsv` - tab separated values `foo\tbar`. <li>`pipes` - pipe separated values <code>foo|bar</code>. <li>`multi` - corresponds to multiple parameter instances instead of multiple values for a single instance `foo=bar&foo=baz`. This is valid only for parameters [`in`](#parameterIn) "query" or "formData". </ul> Default value is `csv`.
<a name="parameterDefault"></a>default | * | Sets a default value to the parameter. See http://json-schema.org/latest/json-schema-validation.html#anchor101. Unlike JSON Schema this value MUST conform to the defined [`type`](#parameterType) for this parameter.
<a name="parameterMaximum"></a>maximum | `number` | See http://json-schema.org/latest/json-schema-validation.html#anchor17.
<a name="parameterExclusiveMaximum"></a>exclusiveMaximum | `boolean` | See http://json-schema.org/latest/json-schema-validation.html#anchor17.
<a name="parameterMinimum"></a>minimum | `number` | See http://json-schema.org/latest/json-schema-validation.html#anchor21.
<a name="parameterExclusiveMinimum"></a>exclusiveMinimum | `boolean` | See http://json-schema.org/latest/json-schema-validation.html#anchor21.
<a name="parameterMaxLength"></a>maxLength | `integer` | See http://json-schema.org/latest/json-schema-validation.html#anchor26.
<a name="parameterMinLength"></a>minLength | `integer` | See http://json-schema.org/latest/json-schema-validation.html#anchor29.
<a name="parameterPattern"></a>pattern | `string` | See http://json-schema.org/latest/json-schema-validation.html#anchor33.
<a name="parameterMaxItems"></a>maxItems | `integer` | See http://json-schema.org/latest/json-schema-validation.html#anchor42.
<a name="parameterMinItems"></a>minItems | `integer` | See http://json-schema.org/latest/json-schema-validation.html#anchor45.
<a name="parameterUniqueItems"></a>uniqueItems | `boolean` | See http://json-schema.org/latest/json-schema-validation.html#anchor49.
<a name="parameterEnum"></a>enum | [*] | See http://json-schema.org/latest/json-schema-validation.html#anchor76.
<a name="parameterMultipleOf"></a>multipleOf | `number` | See http://json-schema.org/latest/json-schema-validation.html#anchor14.
##### Patterned Fields
Field Pattern | Type | Description
---|:---:|---
<a name="parameterExtensions"></a>^x- | Any | Allows extensions to the Swagger Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Vendor Extensions](#vendorExtensions) for further details.
##### Parameter Object Examples
###### Body Parameters
A body parameter with a referenced schema definition (normally for a model definition):
```js
{
"name": "user",
"in": "body",
"description": "user to add to the system",
"required": true,
"schema": {
"$ref": "#/definitions/User"
}
}
```
```yaml
name: user
in: body
description: user to add to the system
required: true
schema:
$ref: '#/definitions/User'
```
A body parameter that is an array of string values:
```js
{
"name": "user",
"in": "body",
"description": "user to add to the system",
"required": true,
"schema": {
"type": "array",
"items": {
"type": "string"
}
}
}
```
```yaml
name: user
in: body
description: user to add to the system
required: true
schema:
type: array
items:
type: string
```
###### Other Parameters
A header parameter with an array of 64 bit integer numbers:
```js
{
"name": "token",
"in": "header",
"description": "token to be passed as a header",
"required": true,
"type": "array",
"items": {
"type": "integer",
"format": "int64"
},
"collectionFormat": "csv"
}
```
```yaml
name: token
in: header
description: token to be passed as a header
required: true
type: array
items:
type: integer
format: int64
collectionFormat: csv
```
A path parameter of a string value:
```js
{
"name": "username",
"in": "path",
"description": "username to fetch",
"required": true,
"type": "string"
}
```
```yaml
name: username
in: path
description: username to fetch
required: true
type: string
```
An optional query parameter of a string value, allowing multiple values by repeating the query parameter:
```js
{
"name": "id",
"in": "query",
"description": "ID of the object to fetch",
"required": false,
"type": "array",
"items": {
"type": "string"
},
"collectionFormat": "multi"
}
```
```yaml
name: id
in: query
description: ID of the object to fetch
required: false
type: array
items:
type: string
collectionFormat: multi
```
A form data with file type for a file upload:
```js
{
"name": "avatar",
"in": "formData",
"description": "The avatar of the user",
"required": true,
"type": "file"
}
```
```yaml
name: avatar
in: formData
description: The avatar of the user
required: true
type: file
```
#### <a name="itemsObject"></a>Items Object
An limited subset of JSON-Schema's items object. It is used by parameter definitions that are not located [`in`](#parameterIn) `"body"`.
##### Fixed Fields
Field Name | Type | Description
---|:---:|---
<a name="itemsType"></a>type | `string` | **Required.** The internal type of the array. The value MUST be one of `"string"`, `"number"`, `"integer"`, `"boolean"`, or `"array"`. Files and models are not allowed.
<a name="itemsFormat"></a>format | `string` | The extending format for the previously mentioned [`type`](#parameterType). See [Data Type Formats](#dataTypeFormat) for further details.
<a name="itemsItems"></a>items | [Items Object](#itemsObject) | **Required if [`type`](#itemsType) is "array".** Describes the type of items in the array.
<a name="itemsCollectionFormat"></a>collectionFormat | `string` | Determines the format of the array if type array is used. Possible values are: <ul><li>`csv` - comma separated values `foo,bar`. <li>`ssv` - space separated values `foo bar`. <li>`tsv` - tab separated values `foo\tbar`. <li>`pipes` - pipe separated values <code>foo|bar</code>. </ul> Default value is `csv`.
<a name="itemsDefault"></a>default | * | Sets a default value to the data type. See http://json-schema.org/latest/json-schema-validation.html#anchor101. Unlike JSON Schema this value MUST conform to the defined [`type`](#itemsType) for the data type.
<a name="itemsMaximum"></a>maximum | `number` | See http://json-schema.org/latest/json-schema-validation.html#anchor17.
<a name="itemsMaximum"></a>exclusiveMaximum | `boolean` | See http://json-schema.org/latest/json-schema-validation.html#anchor17.
<a name="itemsMinimum"></a>minimum | `number` | See http://json-schema.org/latest/json-schema-validation.html#anchor21.
<a name="itemsExclusiveMinimum"></a>exclusiveMinimum | `boolean` | See http://json-schema.org/latest/json-schema-validation.html#anchor21.
<a name="itemsMaxLength"></a>maxLength | `integer` | See http://json-schema.org/latest/json-schema-validation.html#anchor26.
<a name="itemsMinLength"></a>minLength | `integer` | See http://json-schema.org/latest/json-schema-validation.html#anchor29.
<a name="itemsPattern"></a>pattern | `string` | See http://json-schema.org/latest/json-schema-validation.html#anchor33.
<a name="itemsMaxItems"></a>maxItems | `integer` | See http://json-schema.org/latest/json-schema-validation.html#anchor42.
<a name="itemsMinItems"></a>minItems | `integer` | See http://json-schema.org/latest/json-schema-validation.html#anchor45.
<a name="itemsUniqueItems"></a>uniqueItems | `boolean` | See http://json-schema.org/latest/json-schema-validation.html#anchor49.
<a name="itemsEnum"></a>enum | [*] | See http://json-schema.org/latest/json-schema-validation.html#anchor76.
<a name="itemsMultipleOf"></a>multipleOf | `number` | See http://json-schema.org/latest/json-schema-validation.html#anchor14.
##### Items Object Examples
Items must be of type string and have the minimum length of 2 characters:
```js
{
"type": "string",
"minLength": 2
}
```
```yaml
type: string
minLength: 2
```
An array of arrays, the internal array being of type integer, numbers must be between 0 and 63 (inclusive):
```js
{
"type": "array",
"items": {
"type": "integer",
"minimum": 0,
"maximum": 63
}
}
```
```yaml
type: array
items:
type: integer
minimum: 0
maximum: 63
```
#### <a name="responsesObject"></a>Responses Object
A container for the expected responses of an operation. The container maps a HTTP response code to the expected response. It is not expected from the documentation to necessarily cover all possible HTTP response codes, since they may not be known in advance. However, it is expected from the documentation to cover a successful operation response and any known errors.
The `default` can be used a default response object for all HTTP codes that are not covered individually by the specification.
The `Responses Object` MUST contain at least one response code, and it SHOULD be the response for a successful operation call.
##### Fixed Fields
Field Name | Type | Description
---|:---:|---
<a name="responsesDefault"></a>default | [Response Object](#responseObject) <span>|</span> [Reference Object](#referenceObject) | The documentation of responses other than the ones declared for specific HTTP response codes. It can be used to cover undeclared responses. [Reference Object](#referenceObject) can be used to link to a response that is defined at the [Swagger Object's responses](#swaggerResponses) section.
##### Patterned Fields
Field Pattern | Type | Description
---|:---:|---
<a name="responsesCode"></a>{[HTTP Status Code](#httpCodes)} | [Response Object](#responseObject) <span>|</span> [Reference Object](#referenceObject) | Any [HTTP status code](#httpCodes) can be used as the property name (one property per HTTP status code). Describes the expected response for that HTTP status code. [Reference Object](#referenceObject) can be used to link to a response that is defined at the [Swagger Object's responses](#swaggerResponses) section.
<a name="parameterExtensions"></a>^x- | Any | Allows extensions to the Swagger Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Vendor Extensions](#vendorExtensions) for further details.
##### Responses Object Example
A 200 response for successful operation and a default response for others (implying an error):
```js
{
"200": {
"description": "a pet to be returned",
"schema": {
"$ref": "#/definitions/Pet"
}
},
"default": {
"description": "Unexpected error",
"schema": {
"$ref": "#/definitions/ErrorModel"
}
}
}
```
```yaml
200:
description: a pet to be returned
schema:
$ref: '#/definitions/Pet'
default:
description: Unexpected error
schema:
$ref: '#/definitions/ErrorModel'
```
#### <a name="responseObject"></a>Response Object
Describes a single response from an API Operation.
##### Fixed Fields
Field Name | Type | Description
---|:---:|---
<a name="responseDescription"></a>description | `string` | **Required.** A short description of the response. [GFM syntax](https://help.github.com/articles/github-flavored-markdown) can be used for rich text representation.
<a name="responseSchema"></a>schema | [Schema Object](#schemaObject) | A definition of the response structure. It can be a primitive, an array or an object. If this field does not exist, it means no content is returned as part of the response. As an extension to the [Schema Object](#schemaObject), its root `type` value may also be `"file"`. This SHOULD be accompanied by a relevant `produces` mime-type.
<a name="responseHeaders"></a>headers | [Headers Object](#headersObject) | A list of headers that are sent with the response.
<a name="responseExamples"></a>examples | [Example Object](#exampleObject) | An example of the response message.
##### Response Object Examples
Response of an array of a complex type:
```js
{
"description": "A complex object array response",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/VeryComplexType"
}
}
}
```
```yaml
description: A complex object array response
schema:
type: array
items:
$ref: '#/definitions/VeryComplexType'
```
Response with a string type:
```js
{
"description": "A simple string response",
"schema": {
"type": "string"
}
}
```
```yaml
description: A simple string response
schema:
type: string
```
Response with headers:
```js
{
"description": "A simple string response",
"schema": {
"type": "string"
},
"headers": {
"X-Rate-Limit-Limit": {
"description": "The number of allowed requests in the current period",
"type": "integer"
},
"X-Rate-Limit-Remaining": {
"description": "The number of remaining requests in the current period",
"type": "integer"
},
"X-Rate-Limit-Reset": {
"description": "The number of seconds left in the current period",
"type": "integer"
}
}
}
```
```yaml
description: A simple string response
schema:
type: string
headers:
X-Rate-Limit-Limit:
description: The number of allowed requests in the current period
type: integer
X-Rate-Limit-Remaining:
description: The number of remaining requests in the current period
type: integer
X-Rate-Limit-Reset:
description: The number of seconds left in the current period
type: integer
```
Response with no return value:
```js
{
"description": "object created"
}
```
```yaml
description: object created
```
#### <a name="headersObject"></a>Headers Object
Lists the headers that can be sent as part of a response.
##### Patterned Fields
Field Pattern | Type | Description
---|:---:|---
<a name="headersName"></a>{name} | [Header Object](#headerObject) | The name of the property corresponds to the name of the header. The value describes the type of the header.
##### Headers Object Example
Rate-limit headers:
```js
{
"X-Rate-Limit-Limit": {
"description": "The number of allowed requests in the current period",
"type": "integer"
},
"X-Rate-Limit-Remaining": {
"description": "The number of remaining requests in the current period",
"type": "integer"
},
"X-Rate-Limit-Reset": {
"description": "The number of seconds left in the current period",
"type": "integer"
}
}
```
```yaml
X-Rate-Limit-Limit:
description: The number of allowed requests in the current period
type: integer
X-Rate-Limit-Remaining:
description: The number of remaining requests in the current period
type: integer
X-Rate-Limit-Reset:
description: The number of seconds left in the current period
type: integer
```
#### <a name="exampleObject"></a>Example Object
Allows sharing examples for operation responses.
##### Patterned Fields
Field Pattern | Type | Description
---|:---:|---
<a name="exampleMimeType"></a>{[mime type](#mimeTypes)} | Any | The name of the property MUST be one of the Operation `produces` values (either implicit or inherited). The value SHOULD be an example of what such a response would look like.
##### Example Object Example
Example response for application/json mimetype of a Pet data type:
```js
{
"application/json": {
"name": "Puma",
"type": "Dog",
"color": "Black",
"gender": "Female",
"breed": "Mixed"
}
}
```
```yaml
application/json:
name: Puma
type: Dog
color: Black
gender: Female
breed: Mixed
```
#### <a name="headerObject"></a>Header Object
Field Name | Type | Description
---|:---:|---
<a name="headerDescription"></a>description | `string` | A short description of the header.
<a name="headerType"></a>type | `string` | **Required.** The type of the object. The value MUST be one of `"string"`, `"number"`, `"integer"`, `"boolean"`, or `"array"`.
<a name="headerFormat"></a>format | `string` | The extending format for the previously mentioned [`type`](#stType). See [Data Type Formats](#dataTypeFormat) for further details.
<a name="headerItems"></a>items | [Items Object](#itemsObject) | **Required if [`type`](#stType) is "array".** Describes the type of items in the array.
<a name="headerCollectionFormat"></a>collectionFormat | `string` | Determines the format of the array if type array is used. Possible values are: <ul><li>`csv` - comma separated values `foo,bar`. <li>`ssv` - space separated values `foo bar`. <li>`tsv` - tab separated values `foo\tbar`. <li>`pipes` - pipe separated values <code>foo|bar</code>. </ul> Default value is `csv`.
<a name="headerDefault"></a>default | * | Sets a default value for the header. See http://json-schema.org/latest/json-schema-validation.html#anchor101. Unlike JSON Schema this value MUST conform to the defined [`type`](#headerDefault) for the header.
<a name="headerMaximum"></a>maximum | `number` | See http://json-schema.org/latest/json-schema-validation.html#anchor17.
<a name="headerMaximum"></a>exclusiveMaximum | `boolean` | See http://json-schema.org/latest/json-schema-validation.html#anchor17.
<a name="headerMinimum"></a>minimum | `number` | See http://json-schema.org/latest/json-schema-validation.html#anchor21.
<a name="headerExclusiveMinimum"></a>exclusiveMinimum | `boolean` | See http://json-schema.org/latest/json-schema-validation.html#anchor21.
<a name="headerMaxLength"></a>maxLength | `integer` | See http://json-schema.org/latest/json-schema-validation.html#anchor26.
<a name="headerMinLength"></a>minLength | `integer` | See http://json-schema.org/latest/json-schema-validation.html#anchor29.
<a name="headerPattern"></a>pattern | `string` | See http://json-schema.org/latest/json-schema-validation.html#anchor33.
<a name="headerMaxItems"></a>maxItems | `integer` | See http://json-schema.org/latest/json-schema-validation.html#anchor42.
<a name="headerMinItems"></a>minItems | `integer` | See http://json-schema.org/latest/json-schema-validation.html#anchor45.
<a name="headerUniqueItems"></a>uniqueItems | `boolean` | See http://json-schema.org/latest/json-schema-validation.html#anchor49.
<a name="headerEnum"></a>enum | [*] | See http://json-schema.org/latest/json-schema-validation.html#anchor76.
<a name="headerMultipleOf"></a>multipleOf | `number` | See http://json-schema.org/latest/json-schema-validation.html#anchor14.
##### Header Object Example
A simple header with of an integer type:
```js
{
"description": "The number of allowed requests in the current period",
"type": "integer"
}
```
```yaml
description: The number of allowed requests in the current period
type: integer
```
#### <a name="tagObject"></a>Tag Object
Allows adding meta data to a single tag that is used by the [Operation Object](#operationObject). It is not mandatory to have a Tag Object per tag used there.
##### Fixed Fields
Field Name | Type | Description
---|:---:|---
<a name="tagName"></a>name | `string` | **Required.** The name of the tag.
<a name="tagDescription"></a>description | `string` | A short description for the tag. [GFM syntax](https://help.github.com/articles/github-flavored-markdown) can be used for rich text representation.
<a name="tagExternalDocs"></a>externalDocs | [External Documentation Object](#externalDocumentationObject) | Additional external documentation for this tag.
##### Patterned Fields
Field Pattern | Type | Description
---|:---:|---
<a name="tagExtensions"></a>^x- | Any | Allows extensions to the Swagger Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Vendor Extensions](#vendorExtensions) for further details.
##### Tag Object Example
```js
{
"name": "pet",
"description": "Pets operations"
}
```
```yaml
name: pet
description: Pets operations
```
#### <a name="referenceObject"></a>Reference Object
A simple object to allow referencing other definitions in the specification. It can be used to reference parameters and responses that are defined at the top level for reuse.
The Reference Object is a [JSON Reference](http://tools.ietf.org/html/draft-pbryan-zyp-json-ref-02) that uses a [JSON Pointer](http://tools.ietf.org/html/rfc6901) as its value. For this specification, only [canonical dereferencing](http://json-schema.org/latest/json-schema-core.html#anchor27) is supported.
##### Fixed Fields
Field Name | Type | Description
---|:---:|---
<a name="referenceRef"></a>$ref | `string` | **Required.** The reference string.
##### Reference Object Example
```js
{
"$ref": "#/definitions/Pet"
}
```
```yaml
$ref: '#/definitions/Pet'
```
#### <a name="schemaObject"></a>Schema Object
The Schema Object allows the definition of input and output data types. These types can be objects, but also primitives and arrays. This object is based on the [JSON Schema Specification Draft 4](http://json-schema.org/) and uses a predefined subset of it. On top of this subset, there are extensions provided by this specification to allow for more complete documentation.
Further information about the properties can be found in [JSON Schema Core](http://json-schema.org/latest/json-schema-core.html) and [JSON Schema Validation](http://json-schema.org/latest/json-schema-validation.html). Unless stated otherwise, the property definitions follow the JSON Schema specification as referenced here.
The following properties are taken directly from the JSON Schema definition and follow the same specifications:
- $ref - As a [JSON Reference](https://tools.ietf.org/html/draft-pbryan-zyp-json-ref-03)
- format (See [Data Type Formats](#dataTypeFormat) for further details)
- title
- description ([GFM syntax](https://help.github.com/articles/github-flavored-markdown) can be used for rich text representation)
- default (Unlike JSON Schema, the value MUST conform to the defined type for the Schema Object)
- multipleOf
- maximum
- exclusiveMaximum
- minimum
- exclusiveMinimum
- maxLength
- minLength
- pattern
- maxItems
- minItems
- uniqueItems
- maxProperties
- minProperties
- required
- enum
- type
The following properties are taken from the JSON Schema definition but their definitions were adjusted to the Swagger Specification. Their definition is the same as the one from JSON Schema, only where the original definition references the JSON Schema definition, the [Schema Object](#schemaObject) definition is used instead.
- items
- allOf
- properties
- additionalProperties
Other than the JSON Schema subset fields, the following fields may be used for further schema documentation.
##### Fixed Fields
Field Name | Type | Description
---|:---:|---
<a name="schemaDiscriminator"></a>discriminator | `string` | Adds support for polymorphism. The discriminator is the schema property name that is used to differentiate between other schema that inherit this schema. The property name used MUST be defined at this schema and it MUST be in the `required` property list. When used, the value MUST be the name of this schema or any schema that inherits it.
<a name="schemaReadOnly"></a>readOnly | `boolean` | Relevant only for Schema `"properties"` definitions. Declares the property as "read only". This means that it MAY be sent as part of a response but MUST NOT be sent as part of the request. Properties marked as `readOnly` being `true` SHOULD NOT be in the `required` list of the defined schema. Default value is `false`.
<a name="schemaXml"></a>xml | [XML Object](#xmlObject) | This MAY be used only on properties schemas. It has no effect on root schemas. Adds Additional metadata to describe the XML representation format of this property.
<a name="schemaExternalDocs"></a>externalDocs | [External Documentation Object](#externalDocumentationObject) | Additional external documentation for this schema.
<a name="schemaExample"></a>example | Any | A free-form property to include a an example of an instance for this schema.
###### Composition and Inheritance (Polymorphism)
Swagger allows combining and extending model definitions using the `allOf` property of JSON Schema, in effect offering model composition. `allOf` takes in an array of object definitions that are validated *independently* but together compose a single object.
While composition offers model extensibility, it does not imply a hierarchy between the models. To support polymorphism, Swagger adds the support of the `discriminator` field. When used, the `discriminator` will be the name of the property used to decide which schema definition is used to validate the structure of the model. As such, the `discriminator` field MUST be a required field. The value of the chosen property has to be the friendly name given to the model under the `definitions` property. As such, inline schema definitions, which do not have a given id, *cannot* be used in polymorphism.
###### XML Modeling
The [xml](#schemaXml) property allows extra definitions when translating the JSON definition to XML. The [XML Object](#xmlObject) contains additional information about the available options.
##### Schema Object Examples
###### Primitive Sample
Unlike previous versions of Swagger, Schema definitions can be used to describe primitive and arrays as well.
```js
{
"type": "string",
"format": "email"
}
```
```yaml
type: string
format: email
```
###### Simple Model
```js
{
"type": "object",
"required": [
"name"
],
"properties": {
"name": {
"type": "string"
},
"address": {
"$ref": "#/definitions/Address"
},
"age": {
"type": "integer",
"format": "int32",
"minimum": 0
}
}
}
```
```yaml
type: object
required:
- name
properties:
name:
type: string
address:
$ref: '#/definitions/Address'
age:
type: integer
format: int32
minimum: 0
```
###### Model with Map/Dictionary Properties
For a simple string to string mapping:
```js
{
"type": "object",
"additionalProperties": {
"type": "string"
}
}
```
```yaml
type: object
additionalProperties:
type: string
```
For a string to model mapping:
```js
{
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/ComplexModel"
}
}
```
```yaml
type: object
additionalProperties:
$ref: '#/definitions/ComplexModel'
```
###### Model with Example
```js
{
"properties": {
"id": {
"type": "integer",
"format": "int64"
},
"name": {
"type": "string"
}
},
"required": [
"name"
],
"example": {
"name": "Puma",
"id": 1
}
}
```
```yaml
properties:
id:
type: integer
format: int64
name:
type: string
required:
- name
example:
name: Puma
id: 1
```
###### Models with Composition
```js
{
"definitions": {
"ErrorModel": {
"type": "object",
"required": [
"message",
"code"
],
"properties": {
"message": {
"type": "string"
},
"code": {
"type": "integer",
"minimum": 100,
"maximum": 600
}
}
},
"ExtendedErrorModel": {
"allOf": [
{
"$ref": "#/definitions/ErrorModel"
},
{
"type": "object",
"required": [
"rootCause"
],
"properties": {
"rootCause": {
"type": "string"
}
}
}
]
}
}
}
```
```yaml
definitions:
ErrorModel:
type: object
required:
- message
- code
properties:
message:
type: string
code:
type: integer
minimum: 100
maximum: 600
ExtendedErrorModel:
allOf:
- $ref: '#/definitions/ErrorModel'
- type: object
required:
- rootCause
properties:
rootCause:
type: string
```
###### Models with Polymorphism Support
```js
{
"definitions": {
"Pet": {
"discriminator": "petType",
"properties": {
"name": {
"type": "string"
},
"petType": {
"type": "string"
}
},
"required": [
"name",
"petType"
]
}
},
"Cat": {
"description": "A representation of a cat",
"allOf": [
{
"$ref": "#/definitions/Pet"
},
{
"properties": {
"huntingSkill": {
"type": "string",
"description": "The measured skill for hunting",
"default": "lazy",
"enum": [
"clueless",
"lazy",
"adventurous",
"aggressive"
]
}
},
"required": [
"huntingSkill"
]
}
]
},
"Dog": {
"description": "A representation of a dog",
"allOf": [
{
"$ref": "#/definitions/Pet"
},
{
"properties": {
"packSize": {
"type": "integer",
"format": "int32",
"description": "the size of the pack the dog is from",
"default": 0,
"minimum": 0
}
},
"required": [
"packSize"
]
}
]
}
}
```
```yaml
definitions:
Pet:
discriminator: petType
properties:
name:
type: string
petType:
type: string
required:
- name
- petType
Cat:
description: A representation of a cat
allOf:
- $ref: '#/definitions/Pet'
- properties:
huntingSkill:
type: string
description: The measured skill for hunting
default: lazy
enum:
- clueless
- lazy
- adventurous
- aggressive
required:
- huntingSkill
Dog:
description: A representation of a dog
allOf:
- $ref: '#/definitions/Pet'
- properties:
packSize:
type: integer
format: int32
description: the size of the pack the dog is from
default: 0
minimum: 0
required:
- packSize
```
#### <a name="xmlObject"></a>XML Object
A metadata object that allows for more fine-tuned XML model definitions.
When using arrays, XML element names are *not* inferred (for singular/plural forms) and the `name` property should be used to add that information. See examples for expected behavior.
##### Fixed Fields
Field Name | Type | Description
---|:---:|---
<a name="xmlName"></a>name | `string` | Replaces the name of the element/attribute used for the described schema property. When defined within the Items Object (`items`), it will affect the name of the individual XML elements within the list. When defined alongside `type` being `array` (outside the `items`), it will affect the wrapping element and only if `wrapped` is `true`. If `wrapped` is `false`, it will be ignored.
<a name="xmlNamespace"></a>namespace | `string` | The URL of the namespace definition. Value SHOULD be in the form of a URL.
<a name="xmlPrefix"></a>prefix | `string` | The prefix to be used for the [name](#xmlName).
<a name="xmlAttribute"></a>attribute | `boolean` | Declares whether the property definition translates to an attribute instead of an element. Default value is `false`.
<a name="xmlWrapped"></a>wrapped | `boolean` | MAY be used only for an array definition. Signifies whether the array is wrapped (for example, `<books><book/><book/></books>`) or unwrapped (`<book/><book/>`). Default value is `false`. The definition takes effect only when defined alongside `type` being `array` (outside the `items`).
##### XML Object Examples
The examples of the XML object definitions are included inside a property definition of a [Schema Object](#schemaObject) with a sample of the XML representation of it.
###### No XML Element
Basic string property:
```js
{
"animals": {
"type": "string"
}
}
```
```yaml
animals:
type: string
```
```xml
<animals>...</animals>
```
Basic string array property ([`wrapped`](#xmlWrapped) is `false` by default):
```js
{
"animals": {
"type": "array",
"items": {
"type": "string"
}
}
}
```
```yaml
animals:
type: array
items:
type: string
```
```xml
<animals>...</animals>
<animals>...</animals>
<animals>...</animals>
```
###### XML Name Replacement
```js
{
"animals": {
"type": "string",
"xml": {
"name": "animal"
}
}
}
```
```yaml
animals:
type: string
xml:
name: animal
```
```xml
<animal>...</animal>
```
###### XML Attribute, Prefix and Namespace
In this example, a full model definition is shown.
```js
{
"Person": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"format": "int32",
"xml": {
"attribute": true
},
"name": {
"type": "string",
"xml": {
"namespace": "http://swagger.io/schema/sample",
"prefix": "sample"
}
}
}
}
}
}
```
```yaml
Person:
type: object
properties:
id:
type: integer
format: int32
xml:
attribute: true
name:
type: string
xml:
namespace: http://swagger.io/schema/sample
prefix: sample
```
```xml
<Person id="123">
<sample:name xlmns:sample="http://swagger.io/schema/sample">example</sample:name>
</Person>
```
###### XML Arrays
Changing the element names:
```js
{
"animals": {
"type": "array",
"items": {
"type": "string",
"xml": {
"name": "animal"
}
}
}
}
```
```yaml
animals:
type: array
items:
type: string
xml:
name: animal
```
```xml
<animal>value</animal>
<animal>value</animal>
```
The external `name` property has no effect on the XML:
```js
{
"animals": {
"type": "array",
"items": {
"type": "string",
"xml": {
"name": "animal"
}
},
"xml": {
"name": "aliens"
}
}
}
```
```yaml
animals:
type: array
items:
type: string
xml:
name: animal
xml:
name: aliens
```
```xml
<animal>value</animal>
<animal>value</animal>
```
Even when the array is wrapped, if no name is explicitly defined, the same name will be used both internally and externally:
```js
{
"animals": {
"type": "array",
"items": {
"type": "string"
},
"xml": {
"wrapped": true
}
}
}
```
```yaml
animals:
type: array
items:
type: string
xml:
wrapped: true
```
```xml
<animals>
<animals>value</animals>
<animals>value</animals>
</animals>
```
To overcome the above example, the following definition can be used:
```js
{
"animals": {
"type": "array",
"items": {
"type": "string",
"xml": {
"name": "animal"
}
},
"xml": {
"wrapped": true
}
}
}
```
```yaml
animals:
type: array
items:
type: string
xml:
name: animal
xml:
wrapped: true
```
```xml
<animals>
<animal>value</animal>
<animal>value</animal>
</animals>
```
Affecting both internal and external names:
```js
{
"animals": {
"type": "array",
"items": {
"type": "string",
"xml": {
"name": "animal"
}
},
"xml": {
"name": "aliens",
"wrapped": false
}
}
}
```
```yaml
animals:
type: array
items:
type: string
xml:
name: animal
xml:
name: aliens
wrapped: false
```
```xml
<aliens>
<animal>value</animal>
<animal>value</animal>
</aliens>
```
If we change the external element but not the internal ones:
```js
{
"animals": {
"type": "array",
"items": {
"type": "string"
},
"xml": {
"name": "aliens",
"wrapped": true
}
}
}
```
```yaml
animals:
type: array
items:
type: string
xml:
name: aliens
wrapped: true
```
```xml
<aliens>
<aliens>value</aliens>
<aliens>value</aliens>
</aliens>
```
#### <a name="definitionsObject"></a>Definitions Object
An object to hold data types that can be consumed and produced by operations. These data types can be primitives, arrays or models.
##### Patterned Fields
Field Pattern | Type | Description
---|:---:|---
<a name="definitionsName"></a>{name} | [Schema Object](#schemaObject) | A single definition, mapping a "name" to the schema it defines.
##### Definitions Object Example
```js
{
"Category": {
"properties": {
"id": {
"type": "integer",
"format": "int64"
},
"name": {
"type": "string"
}
}
},
"Tag": {
"properties": {
"id": {
"type": "integer",
"format": "int64"
},
"name": {
"type": "string"
}
}
}
}
```
```yaml
Category:
properties:
id:
type: integer
format: int64
name:
type: string
Tag:
properties:
id:
type: integer
format: int64
name:
type: string
```
#### <a name="parametersDefinitionsObject"></a>Parameters Definitions Object
An object to hold parameters to be reused across operations. Parameter definitions can be referenced to the ones defined here.
This does *not* define global operation parameters.
##### Patterned Fields
Field Pattern | Type | Description
---|:---:|---
<a name="pdName"></a>{name} | [Parameter Object](#parameterObject) | A single parameter definition, mapping a "name" to the parameter it defines.
##### Parameters Definition Object Example
```js
{
"skipParam": {
"name": "skip",
"in": "query",
"description": "number of items to skip",
"required": true,
"type": "integer",
"format": "int32"
},
"limitParam": {
"name": "limit",
"in": "query",
"description": "max records to return",
"required": true,
"type": "integer",
"format": "int32"
}
}
```
```yaml
skipParam:
name: skip
in: query
description: number of items to skip
required: true
type: integer
format: int32
limitParam:
name: limit
in: query
description: max records to return
required: true
type: integer
format: int32
```
#### <a name="responsesDefinitionsObject"></a>Responses Definitions Object
An object to hold responses to be reused across operations. Response definitions can be referenced to the ones defined here.
This does *not* define global operation responses.
##### Patterned Fields
Field Pattern | Type | Description
---|:---:|---
<a name="rdName"></a>{name} | [Response Object](#responseObject) | A single response definition, mapping a "name" to the response it defines.
##### Responses Definitions Object Example
```js
{
"NotFound": {
"description": "Entity not found."
},
"IllegalInput": {
"description": "Illegal input for operation."
},
"GeneralError": {
"description": "General Error",
"schema": {
"$ref": "#/definitions/GeneralError"
}
}
}
```
```yaml
NotFound:
description: Entity not found.
IllegalInput:
description: Illegal input for operation.
GeneralError:
description: General Error
schema:
$ref: '#/definitions/GeneralError'
```
#### <a name="securityDefinitionsObject"></a>Security Definitions Object
A declaration of the security schemes available to be used in the specification. This does not enforce the security schemes on the operations and only serves to provide the relevant details for each scheme.
##### Patterned Fields
Field Pattern | Type | Description
---|:---:|---
<a name="sdName"></a>{name} | [Security Scheme Object](#securitySchemeObject) | A single security scheme definition, mapping a "name" to the scheme it defines.
##### Security Definitions Object Example
```js
{
"api_key": {
"type": "apiKey",
"name": "api_key",
"in": "header"
},
"petstore_auth": {
"type": "oauth2",
"authorizationUrl": "http://swagger.io/api/oauth/dialog",
"flow": "implicit",
"scopes": {
"write:pets": "modify pets in your account",
"read:pets": "read your pets"
}
}
}
```
```yaml
api_key:
type: apiKey
name: api_key
in: header
petstore_auth:
type: oauth2
authorizationUrl: http://swagger.io/api/oauth/dialog
flow: implicit
scopes:
write:pets: modify pets in your account
read:pets: read your pets
```
#### <a name="securitySchemeObject"></a>Security Scheme Object
Allows the definition of a security scheme that can be used by the operations. Supported schemes are basic authentication, an API key (either as a header or as a query parameter) and OAuth2's common flows (implicit, password, application and access code).
##### Fixed Fields
Field Name | Type | Validity | Description
---|:---:|---|---
<a name="securitySchemeType"></a>type | `string` | Any | **Required.** The type of the security scheme. Valid values are `"basic"`, `"apiKey"` or `"oauth2"`.
<a name="securitySchemeDescription"></a>description | `string` | Any | A short description for security scheme.
<a name="securitySchemeName"></a>name | `string` | `apiKey` | **Required.** The name of the header or query parameter to be used.
<a name="securitySchemeIn"></a>in | `string` | `apiKey` | **Required** The location of the API key. Valid values are `"query"` or `"header"`.
<a name="securitySchemeFlow"></a>flow | `string` | `oauth2` | **Required.** The flow used by the OAuth2 security scheme. Valid values are `"implicit"`, `"password"`, `"application"` or `"accessCode"`.
<a name="securitySchemeAuthorizationUrl"></a>authorizationUrl | `string` | `oauth2` (`"implicit"`, `"accessCode"`) | **Required.** The authorization URL to be used for this flow. This SHOULD be in the form of a URL.
<a name="securitySchemeTokenUrl"></a>tokenUrl | `string` | `oauth2` (`"password"`, `"application"`, `"accessCode"`) | **Required.** The token URL to be used for this flow. This SHOULD be in the form of a URL.
<a name="securitySchemeScopes"></a>scopes | [Scopes Object](#scopesObject) | `oauth2` | **Required.** The available scopes for the OAuth2 security scheme.
##### Patterned Fields
Field Name | Type | Description
---|:---:|---
<a name="securitySchemeExtensions"></a>^x- | Any | Allows extensions to the Swagger Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Vendor Extensions](#vendorExtensions) for further details.
##### Security Scheme Object Example
###### Basic Authentication Sample
```js
{
"type": "basic"
}
```
```yaml
type: basic
```
###### API Key Sample
```js
{
"type": "apiKey",
"name": "api_key",
"in": "header"
}
```
```yaml
type: apiKey
name: api_key
in: header
```
###### Implicit OAuth2 Sample
```js
{
"type": "oauth2",
"authorizationUrl": "http://swagger.io/api/oauth/dialog",
"flow": "implicit",
"scopes": {
"write:pets": "modify pets in your account",
"read:pets": "read your pets"
}
}
```
```yaml
type: oauth2
authorizationUrl: http://swagger.io/api/oauth/dialog
flow: implicit
scopes:
write:pets: modify pets in your account
read:pets: read your pets
```
#### <a name="scopesObject"></a>Scopes Object
Lists the available scopes for an OAuth2 security scheme.
##### Patterned Fields
Field Pattern | Type | Description
---|:---:|---
<a name="scopesName"></a>{name} | `string` | Maps between a name of a scope to a short description of it (as the value of the property).
##### Scopes Object Example
```js
{
"write:pets": "modify pets in your account",
"read:pets": "read your pets"
}
```
```yaml
write:pets: modify pets in your account
read:pets: read your pets
```
#### <a name="securityRequirementObject"></a>Security Requirement Object
Lists the required security schemes to execute this operation. The object can have multiple security schemes declared in it which are all required (that is, there is a logical AND between the schemes).
The name used for each property MUST correspond to a security scheme declared in the [Security Definitions](#securityDefinitionsObject).
##### Patterned Fields
Field Pattern | Type | Description
---|:---:|---
<a name="securityRequirementsName"></a>{name} | [`string`] | Each name must correspond to a security scheme which is declared in the [Security Definitions](#securityDefinitions). If the security scheme is of type `"oauth2"`, then the value is a list of scope names required for the execution. For other security scheme types, the array MUST be empty.
##### Security Requirement Object Examples
###### Non-OAuth2 Security Requirement
```js
{
"api_key": []
}
```
```yaml
api_key: []
```
###### OAuth2 Security Requirement
```js
{
"petstore_auth": [
"write:pets",
"read:pets"
]
}
```
```yaml
petstore_auth:
- write:pets
- read:pets
```
### <a name="vendorExtensions"></a>Specification Extensions
While the Swagger Specification tries to accommodate most use cases, additional data can be added to extend the specification at certain points.
The extensions properties are always prefixed by `"x-"` and can have any valid JSON format value.
The extensions may or may not be supported by the available tooling, but those may be extended as well to add requested support (if tools are internal or open-sourced).
### <a name="securityFiltering"></a>Security Filtering
Some objects in the Swagger specification may be declared and remain empty, or completely be removed, even though they are inherently the core of the API documentation.
The reasoning behind it is to allow an additional layer of access control over the documentation itself. While not part of the specification itself, certain libraries may choose to allow access to parts of the documentation based on some form of authentication/authorization.
Two examples for this:
1. The [Paths Object](#pathsObject) may be empty. It may be counterintuitive, but this may tell the viewer that they got to the right place, but can't access any documentation. They'd still have access to the [Info Object](#infoObject) which may contain additional information regarding authentication.
2. The [Path Item Object](#pathItemObject) may be empty. In this case, the viewer will be aware that the path exists, but will not be able to see any of its operations or parameters. This is different than hiding the path itself from the [Paths Object](#pathsObject) so the user will not be aware of its existence. This allows the documentation provider a finer control over what the viewer can see.
================================================
FILE: src/SwaggerWcf/Attributes/SwaggerWcfAttribute.cs
================================================
using System;
namespace SwaggerWcf.Attributes
{
/// <summary>
/// Attribute to enable a class or interface to be scanned by SwaggerWcf
/// </summary>
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface)]
public class SwaggerWcfAttribute : Attribute
{
/// <summary>
/// The base path on which the API is served, which is relative to the host. If it is not included,
/// the API is served directly under the host. The value MUST start with a leading slash (/). The
/// basePath does not support path templating.
/// </summary>
public string ServicePath { get; set; }
/// <summary>
/// Export this service on Swagger file
/// </summary>
public SwaggerWcfAttribute()
{
}
/// <summary>
/// Export this service on Swagger file with base path of <paramref name="servicePath"/>
/// </summary>
/// <param name="servicePath">Service path</param>
public SwaggerWcfAttribute(string servicePath)
{
ServicePath = servicePath.StartsWith("/") ? servicePath : $"/{servicePath}";
}
}
}
================================================
FILE: src/SwaggerWcf/Attributes/SwaggerWcfContactInfoAttribute.cs
================================================
using SwaggerWcf.Models;
using System;
namespace SwaggerWcf.Attributes
{
/// <summary>
/// Provides values for Contact information for the exposed API.
/// </summary>
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface)]
public class SwaggerWcfContactInfoAttribute : Attribute
{
/// <summary>
/// The identifying name of the contact person/organization.
/// </summary>
public string Name { get; set; }
/// <summary>
/// The email address of the contact person/organization. MUST be in the format of an email address.
/// </summary>
public string Email { get; set; }
/// <summary>
/// The URL pointing to the contact information. MUST be in the format of a URL.
/// </summary>
public string Url { get; set; }
public static explicit operator InfoContact(SwaggerWcfContactInfoAttribute attr)
{
return new InfoContact
{
Name = attr.Name,
Url = attr.Url,
Email = attr.Email
};
}
}
}
================================================
FILE: src/SwaggerWcf/Attributes/SwaggerWcfContentTypesAttribute.cs
================================================
using System;
using System.Net;
namespace SwaggerWcf.Attributes
{
/// <summary>
/// Overrides the return type
/// </summary>
[AttributeUsage(AttributeTargets.Method, AllowMultiple = true)]
public class SwaggerWcfContentTypesAttribute : Attribute
{
/// <summary>
/// Overrides the return type
/// </summary>
/// <param name="returnType">Method return type</param>
public SwaggerWcfContentTypesAttribute(string[] consumeTypes = null, string[] produceTypes = null)
{
ConsumeTypes = consumeTypes;
ProduceTypes = produceTypes;
}
/// <summary>
/// Override Response Content-Types
/// </summary>
public string[] ConsumeTypes { get; set; }
/// <summary>
/// Override Response Content-Types
/// </summary>
public string[] ProduceTypes { get; set; }
}
}
================================================
FILE: src/SwaggerWcf/Attributes/SwaggerWcfDefinitionAttribute.cs
================================================
using System;
namespace SwaggerWcf.Attributes
{
/// <summary>
/// Attribute to describe a class as a definition on swagger
/// </summary>
[AttributeUsage(AttributeTargets.Class)]
public class SwaggerWcfDefinitionAttribute : Attribute
{
/// <summary>
/// Description of the external documentation
/// </summary>
public string ExternalDocsDescription { get; set; }
/// <summary>
/// URL of the external documentation
/// </summary>
public string ExternalDocsUrl { get; set; }
/// <summary>
/// Optional custom name for model. Model names default to class's fully qualified name
/// </summary>
public string ModelName { get; set; }
/// <summary>
/// Configures a description with more information
/// </summary>
/// <param name="externalDocsDescription">Description external docs description</param>
/// <param name="externalDocsUrl">Description external docs URL</param>
public SwaggerWcfDefinitionAttribute(string externalDocsDescription = null,
string externalDocsUrl = null)
{
ExternalDocsDescription = externalDocsDescription;
ExternalDocsUrl = externalDocsUrl;
}
}
}
================================================
FILE: src/SwaggerWcf/Attributes/SwaggerWcfHeaderAttribute.cs
================================================
using System;
namespace SwaggerWcf.Attributes
{
/// <summary>
/// Describe a parameter
/// </summary>
[AttributeUsage(AttributeTargets.Method, AllowMultiple = true)]
public class SwaggerWcfHeaderAttribute : Attribute
{
/// <summary>
/// Describes a parameter
/// </summary>
/// <param name="name">Parameter name</param>
/// <param name="required">Set parameter as required. Defaults is false.</param>
/// <param name="description">Parameter description.</param>
/// <param name="defaultValue">Parameter default value.</param>
public SwaggerWcfHeaderAttribute(string name, bool required = false, string description = null, string defaultValue = null)
{
Name = name;
Required = required;
Description = description;
DefaultValue = defaultValue;
}
/// <summary>
/// Name of this parameter
/// </summary>
public string Name { get; set; }
/// <summary>
/// Defines if this parameter is required in operations
/// </summary>
public bool Required { get; set; }
/// <summary>
/// Description of this parameter
/// </summary>
public string Description { get; set; }
/// <summary>
/// Default value of this parameter
/// </summary>
public string DefaultValue { get; set; }
}
}
================================================
FILE: src/SwaggerWcf/Attributes/SwaggerWcfHiddenAttribute.cs
================================================
using System;
namespace SwaggerWcf.Attributes
{
/// <summary>
/// Attribute to hide a method, class, parameter or property from Swagger.
/// This overrides any tag-based settings.
/// </summary>
[AttributeUsage(
AttributeTargets.Method | AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Parameter)]
public class SwaggerWcfHiddenAttribute : Attribute
{
}
}
================================================
FILE: src/SwaggerWcf/Attributes/SwaggerWcfLicenseInfoAttribute.cs
================================================
using SwaggerWcf.Models;
using System;
namespace SwaggerWcf.Attributes
{
/// <summary>
/// Provides values for License information for the exposed API.
/// </summary>
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface)]
public class SwaggerWcfLicenseInfoAttribute : Attribute
{
/// <summary>
/// Required. The license name used for the API.
/// </summary>
public string Name { get; }
/// <summary>
/// A URL to the license used for the API. MUST be in the format of a URL.
/// </summary>
public string Url { get; set; }
/// <summary>
/// Provides values for License information for the exposed API.
/// </summary>
/// <param name="name">The license name used for the API.</param>
public SwaggerWcfLicenseInfoAttribute(string name)
{
if (string.IsNullOrWhiteSpace(name))
{
throw new ArgumentNullException(nameof(name));
}
Name = name;
}
public static explicit operator InfoLicense(SwaggerWcfLicenseInfoAttribute attr)
{
return new InfoLicense
{
Name = attr.Name,
Url = attr.Url
};
}
}
}
================================================
FILE: src/SwaggerWcf/Attributes/SwaggerWcfParameterAttribute.cs
================================================
using System;
namespace SwaggerWcf.Attributes
{
/// <summary>
/// Describe a parameter
/// </summary>
[AttributeUsage(AttributeTargets.Parameter)]
public class SwaggerWcfParameterAttribute : Attribute
{
/// <summary>
/// Describes a parameter
/// </summary>
/// <param name="required">Set parameter as required. Defaults is false.</param>
/// <param name="description">Parameter description.</param>
public SwaggerWcfParameterAttribute(bool required = false, string description = null, Type parameterType = null)
{
Required = required;
Description = description;
ParameterType = parameterType;
}
/// <summary>
/// Defines if this parameter is required in operations
/// </summary>
public bool Required { get; set; }
/// <summary>
/// Description of this parameter
/// </summary>
public string Description { get; set; }
/// <summary>
/// Override parameter type
/// </summary>
public Type ParameterType { get; set; }
}
}
================================================
FILE: src/SwaggerWcf/Attributes/SwaggerWcfPathAttribute.cs
================================================
using System;
namespace SwaggerWcf.Attributes
{
/// <summary>
/// Attribute to describe a method exported as a path in swagger
/// </summary>
[AttributeUsage(AttributeTargets.Method)]
public class SwaggerWcfPathAttribute : Attribute
{
/// <summary>
/// Configures a path with more information
/// </summary>
/// <param name="summary">Path summary</param>
/// <param name="description">Path description</param>
/// <param name="operationId">Path Operation ID</param>
/// <param name="externalDocsDescription">Path external docs description</param>
/// <param name="externalDocsUrl">Path external docs URL</param>
/// <param name="deprecated">Path deprecated (defaults to false)</param>
public SwaggerWcfPathAttribute(string summary = null, string description = null, string operationId = null,
string externalDocsDescription = null,
string externalDocsUrl = null, bool deprecated = false,
string operationPath = null)
{
Summary = summary;
Description = description;
OperationId = operationId;
ExternalDocsDescription = externalDocsDescription;
ExternalDocsUrl = externalDocsUrl;
Deprecated = deprecated;
OperationPath = operationPath;
}
/// <summary>
/// Path summary
/// </summary>
public string Summary { get; set; }
/// <summary>
/// Path description
/// </summary>
public string Description { get; set; }
/// <summary>
/// Path Operation ID
/// </summary>
public string OperationId { get; set; }
/// <summary>
/// Path external docs description
/// </summary>
public string ExternalDocsDescription { get; set; }
/// <summary>
/// Path external docs URL
/// </summary>
public string ExternalDocsUrl { get; set; }
/// <summary>
/// Path deprecated
/// </summary>
public bool Deprecated { get; set; }
/// <summary>
/// Operation path, extends service path
/// </summary>
public string OperationPath { get; set; }
}
}
================================================
FILE: src/SwaggerWcf/Attributes/SwaggerWcfPropertyAttribute.cs
================================================
using System;
using SwaggerWcf.Models;
namespace SwaggerWcf.Attributes
{
/// <summary>
/// Describe a property
/// </summary>
[AttributeUsage(AttributeTargets.Property, AllowMultiple = true)]
public class SwaggerWcfPropertyAttribute : Attribute
{
/// <summary>
/// Describes a property
/// </summary>
public SwaggerWcfPropertyAttribute()
{
}
public string Title { get; set; }
/// <summary>
/// Description of this parameter
/// </summary>
public string Description { get; set; }
/// <summary>
/// Determines whether this parameter is mandatory.
/// </summary>
public bool Required { get { return _Required.GetValueOrDefault(); } set { _Required = value; } }
/// <summary>
/// Sets the ability to pass empty-valued parameters. This is valid
/// only for either query or formData parameters and allows you to
/// send a parameter with a name only or an empty value.
/// </summary>
//public bool AllowEmptyValue { get { return _AllowEmptyValue ?? false; } set { _AllowEmptyValue = value; } }
/// <summary>
/// Determines the format of the array if type array is used.
/// </summary>
//public CollectionFormat? CollectionFormat { get; set; }
/// <summary>
/// Declares the value of the parameter that the server will use if none is provided
/// </summary>
public string Default { get; set; }
/// <summary>
/// Illustrate what the value is supposed to be like.
/// </summary>
public object Example { get; set; }
/// <summary>
/// Maximum allowed value, as modified by ExclusiveMaximum.
/// Must be a valid JSON number, and storable as a decimal.
/// </summary>
public string Maximum {
get { return _Maximum.HasValue ? _Maximum.ToString() : null; }
set { _Maximum = decimal.Parse(value); }
}
/// <summary>
/// If true, the instance is valid if it is strictly less than the value of Maximum.
/// </summary>
public bool ExclusiveMaximum {
get { return _ExclusiveMaximum.GetValueOrDefault(); }
set { _ExclusiveMaximum = value; }
}
/// <summary>
/// Minimum allowed value, as modified by ExclusiveMinimum
/// Must be a valid JSON number, and storable as a decimal.
/// </summary>
public string Minimum {
get { return _Minimum.HasValue ? _Minimum.ToString() : null; }
set { _Minimum = decimal.Parse(value); }
}
/// <summary>
/// If true, the instance is valid if it is strictly greatern than the value of Maximum.
/// </summary>
public bool ExclusiveMinimum {
get { return _ExclusiveMinimum.GetValueOrDefault(); }
set { _ExclusiveMinimum = value; }
}
/// <summary>
/// Maximum length.
/// </summary>
public int MaxLength {
get { return _MaxLength.GetValueOrDefault(); }
set { _MaxLength = value; }
}
/// <summary>
/// Minimum length
/// </summary>
public int MinLength {
get { return _MinLength.GetValueOrDefault(); }
set { _MinLength = value; }
}
/// <summary>
/// Should be a valid regular expression, according to the ECMA 262 regular expression dialect.
/// A string instance is considered valid if the regular expression matches the instance successfully.
/// Regular expressions are not implicitly anchored.
/// </summary>
public string Pattern { get; set; }
/// <summary>
/// An array instance is valid against MaxItems if its size
/// is less than, or equal to, the value of this keyword.
/// </summary>
public int MaxItems {
get { return _MaxItems.GetValueOrDefault(); }
set { _MaxItems = value; }
}
/// <summary>
/// An array instance is valid against MaxItems if its size
/// is greater than, or equal to, the value of this keyword.
/// </summary>
public int MinItems {
get { return _MinItems.GetValueOrDefault(); }
set { _MinItems = value; }
}
/// <summary>
/// If true, the instance validates successfully if all of its elements are unique.
/// </summary>
public bool UniqueItems {
get { return _UniqueItems.GetValueOrDefault(); }
set { _UniqueItems = value; }
}
/// <summary>
/// A numeric instance is valid against "multipleOf" if the result of
/// the division of the instance by this keyword's value is an integer.
/// </summary>
public decimal MultipleOf {
get { return _MultipleOf.GetValueOrDefault(); }
set { _MultipleOf = value; }
}
// To be usable as attribute named parameters, parameter types must not be
// nullable but we need to be able to see whether each value was set or not,
// so hide a nullable value for each available option.
internal bool? _Required { get; set; }
internal bool? _ExclusiveMaximum { get; set; }
internal decimal? _Minimum { get; set; }
internal decimal? _Maximum { get; set; }
internal bool? _ExclusiveMinimum { get; set; }
internal int? _MaxLength { get; set; }
internal int? _MinLength { get; set; }
internal int? _MaxItems { get; set; }
internal int? _MinItems { get; set; }
internal bool? _UniqueItems { get; set; }
internal decimal? _MultipleOf { get; set; }
}
}
================================================
FILE: src/SwaggerWcf/Attributes/SwaggerWcfRegexAttribute.cs
================================================
using System;
namespace SwaggerWcf.Attributes
{
/// <summary>
/// Apply a Regular Expression
/// </summary>
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false)]
public class SwaggerWcfRegexAttribute : Attribute
{
/// <summary>
/// Applies a Regular Expression to a field or property
/// </summary>
/// <param name="regex">Regular Expression</param>
public SwaggerWcfRegexAttribute(string regex)
{
Regex = regex;
}
/// <summary>
/// Regular Expression
/// </summary>
public string Regex { get; set; }
}
}
================================================
FILE: src/SwaggerWcf/Attributes/SwaggerWcfRequestTypeAttribute.cs
================================================
using System;
using System.Net;
namespace SwaggerWcf.Attributes
{
/// <summary>
/// Overrides the return type
/// </summary>
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]
public class SwaggerWcfRequestTypeAttribute : Attribute
{
/// <summary>
/// Overrides the return type
/// </summary>
/// <param name="name">Method parameter type name</param>
public SwaggerWcfRequestTypeAttribute(string name = null)
{
Name = name;
}
/// <summary>
/// Override parameter Type in Wrapped Request
/// </summary>
public string Name { get; set; }
}
}
================================================
FILE: src/SwaggerWcf/Attributes/SwaggerWcfResponseAttribute.cs
================================================
using System;
using System.Net;
namespace SwaggerWcf.Attributes
{
/// <summary>
/// Attribute to describe path responses. If none is specified, a 'default' one is created
/// </summary>
[AttributeUsage(AttributeTargets.Method, AllowMultiple = true)]
public class SwaggerWcfResponseAttribute : Attribute
{
/// <summary>
/// Configures a response for a path
/// </summary>
/// <param name="code">Result code</param>
/// <param name="description">Result description</param>
/// <param name="emptyResponseOverride">Result has empty response body (override default response type)</param>
/// <param name="headers">Optional HTTP headers returned</param>
/// <param name="responseTypeOverride">Optional response Type override</param>
/// <param name="exampleMimeType">Optional Response Example MIME Type</param>
/// <param name="exampleContent">Optional Response Example Content</param>
public SwaggerWcfResponseAttribute(string code, string description = null, bool emptyResponseOverride = false,
string[] headers = null, Type responseTypeOverride = null,
string exampleMimeType = null, string exampleContent = null)
{
Code = code;
Description = description;
EmptyResponseOverride = emptyResponseOverride;
Headers = headers;
ResponseTypeOverride = responseTypeOverride;
ExampleMimeType = exampleMimeType;
ExampleContent = exampleContent;
}
/// <summary>
/// Configures a response for a path
/// </summary>
/// <param name="code">Result code</param>
/// <param name="description">Result description</param>
/// <param name="emptyResponseOverride">Result has empty response body (override default response type)</param>
/// <param name="headers">Optional HTTP headers returned</param>
/// <param name="responseTypeOverride">Optional response Type override</param>
/// <param name="exampleMimeType">Optional Response Example MIME Type</param>
/// <param name="exampleContent">Optional Response Example Content</param>
public SwaggerWcfResponseAttribute(HttpStatusCode code, string description = null,
bool emptyResponseOverride = false,
string[] headers = null,
Type responseTypeOverride = null,
string exampleMimeType = null,
string exampleContent = null)
{
Code = ((int) code).ToString();
Description = description;
EmptyResponseOverride = emptyResponseOverride;
Headers = headers;
ResponseTypeOverride = responseTypeOverride;
ExampleMimeType = exampleMimeType;
ExampleContent = exampleContent;
}
/// <summary>
/// Configures a response for a path
/// </summary>
/// <param name="code">Result code</param>
/// <param name="description">Result description</param>
/// <param name="emptyResponseOverride">Result has empty response body (override default response type)</param>
/// <param name="headers">Optional HTTP headers returned</param>
/// <param name="responseTypeOverride">Optional response Type override</param>
/// <param name="exampleMimeType">Optional Response Example MIME Type</param>
/// <param name="exampleContent">Optional Response Example Content</param>
public SwaggerWcfResponseAttribute(int code, string description = null, bool emptyResponseOverride = false,
string[] headers = null, Type responseTypeOverride = null,
string exampleMimeType = null, string exampleContent = null)
{
Code = code.ToString();
Description = description;
EmptyResponseOverride = emptyResponseOverride;
Headers = headers;
ResponseTypeOverride = responseTypeOverride;
ExampleMimeType = exampleMimeType;
ExampleContent = exampleContent;
}
/// <summary>
/// Result code
/// </summary>
public string Code { get; set; }
/// <summary>
/// Result description
/// </summary>
public string Description { get; set; }
/// <summary>
/// Result has empty response body (override default response type)
/// </summary>
public bool EmptyResponseOverride { get; set; }
/// <summary>
/// Optional HTTP headers returned
/// </summary>
public string[] Headers { get; set; }
/// <summary>
/// Example MIME Type
/// </summary>
public string ExampleMimeType { get; set; }
/// <summary>
/// Example Content
/// </summary>
public string ExampleContent { get; set; }
/// <summary>
/// Override response type
/// </summary>
public Type ResponseTypeOverride { get; set; }
public override bool Equals(object obj)
{
SwaggerWcfResponseAttribute other = obj as SwaggerWcfResponseAttribute;
if (other != null)
{
return string.Equals(Code, other.Code) &&
string.Equals(Description, other.Description) &&
EmptyResponseOverride == other.EmptyResponseOverride &&
Equals(Headers, other.Headers) &&
ResponseTypeOverride == other.ResponseTypeOverride &&
ExampleMimeType == other.ExampleMimeType &&
ExampleContent == other.ExampleContent;
}
return base.Equals(obj);
}
public override int GetHashCode()
{
unchecked
{
int hashCode = base.GetHashCode();
hashCode = (hashCode * 397) ^ (Code != null ? Code.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ (Description != null ? Description.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ EmptyResponseOverride.GetHashCode();
hashCode = (hashCode * 397) ^ (Headers != null ? Headers.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ (ResponseTypeOverride != null ? ResponseTypeOverride.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ ExampleMimeType?.GetHashCode() ?? 0;
hashCode = (hashCode * 397) ^ ExampleContent?.GetHashCode() ?? 0;
return hashCode;
}
}
}
}
================================================
FILE: src/SwaggerWcf/Attributes/SwaggerWcfReturnTypeAttribute.cs
================================================
using System;
using System.Net;
namespace SwaggerWcf.Attributes
{
/// <summary>
/// Overrides the return type
/// </summary>
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]
public class SwaggerWcfReturnTypeAttribute : Attribute
{
/// <summary>
/// Overrides the return type
/// </summary>
/// <param name="returnType">Method return type</param>
/// <param name="name">Method return type name</param>
public SwaggerWcfReturnTypeAttribute(Type returnType = null, string name = null)
{
ReturnType = returnType;
Name = name;
}
/// <summary>
/// Override Return Type
/// </summary>
public Type ReturnType { get; set; }
/// <summary>
/// Override Return Type in Wrapped Responses
/// </summary>
public string Name { get; set; }
}
}
================================================
FILE: src/SwaggerWcf/Attributes/SwaggerWcfSecurityAttribute.cs
================================================
using System;
namespace SwaggerWcf.Attributes
{
/// <summary>
/// Attribute to link operation to a security definition
/// </summary>
[AttributeUsage(AttributeTargets.Method, AllowMultiple = true)]
public class SwaggerWcfSecurityAttribute : Attribute
{
/// <summary>
/// Specify security definition for this operation
/// </summary>
/// <param name="securityDefinitionName">Name of the Security Definition</param>
/// <param name="scopes">Scopes of the security definition</param>
public SwaggerWcfSecurityAttribute(string securityDefinitionName, params string[] scopes)
{
SecurityDefinitionName = securityDefinitionName;
SecurityDefinitionScopes = scopes;
}
/// <summary>
/// Name of the Security Definition
/// </summary>
public string SecurityDefinitionName { get; set; }
/// <summary>
/// Scopes of the Security Definition
/// </summary>
public string[] SecurityDefinitionScopes { get; set; }
}
}
================================================
FILE: src/SwaggerWcf/Attributes/SwaggerWcfServiceInfoAttribute.cs
================================================
using SwaggerWcf.Models;
using System;
namespace SwaggerWcf.Attributes
{
/// <summary>
/// Provides metadata about the API. The metadata can be used by the clients if needed.
/// </summary>
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface)]
public class SwaggerWcfServiceInfoAttribute : Attribute
{
/// <summary>
/// Required. The title of the application.
/// </summary>
public string Title { get; }
/// <summary>
/// Required Provides the version of the application API (not to be confused with the specification version).
/// </summary>
public string Version { get; }
/// <summary>
/// A short description of the application. GFM syntax can be used for rich text representation.
/// </summary>
public string Description { get; set; }
/// <summary>
/// The Terms of Service for the API.
/// </summary>
public string TermsOfService { get; set; }
/// <summary>
/// Assigns service info values
/// </summary>
/// <param name="title">The title of the application</param>
/// <param name="version">Provides the version of the application API (not to be confused with the specification version)</param>
public SwaggerWcfServiceInfoAttribute(string title, string version)
{
if (string.IsNullOrWhiteSpace(title))
throw new ArgumentNullException(nameof(title));
if (string.IsNullOrWhiteSpace(version))
throw new ArgumentNullException(nameof(version));
Title = title;
Version = version;
}
public static explicit operator Info(SwaggerWcfServiceInfoAttribute attribute) =>
new Info
{
Title = attribute.Title,
Version = attribute.Version,
Description = attribute.Description,
TermsOfService = attribute.TermsOfService
};
}
}
================================================
FILE: src/SwaggerWcf/Attributes/SwaggerWcfTagAttribute.cs
================================================
using System;
namespace SwaggerWcf.Attributes
{
/// <summary>
/// Attribute to inject a tag into a class, method, parameter or property.
/// Tags can be used to categorize in Swagger UI and to hide elements using configuration
/// </summary>
[AttributeUsage(
AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Class | AttributeTargets.Parameter,
AllowMultiple = true)]
public class SwaggerWcfTagAttribute : Attribute
{
/// <summary>
/// Injects a tag into an element
/// </summary>
/// <param name="name">Tag name</param>
/// <param name="hideFromSpec">Hide tag from spec</param>
public SwaggerWcfTagAttribute(string name, bool hideFromSpec = false)
{
TagName = name;
HideFromSpec = hideFromSpec;
}
/// <summary>
/// Tag name
/// </summary>
public string TagName { get; set; }
/// <summary>
/// Hide tag from spec
/// </summary>
public bool HideFromSpec { get; set; }
}
}
================================================
FILE: src/SwaggerWcf/Configuration/SettingCollection.cs
================================================
using System;
using System.Configuration;
namespace SwaggerWcf.Configuration
{
[ConfigurationCollection(typeof(TagElement), AddItemName = "setting")]
public class SettingCollection : ConfigurationElementCollection
{
protected override ConfigurationElement CreateNewElement()
{
return new SettingElement();
}
protected override object GetElementKey(ConfigurationElement element)
{
if (element == null)
{
throw new ArgumentException("element");
}
return ((SettingElement) element).Name;
}
}
}
================================================
FILE: src/SwaggerWcf/Configuration/SettingElement.cs
================================================
using System.Configuration;
namespace SwaggerWcf.Configuration
{
public class SettingElement : ConfigurationElement
{
[ConfigurationProperty("name", IsRequired = true, IsKey = true)]
public string Name
{
get
{
return (string) this["name"];
}
set
{
this["name"] = value;
}
}
[ConfigurationProperty("value", IsRequired = true)]
public string Value
{
get
{
return (string) this["value"];
}
set
{
this["value"] = value;
}
}
}
}
================================================
FILE: src/SwaggerWcf/Configuration/SwaggerWcfSection.cs
================================================
using System.Configuration;
namespace SwaggerWcf.Configuration
{
public class SwaggerWcfSection : ConfigurationSection
{
[ConfigurationProperty("tags", IsRequired = true)]
public TagCollection Tags
{
get
{
return (TagCollection) this["tags"];
}
set
{
this["tags"] = value;
}
}
[ConfigurationProperty("settings", IsRequired = false)]
public SettingCollection Settings
{
get
{
return (SettingCollection) this["settings"];
}
set
{
this["settings"] = value;
}
}
}
}
================================================
FILE: src/SwaggerWcf/Configuration/TagCollection.cs
================================================
using System;
using System.Configuration;
namespace SwaggerWcf.Configuration
{
[ConfigurationCollection(typeof(TagElement), AddItemName = "tag")]
public class TagCollection : ConfigurationElementCollection
{
protected override ConfigurationElement CreateNewElement()
{
return new TagElement();
}
protected override object GetElementKey(ConfigurationElement element)
{
if (element == null)
{
throw new ArgumentNullException("element");
}
return ((TagElement) element).Name;
}
}
}
================================================
FILE: src/SwaggerWcf/Configuration/TagElement.cs
================================================
using System.Configuration;
namespace SwaggerWcf.Configuration
{
public class TagElement : ConfigurationElement
{
[ConfigurationProperty("name", IsRequired = true, IsKey = true)]
public string Name
{
get
{
return (string) this["name"];
}
set
{
this["name"] = value;
}
}
[ConfigurationProperty("visible", DefaultValue = true, IsRequired = true)]
public bool Visibile
{
get
{
return (bool) this["visible"];
}
set
{
this["visible"] = value;
}
}
}
}
================================================
FILE: src/SwaggerWcf/ISwaggerWcfEndpoint.cs
================================================
using System.IO;
using System.ServiceModel;
using System.ServiceModel.Web;
namespace SwaggerWcf
{
[ServiceContract]
public interface ISwaggerWcfEndpoint
{
[OperationContract]
[WebGet(UriTemplate = "/swagger.json", BodyStyle = WebMessageBodyStyle.Bare, ResponseFormat = WebMessageFormat.Json)]
Stream GetSwaggerFile();
[OperationContract]
[WebInvoke(Method = "GET", BodyStyle = WebMessageBodyStyle.Bare, UriTemplate = "/{*content}")]
//[WebGet(UriTemplate = "/", BodyStyle = WebMessageBodyStyle.Bare, ResponseFormat = WebMessageFormat.Json)]
Stream StaticContent(string content);
}
}
================================================
FILE: src/SwaggerWcf/Models/CollectionFormat.cs
================================================
namespace SwaggerWcf.Models
{
public enum CollectionFormat
{
Csv = 0,
Ssv = 1,
Tsv = 2,
Pipes = 3,
Multi = 4
}
}
================================================
FILE: src/SwaggerWcf/Models/Definition.cs
================================================
using Newtonsoft.Json;
namespace SwaggerWcf.Models
{
internal class Definition
{
public DefinitionSchema Schema { get; set; }
public void Serialize(JsonWriter writer)
{
if (Schema == null)
return;
writer.WritePropertyName(Schema.Name);
writer.WriteStartObject();
Schema.Serialize(writer);
writer.WriteEndObject();
}
}
}
================================================
FILE: src/SwaggerWcf/Models/DefinitionProperty.cs
================================================
using System.Collections.Generic;
using System.Linq;
using Newtonsoft.Json;
namespace SwaggerWcf.Models
{
internal class DefinitionProperty
{
public DefinitionProperty()
{
Maximum = decimal.MaxValue;
Minimum = decimal.MinValue;
MaxLength = int.MaxValue;
MinLength = int.MinValue;
MaxItems = int.MaxValue;
MinItems = int.MinValue;
MultipleOf = decimal.MinValue;
}
public string Title { get; set; }
public string Description { get; set; }
public bool Required { get; set; }
public TypeFormat TypeFormat { get; set; }
public string Ref { get; set; }
public ParameterItems Items { get; set; }
public string Default { get; set; }
public object Example { get; set; }
public decimal Maximum { get; set; }
public bool ExclusiveMaximum { get; set; }
public decimal Minimum { get; set; }
public bool ExclusiveMinimum { get; set; }
public int MaxLength { get; set; }
public int MinLength { get; set; }
public string Pattern { get; set; }
public int MaxItems { get; set; }
public int MinItems { get; set; }
public bool UniqueItems { get; set; }
public List<int> Enum { get; set; }
public
gitextract_tza6k42w/
├── .gitignore
├── .gitmodules
├── LICENSE
├── README.md
├── notes/
│ ├── samples/
│ │ ├── petstore-expanded.json
│ │ ├── petstore-minimal.json
│ │ ├── petstore-simple.json
│ │ ├── petstore-with-external-docs.json
│ │ └── petstore.json
│ ├── schema.json
│ └── spec-2.0.md
└── src/
├── SwaggerWcf/
│ ├── Attributes/
│ │ ├── SwaggerWcfAttribute.cs
│ │ ├── SwaggerWcfContactInfoAttribute.cs
│ │ ├── SwaggerWcfContentTypesAttribute.cs
│ │ ├── SwaggerWcfDefinitionAttribute.cs
│ │ ├── SwaggerWcfHeaderAttribute.cs
│ │ ├── SwaggerWcfHiddenAttribute.cs
│ │ ├── SwaggerWcfLicenseInfoAttribute.cs
│ │ ├── SwaggerWcfParameterAttribute.cs
│ │ ├── SwaggerWcfPathAttribute.cs
│ │ ├── SwaggerWcfPropertyAttribute.cs
│ │ ├── SwaggerWcfRegexAttribute.cs
│ │ ├── SwaggerWcfRequestTypeAttribute.cs
│ │ ├── SwaggerWcfResponseAttribute.cs
│ │ ├── SwaggerWcfReturnTypeAttribute.cs
│ │ ├── SwaggerWcfSecurityAttribute.cs
│ │ ├── SwaggerWcfServiceInfoAttribute.cs
│ │ └── SwaggerWcfTagAttribute.cs
│ ├── Configuration/
│ │ ├── SettingCollection.cs
│ │ ├── SettingElement.cs
│ │ ├── SwaggerWcfSection.cs
│ │ ├── TagCollection.cs
│ │ └── TagElement.cs
│ ├── ISwaggerWcfEndpoint.cs
│ ├── Models/
│ │ ├── CollectionFormat.cs
│ │ ├── Definition.cs
│ │ ├── DefinitionProperty.cs
│ │ ├── DefinitionSchema.cs
│ │ ├── Example.cs
│ │ ├── ExternalDocumentation.cs
│ │ ├── InType.cs
│ │ ├── Info.cs
│ │ ├── InfoContact.cs
│ │ ├── InfoLicense.cs
│ │ ├── ParameterBase.cs
│ │ ├── ParameterItems.cs
│ │ ├── ParameterPrimitive.cs
│ │ ├── ParameterSchema.cs
│ │ ├── ParameterType.cs
│ │ ├── Path.cs
│ │ ├── PathAction.cs
│ │ ├── Property.cs
│ │ ├── Response.cs
│ │ ├── Schema.cs
│ │ ├── SecurityAuthorization.cs
│ │ ├── SecurityDefinitions.cs
│ │ ├── Service.cs
│ │ └── TypeFormat.cs
│ ├── Properties/
│ │ └── AssemblyInfo.cs
│ ├── Support/
│ │ ├── DefinitionsBuilder.cs
│ │ ├── EnumerableExtensions.cs
│ │ ├── Helpers.cs
│ │ ├── ListExtensions.cs
│ │ ├── Mapper.cs
│ │ ├── MethodInfoExtensions.cs
│ │ ├── Serializer.cs
│ │ ├── ServiceBuilder.cs
│ │ ├── StaticContent.cs
│ │ ├── TypeBuilder.cs
│ │ ├── TypeExtensions.cs
│ │ ├── TypeFieldsProcessor.cs
│ │ └── TypePropertiesProcessor.cs
│ ├── SwaggerWcf.csproj
│ ├── SwaggerWcf.csproj.DotSettings
│ ├── SwaggerWcf.nuspec
│ ├── SwaggerWcfEndpoint.cs
│ ├── SwaggerWcfEndpointGeneric.cs
│ └── packages.config
├── SwaggerWcf.Test.Service/
│ ├── AuthorService.cs
│ ├── BaseService.cs
│ ├── Data/
│ │ ├── Author.cs
│ │ ├── Book.cs
│ │ ├── Language.cs
│ │ └── Store.cs
│ ├── Global.asax
│ ├── Global.asax.cs
│ ├── IAuthorService.cs
│ ├── IBaseCRUDService.cs
│ ├── IBaseService.cs
│ ├── IStore.cs
│ ├── Properties/
│ │ └── AssemblyInfo.cs
│ ├── Store.svc
│ ├── Store.svc.cs
│ ├── SwaggerWcf.Test.Service.csproj
│ ├── SwaggerWcf.Test.Service.csproj.DotSettings
│ ├── Web.Debug.config
│ ├── Web.Release.config
│ └── Web.config
├── SwaggerWcf.sln
├── SwaggerWcf.sln.DotSettings
└── packages/
├── .gitignore
└── repositories.config
SYMBOL INDEX (284 symbols across 74 files)
FILE: src/SwaggerWcf.Test.Service/AuthorService.cs
class AuthorService (line 10) | [SwaggerWcf("/v1/authors")]
method Get (line 29) | [SwaggerWcfTag("GenericAuthor")]
method Create (line 35) | [SwaggerWcfTag("GenericAuthor")]
method Update (line 41) | [SwaggerWcfTag("GenericAuthor")]
method Delete (line 47) | [SwaggerWcfTag("GenericAuthor")]
FILE: src/SwaggerWcf.Test.Service/BaseService.cs
class BaseService (line 9) | public abstract class BaseService<T> : IBaseService, IBaseCRUDService<T>
method Create (line 11) | public abstract T Create(T item);
method Delete (line 12) | public abstract T Delete(string id);
method Get (line 13) | public abstract T Get(string id);
method Update (line 14) | public abstract T Update(string id, T item);
method TestService (line 16) | public virtual string TestService(string input)
method TestServicePost (line 21) | public string TestServicePost(string input, string postObj)
FILE: src/SwaggerWcf.Test.Service/Data/Author.cs
class Author (line 6) | [DataContract]
FILE: src/SwaggerWcf.Test.Service/Data/Book.cs
class Book (line 7) | [DataContract]
FILE: src/SwaggerWcf.Test.Service/Data/Language.cs
type Language (line 6) | [DataContract(Name = "language")]
FILE: src/SwaggerWcf.Test.Service/Data/Store.cs
class Store (line 6) | public class Store
method Store (line 8) | static Store()
FILE: src/SwaggerWcf.Test.Service/Global.asax.cs
class Global (line 10) | public class Global : HttpApplication
method Application_Start (line 12) | protected void Application_Start(object sender, EventArgs e)
method FilterVisibleTags (line 27) | private static List<string> FilterVisibleTags(string path, List<string...
method FilterHiddenTags (line 32) | private static List<string> FilterHiddenTags(string path, List<string>...
method Session_Start (line 37) | protected void Session_Start(object sender, EventArgs e)
method Application_BeginRequest (line 41) | protected void Application_BeginRequest(object sender, EventArgs e)
method Application_AuthenticateRequest (line 45) | protected void Application_AuthenticateRequest(object sender, EventArg...
method Application_Error (line 49) | protected void Application_Error(object sender, EventArgs e)
method Session_End (line 53) | protected void Session_End(object sender, EventArgs e)
method Application_End (line 57) | protected void Application_End(object sender, EventArgs e)
FILE: src/SwaggerWcf.Test.Service/IAuthorService.cs
type IAuthorService (line 10) | [ServiceContract]
FILE: src/SwaggerWcf.Test.Service/IBaseCRUDService.cs
type IBaseCRUDService (line 12) | [ServiceContract]
method Get (line 15) | [SwaggerWcfPath("Get Operation")]
method Create (line 23) | [SwaggerWcfPath("Create Operation")]
method Update (line 31) | [SwaggerWcfPath("Update Operation")]
method Delete (line 39) | [SwaggerWcfPath("Delete Operation")]
FILE: src/SwaggerWcf.Test.Service/IBaseService.cs
type IBaseService (line 12) | [ServiceContract]
method TestService (line 15) | [SwaggerWcfPath("Test Service")]
method TestServicePost (line 23) | [SwaggerWcfPath("Test Service")]
FILE: src/SwaggerWcf.Test.Service/IStore.cs
type IStore (line 11) | [ServiceContract]
method CreateBook (line 15) | [SwaggerWcfPath("Create book", "Create a book on the store")]
method ReadBooks (line 22) | [SwaggerWcfPath("Get books", "Retrieve all books from the store")]
method ReadBook (line 27) | [SwaggerWcfPath("Get book", "Retrieve a book from the store using its ...
method UpdateBook (line 33) | [SwaggerWcfPath("Update book", "Update a book on the store")]
method DeleteBook (line 42) | [SwaggerWcfPath("Delete book", "Delete a book on the store")]
method ReadBookAuthor (line 47) | [SwaggerWcfPath("Get book author", "Retrieve the author of a book usin...
method CreateAuthor (line 58) | [SwaggerWcfPath("Create author", "Create an author on the store")]
method ReadAuthors (line 65) | [SwaggerWcfPath("Get authors", "Retrieve all authors from the store")]
method ReadAuthor (line 70) | [SwaggerWcfPath("Get author", "Retrieve an author from the store using...
method UpdateAuthor (line 77) | [SwaggerWcfPath("Update author", "Update an author on the store")]
method DeleteAuthor (line 87) | [SwaggerWcfPath("Delete author", "Delete an author on the store")]
method ReadAuthorBooks (line 92) | [SwaggerWcfPath("Get author books", "Retrieve the author books using t...
method CreateLanguage (line 103) | [SwaggerWcfPath("Create language", "Create an language on the store")]
method ReadLanguages (line 110) | [SwaggerWcfPath("Get languages", "Retrieve all languages from the stor...
method ReadLanguage (line 115) | [SwaggerWcfPath("Get language", "Retrieve an language from the store u...
method UpdateLanguage (line 122) | [SwaggerWcfPath("Update language", "Update an language on the store")]
method DeleteLanguage (line 132) | [SwaggerWcfPath("Delete language", "Delete an language on the store")]
FILE: src/SwaggerWcf.Test.Service/Store.svc.cs
class BookStore (line 11) | [SwaggerWcf("/v1/rest")]
method CreateBook (line 32) | [SwaggerWcfTag("Books")]
method ReadBook (line 75) | [SwaggerWcfTag("Books")]
method ReadBooks (line 104) | [SwaggerWcfTag("Books")]
method UpdateBook (line 126) | [SwaggerWcfTag("Books")]
method DeleteBook (line 162) | [SwaggerWcfTag("Books")]
method ReadBookAuthor (line 190) | [SwaggerWcfTag("LowPerformance", true)]
method CreateAuthor (line 231) | [SwaggerWcfTag("Authors")]
method ReadAuthor (line 262) | [SwaggerWcfTag("Authors")]
method ReadAuthors (line 290) | [SwaggerWcfTag("Authors")]
method UpdateAuthor (line 310) | [SwaggerWcfTag("Authors")]
method DeleteAuthor (line 345) | [SwaggerWcfTag("Authors")]
method ReadAuthorBooks (line 372) | [SwaggerWcfTag("LowPerformance", true)]
method CreateLanguage (line 413) | [SwaggerWcfHidden]
method ReadLanguage (line 423) | [SwaggerWcfHidden]
method ReadLanguages (line 433) | [SwaggerWcfTag("Languages")]
method UpdateLanguage (line 447) | [SwaggerWcfHidden]
method DeleteLanguage (line 458) | [SwaggerWcfHidden]
FILE: src/SwaggerWcf/Attributes/SwaggerWcfAttribute.cs
class SwaggerWcfAttribute (line 8) | [AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface)]
method SwaggerWcfAttribute (line 21) | public SwaggerWcfAttribute()
method SwaggerWcfAttribute (line 29) | public SwaggerWcfAttribute(string servicePath)
FILE: src/SwaggerWcf/Attributes/SwaggerWcfContactInfoAttribute.cs
class SwaggerWcfContactInfoAttribute (line 9) | [AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface)]
FILE: src/SwaggerWcf/Attributes/SwaggerWcfContentTypesAttribute.cs
class SwaggerWcfContentTypesAttribute (line 9) | [AttributeUsage(AttributeTargets.Method, AllowMultiple = true)]
method SwaggerWcfContentTypesAttribute (line 16) | public SwaggerWcfContentTypesAttribute(string[] consumeTypes = null, s...
FILE: src/SwaggerWcf/Attributes/SwaggerWcfDefinitionAttribute.cs
class SwaggerWcfDefinitionAttribute (line 8) | [AttributeUsage(AttributeTargets.Class)]
method SwaggerWcfDefinitionAttribute (line 31) | public SwaggerWcfDefinitionAttribute(string externalDocsDescription = ...
FILE: src/SwaggerWcf/Attributes/SwaggerWcfHeaderAttribute.cs
class SwaggerWcfHeaderAttribute (line 8) | [AttributeUsage(AttributeTargets.Method, AllowMultiple = true)]
method SwaggerWcfHeaderAttribute (line 18) | public SwaggerWcfHeaderAttribute(string name, bool required = false, s...
FILE: src/SwaggerWcf/Attributes/SwaggerWcfHiddenAttribute.cs
class SwaggerWcfHiddenAttribute (line 9) | [AttributeUsage(
FILE: src/SwaggerWcf/Attributes/SwaggerWcfLicenseInfoAttribute.cs
class SwaggerWcfLicenseInfoAttribute (line 9) | [AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface)]
method SwaggerWcfLicenseInfoAttribute (line 26) | public SwaggerWcfLicenseInfoAttribute(string name)
FILE: src/SwaggerWcf/Attributes/SwaggerWcfParameterAttribute.cs
class SwaggerWcfParameterAttribute (line 8) | [AttributeUsage(AttributeTargets.Parameter)]
method SwaggerWcfParameterAttribute (line 16) | public SwaggerWcfParameterAttribute(bool required = false, string desc...
FILE: src/SwaggerWcf/Attributes/SwaggerWcfPathAttribute.cs
class SwaggerWcfPathAttribute (line 8) | [AttributeUsage(AttributeTargets.Method)]
method SwaggerWcfPathAttribute (line 20) | public SwaggerWcfPathAttribute(string summary = null, string descripti...
FILE: src/SwaggerWcf/Attributes/SwaggerWcfPropertyAttribute.cs
class SwaggerWcfPropertyAttribute (line 11) | [AttributeUsage(AttributeTargets.Property, AllowMultiple = true)]
method SwaggerWcfPropertyAttribute (line 17) | public SwaggerWcfPropertyAttribute()
FILE: src/SwaggerWcf/Attributes/SwaggerWcfRegexAttribute.cs
class SwaggerWcfRegexAttribute (line 8) | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, Allo...
method SwaggerWcfRegexAttribute (line 15) | public SwaggerWcfRegexAttribute(string regex)
FILE: src/SwaggerWcf/Attributes/SwaggerWcfRequestTypeAttribute.cs
class SwaggerWcfRequestTypeAttribute (line 9) | [AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]
method SwaggerWcfRequestTypeAttribute (line 16) | public SwaggerWcfRequestTypeAttribute(string name = null)
FILE: src/SwaggerWcf/Attributes/SwaggerWcfResponseAttribute.cs
class SwaggerWcfResponseAttribute (line 9) | [AttributeUsage(AttributeTargets.Method, AllowMultiple = true)]
method SwaggerWcfResponseAttribute (line 22) | public SwaggerWcfResponseAttribute(string code, string description = n...
method SwaggerWcfResponseAttribute (line 45) | public SwaggerWcfResponseAttribute(HttpStatusCode code, string descrip...
method SwaggerWcfResponseAttribute (line 71) | public SwaggerWcfResponseAttribute(int code, string description = null...
method Equals (line 119) | public override bool Equals(object obj)
method GetHashCode (line 135) | public override int GetHashCode()
FILE: src/SwaggerWcf/Attributes/SwaggerWcfReturnTypeAttribute.cs
class SwaggerWcfReturnTypeAttribute (line 9) | [AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]
method SwaggerWcfReturnTypeAttribute (line 17) | public SwaggerWcfReturnTypeAttribute(Type returnType = null, string na...
FILE: src/SwaggerWcf/Attributes/SwaggerWcfSecurityAttribute.cs
class SwaggerWcfSecurityAttribute (line 8) | [AttributeUsage(AttributeTargets.Method, AllowMultiple = true)]
method SwaggerWcfSecurityAttribute (line 16) | public SwaggerWcfSecurityAttribute(string securityDefinitionName, para...
FILE: src/SwaggerWcf/Attributes/SwaggerWcfServiceInfoAttribute.cs
class SwaggerWcfServiceInfoAttribute (line 9) | [AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface)]
method SwaggerWcfServiceInfoAttribute (line 37) | public SwaggerWcfServiceInfoAttribute(string title, string version)
FILE: src/SwaggerWcf/Attributes/SwaggerWcfTagAttribute.cs
class SwaggerWcfTagAttribute (line 9) | [AttributeUsage(
method SwaggerWcfTagAttribute (line 19) | public SwaggerWcfTagAttribute(string name, bool hideFromSpec = false)
FILE: src/SwaggerWcf/Configuration/SettingCollection.cs
class SettingCollection (line 6) | [ConfigurationCollection(typeof(TagElement), AddItemName = "setting")]
method CreateNewElement (line 9) | protected override ConfigurationElement CreateNewElement()
method GetElementKey (line 14) | protected override object GetElementKey(ConfigurationElement element)
FILE: src/SwaggerWcf/Configuration/SettingElement.cs
class SettingElement (line 5) | public class SettingElement : ConfigurationElement
FILE: src/SwaggerWcf/Configuration/SwaggerWcfSection.cs
class SwaggerWcfSection (line 5) | public class SwaggerWcfSection : ConfigurationSection
FILE: src/SwaggerWcf/Configuration/TagCollection.cs
class TagCollection (line 6) | [ConfigurationCollection(typeof(TagElement), AddItemName = "tag")]
method CreateNewElement (line 9) | protected override ConfigurationElement CreateNewElement()
method GetElementKey (line 14) | protected override object GetElementKey(ConfigurationElement element)
FILE: src/SwaggerWcf/Configuration/TagElement.cs
class TagElement (line 5) | public class TagElement : ConfigurationElement
FILE: src/SwaggerWcf/ISwaggerWcfEndpoint.cs
type ISwaggerWcfEndpoint (line 7) | [ServiceContract]
method GetSwaggerFile (line 10) | [OperationContract]
method StaticContent (line 14) | [OperationContract]
FILE: src/SwaggerWcf/Models/CollectionFormat.cs
type CollectionFormat (line 3) | public enum CollectionFormat
FILE: src/SwaggerWcf/Models/Definition.cs
class Definition (line 5) | internal class Definition
method Serialize (line 9) | public void Serialize(JsonWriter writer)
FILE: src/SwaggerWcf/Models/DefinitionProperty.cs
class DefinitionProperty (line 7) | internal class DefinitionProperty
method DefinitionProperty (line 9) | public DefinitionProperty()
method Serialize (line 60) | public void Serialize(JsonWriter writer)
FILE: src/SwaggerWcf/Models/DefinitionSchema.cs
class DefinitionSchema (line 7) | internal class DefinitionSchema
method Serialize (line 27) | public void Serialize(JsonWriter writer)
method SerializeRequired (line 103) | private void SerializeRequired(JsonWriter writer)
method SerializeExternalDocs (line 117) | private void SerializeExternalDocs(JsonWriter writer)
method SerializeProperties (line 126) | private void SerializeProperties(JsonWriter writer)
FILE: src/SwaggerWcf/Models/Example.cs
class Example (line 3) | internal class Example
FILE: src/SwaggerWcf/Models/ExternalDocumentation.cs
class ExternalDocumentation (line 6) | internal class ExternalDocumentation
method Serialize (line 12) | public void Serialize(JsonWriter writer)
FILE: src/SwaggerWcf/Models/InType.cs
type InType (line 3) | internal enum InType
FILE: src/SwaggerWcf/Models/Info.cs
class Info (line 6) | public class Info
method Serialize (line 20) | internal void Serialize(JsonWriter writer)
FILE: src/SwaggerWcf/Models/InfoContact.cs
class InfoContact (line 7) | public class InfoContact
method Serialize (line 23) | internal void Serialize(JsonWriter writer)
FILE: src/SwaggerWcf/Models/InfoLicense.cs
class InfoLicense (line 7) | public class InfoLicense
method Serialize (line 21) | internal void Serialize(JsonWriter writer)
FILE: src/SwaggerWcf/Models/ParameterBase.cs
class ParameterBase (line 6) | internal abstract class ParameterBase
method Serialize (line 17) | public abstract void Serialize(JsonWriter writer);
method Serialize (line 18) | public abstract void Serialize(JsonWriter writer, bool skipStartEndObj...
FILE: src/SwaggerWcf/Models/ParameterItems.cs
class ParameterItems (line 6) | internal class ParameterItems
method Serialize (line 14) | public void Serialize(JsonWriter writer)
FILE: src/SwaggerWcf/Models/ParameterPrimitive.cs
class ParameterPrimitive (line 7) | internal class ParameterPrimitive : ParameterBase
method ParameterPrimitive (line 9) | public ParameterPrimitive()
method Serialize (line 54) | public override void Serialize(JsonWriter writer)
method Serialize (line 58) | public override void Serialize(JsonWriter writer, bool skipStartEndObj...
FILE: src/SwaggerWcf/Models/ParameterSchema.cs
class ParameterSchema (line 6) | internal class ParameterSchema : ParameterBase
method Serialize (line 10) | public override void Serialize(JsonWriter writer)
method Serialize (line 14) | public override void Serialize(JsonWriter writer, bool skipStartEndObj...
FILE: src/SwaggerWcf/Models/ParameterType.cs
type ParameterType (line 3) | public enum ParameterType
FILE: src/SwaggerWcf/Models/Path.cs
class Path (line 7) | internal class Path
method Path (line 9) | public Path()
method Serialize (line 18) | public void Serialize(JsonWriter writer)
FILE: src/SwaggerWcf/Models/PathAction.cs
class PathAction (line 7) | internal class PathAction
method PathAction (line 9) | public PathAction()
method Serialize (line 45) | public void Serialize(JsonWriter writer)
FILE: src/SwaggerWcf/Models/Property.cs
class Property (line 7) | internal class Property
method Property (line 9) | public Property()
method Serialize (line 60) | public void Serialize(JsonWriter writer)
FILE: src/SwaggerWcf/Models/Response.cs
class Response (line 7) | internal class Response
method Serialize (line 19) | public void Serialize(JsonWriter writer)
FILE: src/SwaggerWcf/Models/Schema.cs
class Schema (line 7) | internal class Schema
method Serialize (line 27) | public void Serialize(JsonWriter writer)
method SerializeRequired (line 106) | private void SerializeRequired(JsonWriter writer)
method SerializeExternalDocs (line 120) | private void SerializeExternalDocs(JsonWriter writer)
method SerializeProperties (line 129) | private void SerializeProperties(JsonWriter writer)
FILE: src/SwaggerWcf/Models/SecurityAuthorization.cs
class SecurityAuthorization (line 6) | public class SecurityAuthorization
method Serialize (line 55) | public void Serialize(JsonWriter writer)
FILE: src/SwaggerWcf/Models/SecurityDefinitions.cs
class SecurityDefinitions (line 5) | public class SecurityDefinitions : Dictionary<string, SecurityAuthorizat...
FILE: src/SwaggerWcf/Models/Service.cs
class Service (line 7) | internal sealed class Service
method Service (line 9) | public Service()
method Serialize (line 32) | public void Serialize(JsonWriter writer)
method WritePaths (line 84) | private void WritePaths(JsonWriter writer)
method WriteDefinitions (line 94) | private void WriteDefinitions(JsonWriter writer)
method WriteSecurityDefinitions (line 104) | private void WriteSecurityDefinitions(JsonWriter writer)
FILE: src/SwaggerWcf/Models/TypeFormat.cs
type TypeFormat (line 3) | public struct TypeFormat
method TypeFormat (line 9) | public TypeFormat(ParameterType type, string format)
FILE: src/SwaggerWcf/Support/DefinitionsBuilder.cs
class DefinitionsBuilder (line 12) | internal sealed class DefinitionsBuilder
method Process (line 14) | public static List<Definition> Process(IList<string> hiddenTags, IList...
method IsHidden (line 39) | private static bool IsHidden(Type type, ICollection<string> hiddenTags...
method ConvertTypeToDefinition (line 52) | private static Definition ConvertTypeToDefinition(Type definitionType,...
method ProcessTypeAttributes (line 106) | private static void ProcessTypeAttributes(Type definitionType, Definit...
method GetEnumerableType (line 131) | public static Type GetEnumerableType(Type type)
method LastValidValue (line 146) | private static T LastValidValue<T>(IEnumerable<SwaggerWcfPropertyAttri...
method ApplyIfValid (line 152) | private static void ApplyIfValid<T>(T opt, Action<T> setter)
method ApplyAttributeOptions (line 160) | public static void ApplyAttributeOptions(PropertyInfo propertyInfo, De...
method ApplyAttributeOptions (line 178) | public static void ApplyAttributeOptions(FieldInfo fieldInfo, Definiti...
method ApplyAttributeOptions (line 196) | public static void ApplyAttributeOptions(IEnumerable<SwaggerWcfPropert...
method GetEnumMemberValue (line 218) | public static int GetEnumMemberValue(Type enumType, string enumName)
method GetEnumDescription (line 228) | public static string GetEnumDescription(Enum value)
FILE: src/SwaggerWcf/Support/EnumerableExtensions.cs
class EnumerableExtensions (line 9) | public static class EnumerableExtensions
method FilterUnique (line 11) | public static IEnumerable<T> FilterUnique<T>(this IEnumerable<T> list)
FILE: src/SwaggerWcf/Support/Helpers.cs
class Helpers (line 12) | internal static class Helpers
method MapSwaggerType (line 14) | public static TypeFormat MapSwaggerType(Type type, IList<Type> definit...
method BuildTypeString (line 128) | private static string BuildTypeString(string typeName, string defaultN...
method GetCustomAttributeValue (line 142) | public static T1 GetCustomAttributeValue<T1, T2>(MethodInfo method, st...
method GetCustomAttributeValue (line 161) | public static bool GetCustomAttributeValue<T>(MethodInfo method, strin...
method MapElementType (line 179) | internal static TypeFormat MapElementType(Type type, List<Type> defini...
method TagIsHidden (line 194) | internal static bool TagIsHidden(this Dictionary<string, TagElement> t...
FILE: src/SwaggerWcf/Support/ListExtensions.cs
class ListExtensions (line 6) | public static class ListExtensions
method ClosestMatch (line 8) | public static string ClosestMatch(this List<string> list, string value)
method Compute (line 29) | private static int Compute(string s, string t)
FILE: src/SwaggerWcf/Support/Mapper.cs
class Mapper (line 17) | internal class Mapper
method Mapper (line 19) | internal Mapper(IList<string> hiddenTags, List<string> visibleTags)
method FindMethods (line 28) | internal IEnumerable<Path> FindMethods(Type markedType, IList<Type> de...
method GetPath (line 101) | private Path GetPath(string id, List<Path> paths)
method ConcatPaths (line 117) | private static string ConcatPaths(string basePath, string pathUrl)
method GetActions (line 129) | internal IEnumerable<Tuple<string, PathAction>> GetActions(MethodInfo[...
method GetUriTemplate (line 353) | private string GetUriTemplate(WebInvokeAttribute wi, WebGetAttribute w...
method RemoveParametersDefaultValuesFromUri (line 358) | private string RemoveParametersDefaultValuesFromUri(string uriTemplate)
method IsRequestWrapped (line 376) | private static bool IsRequestWrapped(WebGetAttribute wg, WebInvokeAttr...
method IsResponseWrapped (line 385) | private static bool IsResponseWrapped(WebGetAttribute wg, WebInvokeAtt...
method GetParameter (line 394) | private ParameterBase GetParameter(TypeFormat typeFormat,
method ResolveParameterNameFromUri (line 550) | private static string ResolveParameterNameFromUri(string uriTemplate, ...
method GetParameterNameTemplate (line 565) | private static string GetParameterNameTemplate(string parameterName)
method GetInType (line 570) | private InType GetInType(string uriTemplate, string parameterName)
method GetConsumes (line 585) | private IEnumerable<string> GetConsumes(MethodInfo implementation, Met...
method GetProduces (line 617) | private IEnumerable<string> GetProduces(MethodInfo implementation, Met...
method ConvertWebMessageFormatToContentType (line 648) | private string ConvertWebMessageFormatToContentType(WebMessageFormat f...
method GetResponseCodes (line 660) | private List<Response> GetResponseCodes(MethodInfo implementation, Met...
method ConvertResponse (line 696) | private Response ConvertResponse(SwaggerWcfResponseAttribute ra, Schem...
method GetExample (line 727) | private Example GetExample(SwaggerWcfResponseAttribute ra)
method BuildSchemaForEnum (line 739) | private Schema BuildSchemaForEnum(Type returnType, IList<Type> definit...
method BuildSchema (line 755) | private Schema BuildSchema(Type type, MethodInfo implementation, Metho...
method GetDefaultValue (line 822) | private static object GetDefaultValue(Type type)
method GetTaskInnerType (line 834) | private static Type GetTaskInnerType(Type type)
method GetMethodSecurity (line 842) | private static List<KeyValuePair<string, string[]>> GetMethodSecurity(...
method GetEnumerableType (line 863) | public static Type GetEnumerableType(Type type)
FILE: src/SwaggerWcf/Support/MethodInfoExtensions.cs
class MethodInfoExtensions (line 8) | public static class MethodInfoExtensions
method GetWrappedName (line 10) | public static string GetWrappedName(this MethodInfo implementation, Me...
FILE: src/SwaggerWcf/Support/Serializer.cs
class Serializer (line 9) | internal class Serializer
method Process (line 11) | internal static string Process(Service service)
FILE: src/SwaggerWcf/Support/ServiceBuilder.cs
class ServiceBuilder (line 14) | internal class ServiceBuilder
method Build (line 16) | public static Service Build(string path)
method Build (line 21) | public static Service Build<TBusiness>(string path)
method BuildServiceCommon (line 26) | private static Service BuildServiceCommon(string path, Action<Service,...
method GetHiddenTags (line 48) | private static List<string> GetHiddenTags(SwaggerWcfSection config)
method GetVisibleTags (line 56) | private static List<string> GetVisibleTags(SwaggerWcfSection config)
method GetSettings (line 64) | private static IReadOnlyDictionary<string, string> GetSettings(Swagger...
method ProcessSettings (line 70) | private static void ProcessSettings(Service service, IReadOnlyDictiona...
method BuildPaths (line 107) | private static void BuildPaths(Service service, IList<string> hiddenTa...
method GetAssemblyTypes (line 147) | private static IEnumerable<TypeInfo> GetAssemblyTypes(IList<string> hi...
method BuildPaths (line 175) | private static void BuildPaths<TBusiness>(Service service, IList<strin...
FILE: src/SwaggerWcf/Support/StaticContent.cs
class StaticContent (line 8) | public class StaticContent
method StaticContent (line 16) | static StaticContent()
method SetArchiveCustom (line 31) | internal static void SetArchiveCustom(Stream zipCustomStream)
method GetFile (line 43) | public static Stream GetFile(string filename, out string contentType, ...
method ReturnError (line 77) | private static Stream ReturnError(out string contentType, out long con...
method GetContentType (line 84) | private static string GetContentType(string filename)
FILE: src/SwaggerWcf/Support/TypeBuilder.cs
class TypeBuilder (line 10) | public class TypeBuilder
method TypeBuilder (line 12) | public TypeBuilder(string typeName)
method AddField (line 29) | public void AddField(string fieldName, Type fieldType, bool required)
method CompileResultType (line 38) | public Type CompileResultType()
method GetTypeBuilder (line 53) | private System.Reflection.Emit.TypeBuilder GetTypeBuilder()
method CreateProperty (line 70) | private static void CreateProperty(System.Reflection.Emit.TypeBuilder ...
FILE: src/SwaggerWcf/Support/TypeExtensions.cs
class TypeExtensions (line 9) | internal static class TypeExtensions
method GetEnumerableType (line 11) | public static Type GetEnumerableType(this Type type)
method GetModelName (line 22) | public static string GetModelName(this Type type) =>
method GetModelWrappedName (line 25) | public static string GetModelWrappedName(this Type type) =>
method GetServiceInfo (line 28) | internal static Info GetServiceInfo(this TypeInfo typeInfo)
FILE: src/SwaggerWcf/Support/TypeFieldsProcessor.cs
class TypeFieldsProcessor (line 13) | internal static class TypeFieldsProcessor
method ProcessFields (line 16) | public static void ProcessFields(Type definitionType, DefinitionSchema...
method ProcessField (line 63) | private static DefinitionProperty ProcessField(FieldInfo propertyInfo,...
FILE: src/SwaggerWcf/Support/TypePropertiesProcessor.cs
class TypePropertiesProcessor (line 13) | internal static class TypePropertiesProcessor
method ProcessProperties (line 16) | public static void ProcessProperties(Type definitionType, DefinitionSc...
method ProcessProperty (line 63) | private static DefinitionProperty ProcessProperty(PropertyInfo propert...
FILE: src/SwaggerWcf/SwaggerWcfEndpoint.cs
class SwaggerWcfEndpoint (line 18) | [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityR...
method SwaggerWcfEndpoint (line 21) | public SwaggerWcfEndpoint()
method SwaggerWcfEndpoint (line 26) | internal SwaggerWcfEndpoint(Func<string, Service> buildService)
method Configure (line 47) | public static void Configure(Info info, SecurityDefinitions securityDe...
method Init (line 54) | [MethodImpl(MethodImplOptions.Synchronized)]
method GetAllPaths (line 75) | private static string[] GetAllPaths()
method GetSwaggerFileContents (line 81) | private static string GetSwaggerFileContents()
method SetCustomZip (line 89) | public static void SetCustomZip(Stream customSwaggerUiZipStream)
method SetCustomGetFile (line 95) | public static void SetCustomGetFile(GetFileCustomDelegate getFileCustom)
method GetSwaggerFile (line 100) | public Stream GetSwaggerFile()
method StaticContent (line 113) | public Stream StaticContent(string content)
FILE: src/SwaggerWcf/SwaggerWcfEndpointGeneric.cs
class SwaggerWcfEndpoint (line 6) | [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityR...
method SwaggerWcfEndpoint (line 9) | public SwaggerWcfEndpoint() : base(ServiceBuilder.Build<TBusiness>)
Condensed preview — 102 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (432K chars).
[
{
"path": ".gitignore",
"chars": 2082,
"preview": "## Ignore Visual Studio temporary files, build results, and\n## files generated by popular Visual Studio add-ons.\n\n# User"
},
{
"path": ".gitmodules",
"chars": 129,
"preview": "[submodule \"src/SampleService/swagger-ui\"]\n\tpath = src/SampleService/swagger-ui\n\turl = https://github.com/wordnik/swagge"
},
{
"path": "LICENSE",
"chars": 11358,
"preview": " Apache License\n Version 2.0, January 2004\n "
},
{
"path": "README.md",
"chars": 10830,
"preview": "<h1 align=\"left\">\nSwaggerWcf <a href=\"https://www.nuget.org/packages/SwaggerWcf\">\n <img src=\"http://img.shie"
},
{
"path": "notes/samples/petstore-expanded.json",
"chars": 5358,
"preview": "{\n \"swagger\": \"2.0\",\n \"info\": {\n \"version\": \"1.0.0\",\n \"title\": \"Swagger Petstore\",\n \"description\": \"A sample "
},
{
"path": "notes/samples/petstore-minimal.json",
"chars": 1347,
"preview": "{\n \"swagger\": \"2.0\",\n \"info\": {\n \"version\": \"1.0.0\",\n \"title\": \"Swagger Petstore\",\n \"description\": \"A sample "
},
{
"path": "notes/samples/petstore-simple.json",
"chars": 5218,
"preview": "{\n \"swagger\": \"2.0\",\n \"info\": {\n \"version\": \"1.0.0\",\n \"title\": \"Swagger Petstore\",\n \"description\": \"A sample "
},
{
"path": "notes/samples/petstore-with-external-docs.json",
"chars": 5713,
"preview": "{\n \"swagger\": \"2.0\",\n \"info\": {\n \"version\": \"1.0.0\",\n \"title\": \"Swagger Petstore\",\n \"description\": \"A sample "
},
{
"path": "notes/samples/petstore.json",
"chars": 1683,
"preview": "{\n \"swagger\": \"2.0\",\n \"info\": {\n \"version\": \"1.0.0\",\n \"title\": \"Swagger Petstore\",\n \"contact\": {\n \"name\""
},
{
"path": "notes/schema.json",
"chars": 37805,
"preview": "{\n \"title\": \"A JSON Schema for Swagger 2.0 API.\",\n \"id\": \"http://swagger.io/v2/schema.json#\",\n \"$schema\": \"http://jso"
},
{
"path": "notes/spec-2.0.md",
"chars": 76095,
"preview": "# Swagger RESTful API Documentation Specification\n\n#### Version 2.0\n\nThe key words \"MUST\", \"MUST NOT\", \"REQUIRED\", \"SHAL"
},
{
"path": "src/SwaggerWcf/Attributes/SwaggerWcfAttribute.cs",
"chars": 1180,
"preview": "using System;\n\nnamespace SwaggerWcf.Attributes\n{\n /// <summary>\n /// Attribute to enable a class or interface to "
},
{
"path": "src/SwaggerWcf/Attributes/SwaggerWcfContactInfoAttribute.cs",
"chars": 1130,
"preview": "using SwaggerWcf.Models;\nusing System;\n\nnamespace SwaggerWcf.Attributes\n{\n /// <summary>\n /// Provides values for"
},
{
"path": "src/SwaggerWcf/Attributes/SwaggerWcfContentTypesAttribute.cs",
"chars": 936,
"preview": "using System;\nusing System.Net;\n\nnamespace SwaggerWcf.Attributes\n{\n /// <summary>\n /// Overrides the return t"
},
{
"path": "src/SwaggerWcf/Attributes/SwaggerWcfDefinitionAttribute.cs",
"chars": 1348,
"preview": "using System;\n\nnamespace SwaggerWcf.Attributes\n{\n /// <summary>\n /// Attribute to describe a class as a defin"
},
{
"path": "src/SwaggerWcf/Attributes/SwaggerWcfHeaderAttribute.cs",
"chars": 1488,
"preview": "using System;\n\nnamespace SwaggerWcf.Attributes\n{\n /// <summary>\n /// Describe a parameter\n /// </summary>\n"
},
{
"path": "src/SwaggerWcf/Attributes/SwaggerWcfHiddenAttribute.cs",
"chars": 427,
"preview": "using System;\n\nnamespace SwaggerWcf.Attributes\n{\n /// <summary>\n /// Attribute to hide a method, class, param"
},
{
"path": "src/SwaggerWcf/Attributes/SwaggerWcfLicenseInfoAttribute.cs",
"chars": 1313,
"preview": "using SwaggerWcf.Models;\nusing System;\n\nnamespace SwaggerWcf.Attributes\n{\n /// <summary>\n /// Provides values for"
},
{
"path": "src/SwaggerWcf/Attributes/SwaggerWcfParameterAttribute.cs",
"chars": 1169,
"preview": "using System;\n\nnamespace SwaggerWcf.Attributes\n{\n /// <summary>\n /// Describe a parameter\n /// </summary>\n"
},
{
"path": "src/SwaggerWcf/Attributes/SwaggerWcfPathAttribute.cs",
"chars": 2411,
"preview": "using System;\n\nnamespace SwaggerWcf.Attributes\n{\n /// <summary>\n /// Attribute to describe a method exported "
},
{
"path": "src/SwaggerWcf/Attributes/SwaggerWcfPropertyAttribute.cs",
"chars": 6069,
"preview": "using System;\n\nusing SwaggerWcf.Models;\n\n\nnamespace SwaggerWcf.Attributes\n{\n /// <summary>\n /// Describe a pr"
},
{
"path": "src/SwaggerWcf/Attributes/SwaggerWcfRegexAttribute.cs",
"chars": 686,
"preview": "using System;\n\nnamespace SwaggerWcf.Attributes\n{\n /// <summary>\n /// Apply a Regular Expression\n /// </sum"
},
{
"path": "src/SwaggerWcf/Attributes/SwaggerWcfRequestTypeAttribute.cs",
"chars": 696,
"preview": "using System;\nusing System.Net;\n\nnamespace SwaggerWcf.Attributes\n{\n /// <summary>\n /// Overrides the return t"
},
{
"path": "src/SwaggerWcf/Attributes/SwaggerWcfResponseAttribute.cs",
"chars": 6683,
"preview": "using System;\nusing System.Net;\n\nnamespace SwaggerWcf.Attributes\n{\n /// <summary>\n /// Attribute to describe "
},
{
"path": "src/SwaggerWcf/Attributes/SwaggerWcfReturnTypeAttribute.cs",
"chars": 943,
"preview": "using System;\nusing System.Net;\n\nnamespace SwaggerWcf.Attributes\n{\n /// <summary>\n /// Overrides the return t"
},
{
"path": "src/SwaggerWcf/Attributes/SwaggerWcfSecurityAttribute.cs",
"chars": 1085,
"preview": "using System;\n\nnamespace SwaggerWcf.Attributes\n{\n /// <summary>\n /// Attribute to link operation to a security de"
},
{
"path": "src/SwaggerWcf/Attributes/SwaggerWcfServiceInfoAttribute.cs",
"chars": 2049,
"preview": "using SwaggerWcf.Models;\nusing System;\n\nnamespace SwaggerWcf.Attributes\n{\n /// <summary>\n /// Provides metadata a"
},
{
"path": "src/SwaggerWcf/Attributes/SwaggerWcfTagAttribute.cs",
"chars": 1124,
"preview": "using System;\n\nnamespace SwaggerWcf.Attributes\n{\n /// <summary>\n /// Attribute to inject a tag into a class, "
},
{
"path": "src/SwaggerWcf/Configuration/SettingCollection.cs",
"chars": 634,
"preview": "using System;\nusing System.Configuration;\n\nnamespace SwaggerWcf.Configuration\n{\n [ConfigurationCollection(typeof(Tag"
},
{
"path": "src/SwaggerWcf/Configuration/SettingElement.cs",
"chars": 711,
"preview": "using System.Configuration;\n\nnamespace SwaggerWcf.Configuration\n{\n public class SettingElement : ConfigurationElemen"
},
{
"path": "src/SwaggerWcf/Configuration/SwaggerWcfSection.cs",
"chars": 749,
"preview": "using System.Configuration;\n\nnamespace SwaggerWcf.Configuration\n{\n public class SwaggerWcfSection : ConfigurationSec"
},
{
"path": "src/SwaggerWcf/Configuration/TagCollection.cs",
"chars": 622,
"preview": "using System;\nusing System.Configuration;\n\nnamespace SwaggerWcf.Configuration\n{\n [ConfigurationCollection(typeof(Tag"
},
{
"path": "src/SwaggerWcf/Configuration/TagElement.cs",
"chars": 733,
"preview": "using System.Configuration;\n\nnamespace SwaggerWcf.Configuration\n{\n public class TagElement : ConfigurationElement\n "
},
{
"path": "src/SwaggerWcf/ISwaggerWcfEndpoint.cs",
"chars": 658,
"preview": "using System.IO;\nusing System.ServiceModel;\nusing System.ServiceModel.Web;\n\nnamespace SwaggerWcf\n{\n [ServiceContract"
},
{
"path": "src/SwaggerWcf/Models/CollectionFormat.cs",
"chars": 165,
"preview": "namespace SwaggerWcf.Models\n{\n public enum CollectionFormat\n {\n Csv = 0,\n Ssv = 1,\n Tsv = 2,"
},
{
"path": "src/SwaggerWcf/Models/Definition.cs",
"chars": 457,
"preview": "using Newtonsoft.Json;\n\nnamespace SwaggerWcf.Models\n{\n internal class Definition\n {\n public DefinitionSche"
},
{
"path": "src/SwaggerWcf/Models/DefinitionProperty.cs",
"chars": 5773,
"preview": "using System.Collections.Generic;\nusing System.Linq;\nusing Newtonsoft.Json;\n\nnamespace SwaggerWcf.Models\n{\n internal"
},
{
"path": "src/SwaggerWcf/Models/DefinitionSchema.cs",
"chars": 4316,
"preview": "using System.Collections.Generic;\nusing System.Linq;\nusing Newtonsoft.Json;\n\nnamespace SwaggerWcf.Models\n{\n internal"
},
{
"path": "src/SwaggerWcf/Models/Example.cs",
"chars": 162,
"preview": "namespace SwaggerWcf.Models\n{\n internal class Example\n {\n public string MimeType { get; set; }\n\n pu"
},
{
"path": "src/SwaggerWcf/Models/ExternalDocumentation.cs",
"chars": 737,
"preview": "using System.Collections.Generic;\nusing Newtonsoft.Json;\n\nnamespace SwaggerWcf.Models\n{\n internal class ExternalDocu"
},
{
"path": "src/SwaggerWcf/Models/InType.cs",
"chars": 186,
"preview": "namespace SwaggerWcf.Models\n{\n internal enum InType\n {\n Unknown = 0,\n Body = 1,\n Path = 2,\n "
},
{
"path": "src/SwaggerWcf/Models/Info.cs",
"chars": 1618,
"preview": "using System.Collections.Generic;\nusing Newtonsoft.Json;\n\nnamespace SwaggerWcf.Models\n{\n public class Info\n {\n "
},
{
"path": "src/SwaggerWcf/Models/InfoContact.cs",
"chars": 1196,
"preview": "using System.Collections.Generic;\nusing Newtonsoft.Json;\nusing System;\n\nnamespace SwaggerWcf.Models\n{\n public class "
},
{
"path": "src/SwaggerWcf/Models/InfoLicense.cs",
"chars": 981,
"preview": "using System.Collections.Generic;\nusing Newtonsoft.Json;\nusing System;\n\nnamespace SwaggerWcf.Models\n{\n public class "
},
{
"path": "src/SwaggerWcf/Models/ParameterBase.cs",
"chars": 566,
"preview": "using System.Collections.Generic;\nusing Newtonsoft.Json;\n\nnamespace SwaggerWcf.Models\n{\n internal abstract class Par"
},
{
"path": "src/SwaggerWcf/Models/ParameterItems.cs",
"chars": 1105,
"preview": "using System.Collections.Generic;\nusing Newtonsoft.Json;\n\nnamespace SwaggerWcf.Models\n{\n internal class ParameterIte"
},
{
"path": "src/SwaggerWcf/Models/ParameterPrimitive.cs",
"chars": 6935,
"preview": "using System.Collections.Generic;\nusing System.Linq;\nusing Newtonsoft.Json;\n\nnamespace SwaggerWcf.Models\n{\n internal"
},
{
"path": "src/SwaggerWcf/Models/ParameterSchema.cs",
"chars": 1619,
"preview": "using System.Collections.Generic;\nusing Newtonsoft.Json;\n\nnamespace SwaggerWcf.Models\n{\n internal class ParameterSch"
},
{
"path": "src/SwaggerWcf/Models/ParameterType.cs",
"chars": 251,
"preview": "namespace SwaggerWcf.Models\n{\n public enum ParameterType\n {\n Unknown = 0,\n Void = 1,\n String"
},
{
"path": "src/SwaggerWcf/Models/Path.cs",
"chars": 657,
"preview": "using System.Collections.Generic;\nusing System.Linq;\nusing Newtonsoft.Json;\n\nnamespace SwaggerWcf.Models\n{\n internal"
},
{
"path": "src/SwaggerWcf/Models/PathAction.cs",
"chars": 5180,
"preview": "using System.Collections.Generic;\nusing System.Linq;\nusing Newtonsoft.Json;\n\nnamespace SwaggerWcf.Models\n{\n internal"
},
{
"path": "src/SwaggerWcf/Models/Property.cs",
"chars": 5181,
"preview": "using System.Collections.Generic;\nusing System.Linq;\nusing Newtonsoft.Json;\n\nnamespace SwaggerWcf.Models\n{\n internal"
},
{
"path": "src/SwaggerWcf/Models/Response.cs",
"chars": 2036,
"preview": "using System.Collections.Generic;\nusing System.Linq;\nusing Newtonsoft.Json;\n\nnamespace SwaggerWcf.Models\n{\n internal"
},
{
"path": "src/SwaggerWcf/Models/Schema.cs",
"chars": 4536,
"preview": "using System.Collections.Generic;\nusing System.Linq;\nusing Newtonsoft.Json;\n\nnamespace SwaggerWcf.Models\n{\n internal"
},
{
"path": "src/SwaggerWcf/Models/SecurityAuthorization.cs",
"chars": 3953,
"preview": "using System.Collections.Generic;\nusing Newtonsoft.Json;\n\nnamespace SwaggerWcf.Models\n{\n public class SecurityAuthor"
},
{
"path": "src/SwaggerWcf/Models/SecurityDefinitions.cs",
"chars": 193,
"preview": "using System.Collections.Generic;\n\nnamespace SwaggerWcf.Models\n{\n public class SecurityDefinitions : Dictionary<stri"
},
{
"path": "src/SwaggerWcf/Models/Service.cs",
"chars": 3219,
"preview": "using System.Collections.Generic;\nusing System.Linq;\nusing Newtonsoft.Json;\n\nnamespace SwaggerWcf.Models\n{\n internal"
},
{
"path": "src/SwaggerWcf/Models/TypeFormat.cs",
"chars": 756,
"preview": "namespace SwaggerWcf.Models\n{\n public struct TypeFormat\n {\n public ParameterType Type;\n\n public str"
},
{
"path": "src/SwaggerWcf/Properties/AssemblyInfo.cs",
"chars": 1540,
"preview": "using System.Reflection;\nusing System.Runtime.CompilerServices;\nusing System.Runtime.InteropServices;\n\n// General Infor"
},
{
"path": "src/SwaggerWcf/Support/DefinitionsBuilder.cs",
"chars": 10192,
"preview": "using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Linq;\nusing System.Reflection"
},
{
"path": "src/SwaggerWcf/Support/EnumerableExtensions.cs",
"chars": 367,
"preview": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nna"
},
{
"path": "src/SwaggerWcf/Support/Helpers.cs",
"chars": 6954,
"preview": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Reflection;\nusing Syst"
},
{
"path": "src/SwaggerWcf/Support/ListExtensions.cs",
"chars": 1721,
"preview": "using System;\nusing System.Collections.Generic;\n\nnamespace SwaggerWcf.Support\n{\n public static class ListExtensions\n"
},
{
"path": "src/SwaggerWcf/Support/Mapper.cs",
"chars": 37501,
"preview": "using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Linq;\nusing System.Reflection"
},
{
"path": "src/SwaggerWcf/Support/MethodInfoExtensions.cs",
"chars": 711,
"preview": "using System;\nusing System.Linq;\nusing System.Reflection;\nusing SwaggerWcf.Attributes;\n\nnamespace SwaggerWcf.Support\n{\n"
},
{
"path": "src/SwaggerWcf/Support/Serializer.cs",
"chars": 524,
"preview": "using System.Collections.Generic;\nusing System.IO;\nusing System.Text;\nusing Newtonsoft.Json;\nusing SwaggerWcf.Models;\n\n"
},
{
"path": "src/SwaggerWcf/Support/ServiceBuilder.cs",
"chars": 8182,
"preview": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Configuration;\r\nusing System.Linq;\r\nusing System.Reflect"
},
{
"path": "src/SwaggerWcf/Support/StaticContent.cs",
"chars": 3754,
"preview": "using System.IO;\nusing System.IO.Compression;\nusing System.Linq;\nusing System.Reflection;\n\nnamespace SwaggerWcf.Support"
},
{
"path": "src/SwaggerWcf/Support/TypeBuilder.cs",
"chars": 5164,
"preview": "using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Reflection;\nusing System.Refl"
},
{
"path": "src/SwaggerWcf/Support/TypeExtensions.cs",
"chars": 1678,
"preview": "using SwaggerWcf.Attributes;\nusing SwaggerWcf.Models;\nusing System;\nusing System.Linq;\nusing System.Reflection;\n\nnamesp"
},
{
"path": "src/SwaggerWcf/Support/TypeFieldsProcessor.cs",
"chars": 6907,
"preview": "using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.ComponentModel.DataAnnotation"
},
{
"path": "src/SwaggerWcf/Support/TypePropertiesProcessor.cs",
"chars": 6981,
"preview": "using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.ComponentModel.DataAnnotation"
},
{
"path": "src/SwaggerWcf/SwaggerWcf.csproj",
"chars": 7063,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<Project ToolsVersion=\"4.0\" DefaultTargets=\"Build\" xmlns=\"http://schemas.micros"
},
{
"path": "src/SwaggerWcf/SwaggerWcf.csproj.DotSettings",
"chars": 414,
"preview": "<wpf:ResourceDictionary xml:space=\"preserve\" xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\" xmlns:s=\"clr-namesp"
},
{
"path": "src/SwaggerWcf/SwaggerWcf.nuspec",
"chars": 606,
"preview": "<?xml version=\"1.0\"?>\n<package>\n <metadata>\n <id>$title$</id>\n <version>$version$</version>\n <title>$title$</"
},
{
"path": "src/SwaggerWcf/SwaggerWcfEndpoint.cs",
"chars": 5540,
"preview": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Net;\nusing System.Serv"
},
{
"path": "src/SwaggerWcf/SwaggerWcfEndpointGeneric.cs",
"chars": 380,
"preview": "using System.ServiceModel.Activation;\r\nusing SwaggerWcf.Support;\r\n\r\nnamespace SwaggerWcf\r\n{\r\n [AspNetCompatibilityRe"
},
{
"path": "src/SwaggerWcf/packages.config",
"chars": 137,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<packages>\n <package id=\"Newtonsoft.Json\" version=\"8.0.3\" targetFramework=\"net4"
},
{
"path": "src/SwaggerWcf.Test.Service/AuthorService.cs",
"chars": 1435,
"preview": "using SwaggerWcf.Attributes;\nusing SwaggerWcf.Test.Service.Data;\nusing System;\nusing System.Collections.Generic;\nusing "
},
{
"path": "src/SwaggerWcf.Test.Service/BaseService.cs",
"chars": 719,
"preview": "using SwaggerWcf.Test.Service.Data;\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Web"
},
{
"path": "src/SwaggerWcf.Test.Service/Data/Author.cs",
"chars": 325,
"preview": "using System.Runtime.Serialization;\nusing SwaggerWcf.Attributes;\n\nnamespace SwaggerWcf.Test.Service.Data\n{\n [DataCon"
},
{
"path": "src/SwaggerWcf.Test.Service/Data/Book.cs",
"chars": 1064,
"preview": "using System.ComponentModel;\nusing System.Runtime.Serialization;\nusing SwaggerWcf.Attributes;\n\nnamespace SwaggerWcf.Tes"
},
{
"path": "src/SwaggerWcf.Test.Service/Data/Language.cs",
"chars": 333,
"preview": "using System.ComponentModel;\nusing System.Runtime.Serialization;\n\nnamespace SwaggerWcf.Test.Service.Data\n{\n [DataCon"
},
{
"path": "src/SwaggerWcf.Test.Service/Data/Store.cs",
"chars": 5301,
"preview": "using System;\nusing System.Collections.Generic;\n\nnamespace SwaggerWcf.Test.Service.Data\n{\n public class Store\n {\n"
},
{
"path": "src/SwaggerWcf.Test.Service/Global.asax",
"chars": 104,
"preview": "<%@ Application Codebehind=\"Global.asax.cs\" Inherits=\"SwaggerWcf.Test.Service.Global\" Language=\"C#\" %>\n"
},
{
"path": "src/SwaggerWcf.Test.Service/Global.asax.cs",
"chars": 1840,
"preview": "using System;\nusing System.Collections.Generic;\nusing System.ServiceModel.Activation;\nusing System.Web;\nusing System.We"
},
{
"path": "src/SwaggerWcf.Test.Service/IAuthorService.cs",
"chars": 298,
"preview": "using SwaggerWcf.Test.Service.Data;\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Ser"
},
{
"path": "src/SwaggerWcf.Test.Service/IBaseCRUDService.cs",
"chars": 1420,
"preview": "using SwaggerWcf.Attributes;\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.ServiceMod"
},
{
"path": "src/SwaggerWcf.Test.Service/IBaseService.cs",
"chars": 945,
"preview": "using SwaggerWcf.Attributes;\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.ServiceMod"
},
{
"path": "src/SwaggerWcf.Test.Service/IStore.cs",
"chars": 6470,
"preview": "using System;\nusing System.Collections.Generic;\nusing System.Net;\nusing System.ServiceModel;\nusing System.ServiceModel."
},
{
"path": "src/SwaggerWcf.Test.Service/Properties/AssemblyInfo.cs",
"chars": 1419,
"preview": "using System.Reflection;\nusing System.Runtime.CompilerServices;\nusing System.Runtime.InteropServices;\n\n// General Infor"
},
{
"path": "src/SwaggerWcf.Test.Service/Store.svc",
"chars": 116,
"preview": "<%@ ServiceHost Language=\"C#\" Debug=\"true\" Service=\"SwaggerWcf.Test.Service.BookStore\" CodeBehind=\"Store.svc.cs\" %>"
},
{
"path": "src/SwaggerWcf.Test.Service/Store.svc.cs",
"chars": 17025,
"preview": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Net;\nusing System.ServiceModel.Web;\nusi"
},
{
"path": "src/SwaggerWcf.Test.Service/SwaggerWcf.Test.Service.csproj",
"chars": 6003,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"14.0\" DefaultTargets=\"Build\" xmlns=\"http://schemas.micros"
},
{
"path": "src/SwaggerWcf.Test.Service/SwaggerWcf.Test.Service.csproj.DotSettings",
"chars": 414,
"preview": "<wpf:ResourceDictionary xml:space=\"preserve\" xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\" xmlns:s=\"clr-namesp"
},
{
"path": "src/SwaggerWcf.Test.Service/Web.Debug.config",
"chars": 1270,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n<!-- For more information on using web.config transformation visit http://go.mic"
},
{
"path": "src/SwaggerWcf.Test.Service/Web.Release.config",
"chars": 1330,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n<!-- For more information on using web.config transformation visit http://go.mic"
},
{
"path": "src/SwaggerWcf.Test.Service/Web.config",
"chars": 2848,
"preview": "<?xml version=\"1.0\"?>\n<configuration>\n <!--\n <configSections>\n <section name=\"swaggerwcf\" type=\"SwaggerWcf.Configu"
},
{
"path": "src/SwaggerWcf.sln",
"chars": 1769,
"preview": "\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 14\nVisualStudioVersion = 14.0.24720.0\nMini"
},
{
"path": "src/SwaggerWcf.sln.DotSettings",
"chars": 523,
"preview": "<wpf:ResourceDictionary xml:space=\"preserve\" xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\" xmlns:s=\"clr-namesp"
},
{
"path": "src/packages/.gitignore",
"chars": 34,
"preview": "*\n!repositories.config\n!.gitignore"
},
{
"path": "src/packages/repositories.config",
"chars": 124,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<repositories>\n <repository path=\"..\\SwaggerWcf\\packages.config\" />\n</repositor"
}
]
About this extraction
This page contains the full source code of the abelsilva/swaggerwcf GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 102 files (394.2 KB), approximately 88.1k tokens, and a symbol index with 284 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.