Skip to content

Commit

Permalink
Bump Microsoft.Extensions.FileProviders.Embedded from 7.0.12 to 7.0.13 (
Browse files Browse the repository at this point in the history
#79)

* Bump Microsoft.Extensions.FileProviders.Embedded from 7.0.12 to 7.0.13

Bumps [Microsoft.Extensions.FileProviders.Embedded](https://github.com/dotnet/aspnetcore) from 7.0.12 to 7.0.13.
- [Release notes](https://github.com/dotnet/aspnetcore/releases)
- [Changelog](https://github.com/dotnet/aspnetcore/blob/main/docs/ReleasePlanning.md)
- [Commits](dotnet/aspnetcore@v7.0.12...v7.0.13)

---
updated-dependencies:
- dependency-name: Microsoft.Extensions.FileProviders.Embedded
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* Support multiple tags

* Call AsEquatableArray

* Update AnonymousEnumParameterProcessor

* Move generateNativeRecords property into NSwagStudio place

* Support array of array in AnonymousComplexPropertyProcessor

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Jan Trejbal <jan@trejbal.land>
  • Loading branch information
dependabot[bot] and trejjam authored Oct 25, 2023
1 parent c64b745 commit 9fb26bc
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ CancellationToken cancellationToken

if (source.textFile.GetText() is var fileContent && fileContent is null)
{
return ImmutableArray<FileWithName>.Empty;
return ImmutableArray<FileWithName>.Empty.AsEquatableArray();
}

var jsonReadOnlySpan = Encoding.UTF8.GetBytes(fileContent.ToString()).AsSpan().TrimBom();
Expand All @@ -70,6 +70,6 @@ CancellationToken cancellationToken
);
}

return files;
return files.AsEquatableArray();
}
}
8 changes: 4 additions & 4 deletions src/Apple.AppStoreConnect.GeneratorCommon/PathItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ namespace Apple.AppStoreConnect.GeneratorCommon;

public record PathItem(JsonTokenType TokenType, string? PropertyName, PathItem? ParentPathItem = null)
{
public IReadOnlyDictionary<string, string> Properties => _properties;
public IReadOnlyCollection<KeyValuePair<string, string>> Properties => _properties;

private Dictionary<string, string> _properties = new();
private readonly List<KeyValuePair<string, string>> _properties = new();

public void AddUsefulProperty(ReadOnlySpan<byte> property, ReadOnlySpan<byte> value)
{
Expand All @@ -21,13 +21,13 @@ public void AddUsefulProperty(ReadOnlySpan<byte> property, ReadOnlySpan<byte> va
var propertyString = Encoding.UTF8.GetString(property.ToArray());
var propertyValue = Encoding.UTF8.GetString(value.ToArray());

_properties.Add(propertyString, propertyValue);
_properties.Add(new KeyValuePair<string, string>(propertyString, propertyValue));
}
else if (ParentPathItem != null && PropertyName == "tags")
{
var propertyValue = Encoding.UTF8.GetString(value.ToArray());

ParentPathItem._properties.Add(PropertyName, propertyValue);
ParentPathItem._properties.Add(new KeyValuePair<string, string>(PropertyName, propertyValue));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Apple.AppStoreConnect.OpenApiDocument.Generator.Extensions;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Text;
using System.Text.Json;
Expand Down Expand Up @@ -125,6 +126,32 @@ private static string ProcessItemInternal(
JsonNode jsonNode,
TransposeContext context
)
{
if (
TryProcessItemInternal(
typePrefix,
lastPropertySpan,
jsonNode,
context,
out var reference
)
)
{
return reference;
}

throw new Exception(
$"Unable to process item {typePrefix.ToString()}.{lastPropertySpan.ToString()}"
);
}

private static bool TryProcessItemInternal(
ReadOnlySpan<char> typePrefix,
ReadOnlySpan<char> lastPropertySpan,
JsonNode jsonNode,
TransposeContext context,
[NotNullWhen(true)] out string? reference
)
{
var titleSpan = typePrefix.CreateTypeName(lastPropertySpan);

Expand Down Expand Up @@ -152,12 +179,18 @@ TransposeContext context
&& itemsJsonNode["$ref"] is null
)
{
subProperty["items"] = ProcessItemInternal(
titleSpan,
innerProperty.Key.AsSpan(),
itemsJsonNode,
context
).GetReferenceJsonNode();
if (
TryProcessItemInternal(
titleSpan,
innerProperty.Key.AsSpan(),
itemsJsonNode,
context,
out var innerReference
)
)
{
subProperty["items"] = innerReference.GetReferenceJsonNode();
}
}
else if (
subProperty["type"]?.GetValue<string>() == "string"
Expand All @@ -179,11 +212,29 @@ TransposeContext context
}
}
}
else if (
jsonNode["type"]?.GetValue<string>() == "array"
&& jsonNode["items"] is { } itemsJsonNode
&& itemsJsonNode["$ref"] is null
)
{
jsonNode["items"] = ProcessItemInternal(
titleSpan,
ReadOnlySpan<char>.Empty,
itemsJsonNode,
context
).GetReferenceJsonNode();

reference = null;
return false;
}

return context.AddComponent(
reference = context.AddComponent(
titleSpan.ToString(),
jsonNode
);

return true;
}

public static bool TryWriteAdditional(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ TransposeContext context
var jsonReaderClone = jsonReader;

if (
path.ElementAt(0).Properties.TryGetValue("name", out var name)
&& path.ElementAt(2).Properties.TryGetValue("operationId", out var operationId)
path.ElementAt(0).Properties.Where(x => x.Key == "name").Select(x => x.Value).SingleOrDefault() is { } name
&& path.ElementAt(2).Properties.Where(x => x.Key == "operationId").Select(x => x.Value).SingleOrDefault() is { } operationId
&& TryReadInner(path, name, operationId, ref jsonReaderClone, jsonWriter, context)
)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Apple.AppStoreConnect/openapi.nswag
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"clientClassAccessModifier": "public",
"typeAccessModifier": "public",
"propertySetterAccessModifier": "",
"generateNativeRecords": true,
"generateContractsOutput": false,
"contractsNamespace": null,
"contractsOutputFilePath": null,
Expand Down Expand Up @@ -88,7 +89,6 @@
"generateDtoTypes": true,
"generateOptionalPropertiesAsNullable": true,
"generateNullableReferenceTypes": true,
"generateNativeRecords": true,
"templateDirectory": "NswagTemplates",
"typeNameGeneratorType": null,
"propertyNameGeneratorType": null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.FileProviders.Embedded" Version="7.0.12" />
<PackageReference Include="Microsoft.Extensions.FileProviders.Embedded" Version="7.0.13" />
<PackageReference Include="Microsoft.Extensions.FileProviders.Physical" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="7.0.0" />
Expand Down

0 comments on commit 9fb26bc

Please sign in to comment.