-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
14 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,8 +21,16 @@ public static partial class OpenApiDocumentExtensions | |
/// <param name="apiDescriptionUrl">The URL of the API description.</param> | ||
/// <param name="applicationName">The name of the application.</param> | ||
/// <param name="apiDependencyName">The name of the API dependency. If not specified, it defaults to the title from the OpenAPI document.</param> | ||
/// <param name="publisherName"> The publisher name of the API manifest. If not supplied, it defaults to the contact name from the OpenAPI document, if available. In the absence of both, 'publisher-name' is used as a fallback.</param> | ||
/// <param name="publisherEmail">The publisher email of the API manifest. If not supplied, it defaults to the contact email from the OpenAPI document, if available.In the absence of both, '[email protected]' is used as a fallback.</param> | ||
/// <param name="publisherName"> | ||
/// The publisher's name for the API manifest. | ||
/// If not provided, it defaults to the contact name from the OpenAPI document (if available). | ||
/// If the contact name is also not available, it defaults to 'publisher-name'. | ||
/// </param> | ||
/// <param name="publisherEmail"> | ||
/// The publisher's email for the API manifest. | ||
/// If not provided, it defaults to the contact email from the OpenAPI document (if available). | ||
/// If the contact email is also not available, it defaults to '[email protected]'. | ||
/// </param> | ||
/// <returns>An <see cref="ApiManifestDocument"/>.</returns> | ||
public static ApiManifestDocument ToApiManifest(this OpenApiDocument document, string? apiDescriptionUrl, string applicationName, string? apiDependencyName = default, string? publisherName = default, string? publisherEmail = default) | ||
{ | ||
|
@@ -31,10 +39,10 @@ public static ApiManifestDocument ToApiManifest(this OpenApiDocument document, s | |
ValidationHelpers.ValidateNullOrWhitespace(nameof(applicationName), applicationName, nameof(ApiManifestDocument)); | ||
|
||
if (string.IsNullOrEmpty(publisherName)) | ||
publisherName = document.Info.Contact?.Name ?? DefaultPublisherName; | ||
publisherName = document.Info.Contact?.Name is string cName && !string.IsNullOrEmpty(cName) ? cName : DefaultPublisherName; | ||
|
||
if (string.IsNullOrEmpty(publisherEmail)) | ||
publisherEmail = document.Info.Contact?.Email ?? DefaultPublisherEmail; | ||
publisherEmail = document.Info.Contact?.Email is string cEmail && !string.IsNullOrEmpty(cEmail) ? cEmail : DefaultPublisherEmail; | ||
|
||
apiDependencyName = NormalizeApiName(string.IsNullOrEmpty(apiDependencyName) ? document.Info.Title : apiDependencyName); | ||
string? apiDeploymentBaseUrl = GetApiDeploymentBaseUrl(document.Servers.FirstOrDefault()); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters