Comments (3)
Since this is primarily for tooling to use as 'friendly name' it's not necessary that summary value be unique.
If you're not inclined to make this change, perhaps then please consider at least dropping 'entity in entityset' from the summary value. Or, omit summary and use description instead as tools will fall back to operationId if summary doesn't exist.
edit: Nevermind the below OperationFilter works well for my needs.
Thanks again for all your hard work!
from swashbuckle.odata.
Was able to make this change using OperationFilter like so:
internal class ChangeSummaryInOperationFilter : IOperationFilter
{
public void Apply(Operation operation, SchemaRegistry schemaRegistry, ApiDescription apiDescription)
{
//RENAME
//reverse from 'Orders_Get' to 'Get Orders'
string str = $"{string.Join(" ", operation.operationId.Split('_').Reverse())}";
//build dict of rename replacements to be made
string s = "Put=Replace;Post=Create;Patch=Update";
var dictRename = s.Split(';').Select(x => x.Split('=')).ToDictionary(x => x[0], x => x[1]);
//make rename replacements
string newstr = dictRename.Aggregate(str, (current, value) => current.Replace(value.Key, value.Value));
//SINGULARIZE
//if has parameters other than query
if (operation.parameters != null &! operation.parameters.All(p => p.@in == "query"))//.Any(p => p.@in == "path" || p.@in == "body"))
{ //should prolly reuse pServ rather than new it up repeatedly(?)
var pServ = new System.Data.Entity.Infrastructure.Pluralization.EnglishPluralizationService();
newstr = $"{newstr.Split(' ')[0]} {pServ.Singularize(newstr.Split(' ')[1])}";
}
//set description and summary
operation.description = operation.summary;
operation.summary = newstr;
}
}
Looks like this in swagger ui:
And works great with Azure Logic App tooling:
from swashbuckle.odata.
Woops, missed the edit. Looks like the OperationFilter meets your needs. Closing. Thanks.
from swashbuckle.odata.
Related Issues (20)
- 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
- Accurate OData response schema
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.