Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Richard Beauchamp committed Jan 14, 2016
1 parent e785f1f commit f2a5e2e
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ c.CustomProvider(defaultProvider => new ODataSwaggerProvider(defaultProvider, c)

### Custom Swagger Routes ###

The following snippet demonstrates how to configure a custom OData route such that it will appear in the Swagger UI:
The following snippet demonstrates how to configure a custom swagger route such that it will appear in the Swagger UI:
```csharp
// Let's say you map a custom OData route that doesn't follow the typical conventions
var customODataRoute = config.MapODataServiceRoute("CustomODataRoute", ODataRoutePrefix, GetModel(), batchHandler: null, pathHandler: new DefaultODataPathHandler(), routingConventions: myCustomConventions);
Expand All @@ -47,6 +47,19 @@ public async Task<IHttpActionResult> Post([FromODataUri] int customerId, Order o
}
```

#### RESTier ####

By default, Swashbuckle.OData only displays routes for top-level entity types. You can describe and display additional routes, for related types, in the Swagger UI by configuring custom swagger routes. For example from the Northwind model, to display a route that queries an Order for a Customer, configure the following:

```csharp
var restierRoute = await config.MapRestierRoute<DbApi<NorthwindContext>>("RESTierRoute", "restier", new RestierBatchHandler(server));

config.AddCustomSwaggerRoute(restierRoute, "/Customers({CustomerId})/Orders({OrderId})")
.Operation(HttpMethod.Get)
.PathParameter<string>("CustomerId")
.PathParameter<int>("OrderId");
```

### OWIN ###

If your service is hosted using OWIN middleware, configure the custom provider as follows:
Expand Down

0 comments on commit f2a5e2e

Please sign in to comment.