From 03c216ddb02cb672ceabdcbb56839237c7afcc0c Mon Sep 17 00:00:00 2001 From: Abel Silva Date: Thu, 6 Jul 2017 23:06:49 -0300 Subject: [PATCH] added documentation for query parameters #78 --- README.md | 37 ++++++++++++++++++++------------ src/SwaggerWcf/SwaggerWcf.nuspec | 2 +- 2 files changed, 24 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 55d2c39..214b1c8 100644 --- a/README.md +++ b/README.md @@ -214,20 +214,20 @@ Note: make sure you add at least the `DataContract` and `DataMember` attributes ## 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` | -| `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` | +| 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 @@ -243,6 +243,15 @@ 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. diff --git a/src/SwaggerWcf/SwaggerWcf.nuspec b/src/SwaggerWcf/SwaggerWcf.nuspec index 1421c68..69d2de4 100644 --- a/src/SwaggerWcf/SwaggerWcf.nuspec +++ b/src/SwaggerWcf/SwaggerWcf.nuspec @@ -10,7 +10,7 @@ https://github.com/abelsilva/swaggerwcf false $description$ - added support for overriding parameter types #78 + added support for overriding parameter types #80 Copyright 2015 swagger wcf .net c#