Skip to content

Commit

Permalink
Merge pull request #127 from scott-xu/master
Browse files Browse the repository at this point in the history
unit test for #126
  • Loading branch information
heldersepu authored Jun 27, 2023
2 parents 378d1a7 + 50bca76 commit ede4c76
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
1 change: 1 addition & 0 deletions Tests/Swagger.Net.Dummy.Core/Swagger.Net.Dummy.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@
<Compile Include="Controllers\DictionaryTypesController.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SwaggerExtensions\AddDefaultResponse.cs" />
<Compile Include="SwaggerExtensions\AddDescription.cs" />
<Compile Include="SwaggerExtensions\AddFileUploadParams.cs" />
<Compile Include="SwaggerExtensions\AddMessageDefault.cs" />
<Compile Include="SwaggerExtensions\AppendVersionToBasePath.cs" />
Expand Down
10 changes: 10 additions & 0 deletions Tests/Swagger.Net.Dummy.Core/SwaggerExtensions/AddDescription.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
namespace Swagger.Net.Dummy.SwaggerExtensions
{
public class AddDescription : ISchemaFilter
{
public void Apply(Schema schema, SchemaRegistry schemaRegistry, System.Type type)
{
schema.description = "Some description";
}
}
}
12 changes: 12 additions & 0 deletions Tests/Swagger.Net.Tests/Swagger/AnnotationsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,18 @@ public void It_exposes_config_to_post_modify_responses()
Assert.AreEqual("bar", xProp.ToString());
}

[Test]
public void It_exposes_config_to_modify_schema_description()
{
SetUpHandler(c => c.SchemaFilter<AddDescription>());

var swagger = GetContent<JObject>(TEMP_URI.DOCS);

var messageExamples = swagger["definitions"]["Message"]["properties"]["Content"]["description"];

Assert.AreEqual("Some description", messageExamples.ToString());
}

[Test]
public void It_documents_responses_from_swagger_response_attributes_post()
{
Expand Down

0 comments on commit ede4c76

Please sign in to comment.