Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

master refresh #1161

Merged
merged 16 commits into from
Feb 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<Company>Microsoft</Company>
<Title>Microsoft.OpenApi.Readers</Title>
<PackageId>Microsoft.OpenApi.Readers</PackageId>
<Version>1.6.0</Version>
<Version>1.6.1</Version>
<Description>OpenAPI.NET Readers for JSON and YAML documents</Description>
<Copyright>© Microsoft Corporation. All rights reserved.</Copyright>
<PackageTags>OpenAPI .NET</PackageTags>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<ImportWindowsDesktopTargets>true</ImportWindowsDesktopTargets>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.DotNet.UpgradeAssistant.Extensions.Default.Analyzers" Version="0.4.355802">
<PackageReference Include="Microsoft.DotNet.UpgradeAssistant.Extensions.Default.Analyzers" Version="0.4.410601">
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.Windows.Compatibility" Version="7.0.0" />
Expand Down
2 changes: 1 addition & 1 deletion src/Microsoft.OpenApi/Microsoft.OpenApi.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<Company>Microsoft</Company>
<Title>Microsoft.OpenApi</Title>
<PackageId>Microsoft.OpenApi</PackageId>
<Version>1.6.0</Version>
<Version>1.6.1</Version>
<Description>.NET models with JSON and YAML writers for OpenAPI specification</Description>
<Copyright>© Microsoft Corporation. All rights reserved.</Copyright>
<PackageTags>OpenAPI .NET</PackageTags>
Expand Down
2 changes: 1 addition & 1 deletion src/Microsoft.OpenApi/Models/OpenApiContact.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public OpenApiContact() { }
public OpenApiContact(OpenApiContact contact)
{
Name = contact?.Name ?? Name;
Url = contact?.Url != null ? new Uri(contact.Url.OriginalString) : null;
Url = contact?.Url != null ? new Uri(contact.Url.OriginalString, UriKind.RelativeOrAbsolute) : null;
Email = contact?.Email ?? Email;
Extensions = contact?.Extensions != null ? new Dictionary<string, IOpenApiExtension>(contact.Extensions) : null;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Microsoft.OpenApi/Models/OpenApiExternalDocs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ public class OpenApiExternalDocs : IOpenApiSerializable, IOpenApiExtensible
/// <summary>
/// Parameter-less constructor
/// </summary>
public OpenApiExternalDocs() {}
public OpenApiExternalDocs() { }

/// <summary>
/// Initializes a copy of an <see cref="OpenApiExternalDocs"/> object
/// </summary>
public OpenApiExternalDocs(OpenApiExternalDocs externalDocs)
{
Description = externalDocs?.Description ?? Description;
Url = externalDocs?.Url != null ? new Uri(externalDocs.Url.OriginalString) : null;
Url = externalDocs?.Url != null ? new Uri(externalDocs.Url.OriginalString, UriKind.RelativeOrAbsolute) : null;
Extensions = externalDocs?.Extensions != null ? new Dictionary<string, IOpenApiExtension>(externalDocs.Extensions) : null;
}

Expand Down
4 changes: 2 additions & 2 deletions src/Microsoft.OpenApi/Models/OpenApiLicense.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ public class OpenApiLicense : IOpenApiSerializable, IOpenApiExtensible
/// <summary>
/// Parameterless constructor
/// </summary>
public OpenApiLicense() {}
public OpenApiLicense() { }

/// <summary>
/// Initializes a copy of an <see cref="OpenApiLicense"/> object
/// </summary>
public OpenApiLicense(OpenApiLicense license)
{
Name = license?.Name ?? Name;
Url = license?.Url != null ? new Uri(license.Url.OriginalString) : null;
Url = license?.Url != null ? new Uri(license.Url.OriginalString, UriKind.RelativeOrAbsolute) : null;
Extensions = license?.Extensions != null ? new Dictionary<string, IOpenApiExtension>(license.Extensions) : null;
}

Expand Down
8 changes: 4 additions & 4 deletions src/Microsoft.OpenApi/Models/OpenApiOAuthFlow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,16 @@ public class OpenApiOAuthFlow : IOpenApiSerializable, IOpenApiExtensible
/// <summary>
/// Parameterless constructor
/// </summary>
public OpenApiOAuthFlow() {}
public OpenApiOAuthFlow() { }

/// <summary>
/// Initializes a copy of an <see cref="OpenApiOAuthFlow"/> object
/// </summary>
public OpenApiOAuthFlow(OpenApiOAuthFlow oAuthFlow)
{
AuthorizationUrl = oAuthFlow?.AuthorizationUrl != null ? new Uri(oAuthFlow.AuthorizationUrl.OriginalString) : null;
TokenUrl = oAuthFlow?.TokenUrl != null ? new Uri(oAuthFlow.TokenUrl.OriginalString) : null;
RefreshUrl = oAuthFlow?.RefreshUrl != null ? new Uri(oAuthFlow.RefreshUrl.OriginalString) : null;
AuthorizationUrl = oAuthFlow?.AuthorizationUrl != null ? new Uri(oAuthFlow.AuthorizationUrl.OriginalString, UriKind.RelativeOrAbsolute) : null;
TokenUrl = oAuthFlow?.TokenUrl != null ? new Uri(oAuthFlow.TokenUrl.OriginalString, UriKind.RelativeOrAbsolute) : null;
RefreshUrl = oAuthFlow?.RefreshUrl != null ? new Uri(oAuthFlow.RefreshUrl.OriginalString, UriKind.RelativeOrAbsolute) : null;
Scopes = oAuthFlow?.Scopes != null ? new Dictionary<string, string>(oAuthFlow.Scopes) : null;
Extensions = oAuthFlow?.Extensions != null ? new Dictionary<string, IOpenApiExtension>(oAuthFlow.Extensions) : null;
}
Expand Down
5 changes: 5 additions & 0 deletions src/Microsoft.OpenApi/Models/OpenApiSchema.cs
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,11 @@ internal void SerializeAsV2(
}

target.SerializeAsV2WithoutReference(writer, parentRequiredProperties, propertyName);

if (Reference != null)
{
settings.LoopDetector.PopLoop<OpenApiSchema>();
}
}

