Skip to content

Commit

Permalink
Merge branch 'release/v1.9.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Morasiu committed Dec 17, 2023
2 parents e892496 + fcc6105 commit c1e727d
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 9 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.8.8] - 2023-01-25
## [1.9.0] - 2023-12-17
### Added
- Support for DescribeAllParametersInCamelCase. Thanks @machekku!

## [1.8.0] - 2023-01-25
### Added
- Support for reading JSON from file. Thanks @stiio!

Expand Down
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,5 +80,3 @@ public async Task<IActionResult> Post([FromForm] MyWrapper myWrapper) {
Notes:

It automatically adds examples from class which implements `IExampleProvider<MyModel>`.

<a href="https://www.buymeacoffee.com/morasiu" target="_blank"><img src="https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png" alt="Buy Me A Coffee" style="height: 41px !important;width: 174px !important;box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;-webkit-box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;" ></a>
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,7 @@ public MultiPartJsonOperationFilter(IServiceProvider serviceProvider, IOptions<J
public void Apply(OpenApiOperation operation, OperationFilterContext context) {
var descriptors = context.ApiDescription.ActionDescriptor.Parameters.ToList();
foreach (var descriptor in descriptors) {
// Support for DescribeAllParametersInCamelCase
descriptor.Name = _generatorOptions.Value.DescribeAllParametersInCamelCase
? descriptor.Name.ToCamelCase()
: descriptor.Name;
descriptor.Name = GetParameterName(descriptor.Name);

// Get property with [FromJson]
var propertyInfo = GetPropertyInfo(descriptor);
Expand All @@ -57,8 +54,10 @@ public void Apply(OpenApiOperation operation, OperationFilterContext context) {

var schemaProperties = new Dictionary<string, OpenApiSchema>();

var propertyInfoName = GetParameterName(propertyInfo.Name);

foreach (var property in groupedProperties) {
if (property.Key == propertyInfo.Name) {
if (property.Key == propertyInfoName) {
AddEncoding(mediaType, propertyInfo);

var openApiSchema = GetSchema(context, propertyInfo);
Expand All @@ -76,6 +75,14 @@ public void Apply(OpenApiOperation operation, OperationFilterContext context) {
}
}

private string GetParameterName(string name)
{
// Support for DescribeAllParametersInCamelCase
return _generatorOptions.Value.DescribeAllParametersInCamelCase
? name.ToCamelCase()
: name;
}

/// <summary>
/// Generate schema for propertyInfo
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@
<AssemblyVersion>0.0.0.0</AssemblyVersion>
<FileVersion>0.0.0.0</FileVersion>
<RepositoryType>git</RepositoryType>
<PackageVersion>1.8.0</PackageVersion>
<PackageVersion>1.9.0</PackageVersion>
<TargetFramework>net6.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
Expand Down

0 comments on commit c1e727d

Please sign in to comment.