Skip to content

Commit

Permalink
Fixed merge issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Remco Lam committed Apr 24, 2024
1 parent 9f37e68 commit e4fc9c9
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 29 deletions.
23 changes: 12 additions & 11 deletions src/Swashbuckle.AspNetCore.Swagger/SwaggerMiddleware.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,30 +28,31 @@ public class SwaggerMiddleware
public SwaggerMiddleware(
RequestDelegate next,
SwaggerOptions options,
#if !NETSTANDARD
TemplateBinderFactory templateBinderFactory,
#endif
IServiceProvider serviceProvider)
{
_next = next;
_options = options ?? new SwaggerOptions();
_requestMatcher = new TemplateMatcher(TemplateParser.Parse(_options.RouteTemplate), new RouteValueDictionary());
_swaggerDocumentSerializer = serviceProvider?.GetService<ISwaggerDocumentSerializer>();
#if !NETSTANDARD
_templateBinder = templateBinderFactory.Create(RoutePatternFactory.Parse(_options.RouteTemplate));
#endif
}

// TODO: Remove in next major release, kept for binary compatibility
public SwaggerMiddleware(
RequestDelegate next,
SwaggerOptions options) : this(next, options, null)
{
}

#if !NETSTANDARD
public SwaggerMiddleware(
RequestDelegate next,
SwaggerOptions options,
TemplateBinderFactory templateBinderFactory) : this(next, options)
SwaggerOptions options)
#if NETSTANDARD
: this(next, options, null)
#else
: this(next, options, null, null)
#endif
{
_templateBinder = templateBinderFactory.Create(RoutePatternFactory.Parse(_options.RouteTemplate));
}
#endif

public async Task Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider)
{
Expand Down
40 changes: 22 additions & 18 deletions test/WebSites/NswagClientExample/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,34 +102,38 @@
"type": "string"
},
"Cat": {
"type": "object",
"allOf": [
{
"$ref": "#/components/schemas/Animal"
},
{
"type": "object",
"properties": {
"catSpecificProperty": {
"type": "string",
"nullable": true
}
},
"additionalProperties": false
}
],
"properties": {
"catSpecificProperty": {
"type": "string",
"nullable": true
}
},
"additionalProperties": false
]
},
"Dog": {
"type": "object",
"allOf": [
{
"$ref": "#/components/schemas/Animal"
},
{
"type": "object",
"properties": {
"dogSpecificProperty": {
"type": "string",
"nullable": true
}
},
"additionalProperties": false
}
],
"properties": {
"dogSpecificProperty": {
"type": "string",
"nullable": true
}
},
"additionalProperties": false
]
}
}
}
Expand Down

0 comments on commit e4fc9c9

Please sign in to comment.