/// <summary>
Expand Down
8 changes: 4 additions & 4 deletions src/Microsoft.OpenApi/Models/OpenApiSecurityScheme.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public class OpenApiSecurityScheme : IOpenApiSerializable, IOpenApiReferenceable
/// <summary>
/// Parameterless constructor
/// </summary>
public OpenApiSecurityScheme() {}
public OpenApiSecurityScheme() { }

/// <summary>
/// Initializes a copy of <see cref="OpenApiSecurityScheme"/> object
Expand All @@ -91,7 +91,7 @@ public OpenApiSecurityScheme(OpenApiSecurityScheme securityScheme)
Scheme = securityScheme?.Scheme ?? Scheme;
BearerFormat = securityScheme?.BearerFormat ?? BearerFormat;
Flows = securityScheme?.Flows != null ? new(securityScheme?.Flows) : null;
OpenIdConnectUrl = securityScheme?.OpenIdConnectUrl != null ? new Uri(securityScheme.OpenIdConnectUrl.OriginalString) : null;
OpenIdConnectUrl = securityScheme?.OpenIdConnectUrl != null ? new Uri(securityScheme.OpenIdConnectUrl.OriginalString, UriKind.RelativeOrAbsolute) : null;
Extensions = securityScheme?.Extensions != null ? new Dictionary<string, IOpenApiExtension>(securityScheme.Extensions) : null;
UnresolvedReference = securityScheme?.UnresolvedReference ?? UnresolvedReference;
Reference = securityScheme?.Reference != null ? new(securityScheme?.Reference) : null;
Expand All @@ -107,8 +107,8 @@ public void SerializeAsV3(IOpenApiWriter writer)
throw Error.ArgumentNull(nameof(writer));
}

if (Reference != null)

if (Reference != null)
{
Reference.SerializeAsV3(writer);
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<PackageReference Include="Moq" Version="4.18.4" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
<PackageReference Include="SharpYaml" Version="2.1.0" />
<PackageReference Include="Verify.Xunit" Version="19.7.1" />
<PackageReference Include="Verify.Xunit" Version="19.9.2" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<PrivateAssets>all</PrivateAssets>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,12 @@ public void WriteInlineRecursiveSchemav2()
type: object
properties:
children:
$ref: '#/definitions/thing'
type: object
properties:
children:
$ref: '#/definitions/thing'
related:
type: integer
related:
type: integer";
// Component schemas that are there due to cycles are still inlined because the items they reference may not exist in the components because they don't have cycles.
Expand Down