Comments (5)
It may, but it's untested. It would work similarly to defining OData functions.
from swashbuckle.odata.
Yeah, I tested it. It works out of the box and no need for special implementation.
from swashbuckle.odata.
Cool! Thanks for validating.
from swashbuckle.odata.
I have the following scenario:
- Add an Entity Set ("Supplier") object to which add an action ("Create") with various input parameters.
- In the controller ("SuppliersController") I add the CreateSupplier action has ODataActionParameters object as a parameter.
- In Swagger config I use the ODataSwaggerProvider.
I have a exception when try parse the action parameters.
How I can solve this problem?
OData config
...
var builder = new ODataConventionModelBuilder();
builder.EntitySet<Supplier>("Suppliers");
var entityType = builder.EntityType<Supplier>();
var action = entityType.Collection.Action("Create");
action.ReturnsFromEntitySet<Supplier>("Suppliers")
action.Parameter<string>("code");
action.Parameter<string>("name");
action.Parameter<string>("description").OptionalParameter = true;
var model = builder.GetEdmModel();
config.MapODataServiceRoute("odata", "odata", edmModel);
...
Action on Controller
public class SuppliersController : ODataController
{
[HttpPost]
[ODataRoute("Suppliers/Create")]
[ResponseType(typeof(Supplier))]
public IHttpActionResult CreateSupplier(ODataActionParameters parameters)
{
// code
}
}
Swagger Config
public class SwaggerConfig
{
public static void Register(HttpConfiguration config)
{
config.EnableSwagger("docs/{apiVersion}/swagger", c =>
{
c.SingleApiVersion("v1", "My OData Web API");
var baseDirectory = AppDomain.CurrentDomain.BaseDirectory;
var commentsFileName = Assembly.GetExecutingAssembly().GetName().Name + ".XML";
var commentsFile = Path.Combine(baseDirectory, commentsFileName);
c.IncludeXmlComments(commentsFile);
c.CustomProvider(defaultProvider => new ODataSwaggerProvider(defaultProvider, c, config));
})
.EnableSwaggerUi();
}
}
from swashbuckle.odata.
I'll research this. Thanks.
from swashbuckle.odata.
Related Issues (20)
- EnableQueryFilter.ReturnsCollection() throws NullReferenceException for return type void
- SchemaRegistryExtensions.GetPropertyNameForEdmModel returns wrong Edm Property name HOT 2
- Calling for Maintainers HOT 6
- Swagger generation resulting in error. Error thrown from SwaggerRouteStrategy.cs line 62
- AdjustRelativePathForStringParams is not working case-insensitive (param names)
- Method not found: 'Flurl.Url Flurl.Url.AppendPathSegment(System.Object)' HOT 1
- Precondition Failure
- Swagger docs don't have type information for Get method when it returns IHttpActionResult HOT 2
- Add custom property resolver to 4.0.0
- Unbound actions generate invalid swagger HOT 2
- Entity bound actions can have ODataActionParameters type parameters only
- Custom type parameters for OData functions HOT 1
- Exploring different version at the same time throw an error.
- Support for Microsoft.AspNet.OData 7? HOT 10
- Swashbuckle.OData.Core throws Specified argument was out of the range of valid values exception and failing to generate swagger ui HOT 1
- Need Help OData V4 REST Web API Documentation HOT 4
- Swashbuckle.OData.Core is too slow, consume 60% memory while open swagger in chrome browser HOT 4
- OData Web API Controller Summary not showing in swagger
- Swashbuckle.OData compatibility with OData V3 Controllers HOT 1
- Swagger generation fails for Entities having DataContractAttribute fails with "Sequence contains no matching element" when used in OData Actions. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from swashbuckle.odata.