Added author , owner and description to NuGet generation#160
Open
tagz97 wants to merge 5 commits intoCenterEdge:mainfrom
Open
Added author , owner and description to NuGet generation#160tagz97 wants to merge 5 commits intoCenterEdge:mainfrom
tagz97 wants to merge 5 commits intoCenterEdge:mainfrom
Conversation
- Added author to the Generate Options and Yardarm Generation Settings - Added description to the Generate Options and Yardarm Generation Settings - Assign author and description from Generation Options to Yardarm Generation Settings - Modify logic on selecting description for NuGet packaging by introducing Description but allowing to use AssemlyName if null - Added a friendly error message to TagTypeGeneratorBase to assist a user finding an error with their OpenAPI spec and prevents and unhandled exception from being thrown due to a null value - Updated the generation README.md to include an example of providing author and description as part of generating a NuGet using Yardarm.CommandLine
…for Author and Description
Author
|
Apologies I closed it by mistake, I have reopened it |
brantburnett
requested changes
Feb 19, 2023
Contributor
brantburnett
left a comment
There was a problem hiding this comment.
I apologize that it's taken me so long to get back to you on this, it got lost in the shuffle. It looks great overall, and thanks for the PR, I've just added a couple of minor comments.
| public string? VersionSuffix { get; set; } | ||
| public string Author { get; set; } = "anonymous"; | ||
| public string Owner { get; set; } = "anonymous"; | ||
| public string Description { get; set; } |
Contributor
There was a problem hiding this comment.
This one needs a nullable annotation.
Suggested change
| public string Description { get; set; } | |
| public string? Description { get; set; } |
Comment on lines
+33
to
+39
| // This is here to show a useful error that there is an error with the Spec provided. If the operation | ||
| // is missing the name attribute in the OpenAPI spec, the MethodDeclaration step will fail | ||
| if (string.IsNullOrEmpty(methodName)) | ||
| { | ||
| throw new NullReferenceException($"{nameof(GenerateOperationMethodHeader)} ran into an error. Please ensure the method at the path {operation.Key} {operation} is decorated correctly with the OperationId present."); | ||
| } | ||
|
|
Contributor
There was a problem hiding this comment.
There's actually a separate issue already open to address this problem, I'd prefer to leave it off this PR for the sake of the separation of issues.
Suggested change
| // This is here to show a useful error that there is an error with the Spec provided. If the operation | |
| // is missing the name attribute in the OpenAPI spec, the MethodDeclaration step will fail | |
| if (string.IsNullOrEmpty(methodName)) | |
| { | |
| throw new NullReferenceException($"{nameof(GenerateOperationMethodHeader)} ran into an error. Please ensure the method at the path {operation.Key} {operation} is decorated correctly with the OperationId present."); | |
| } |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
I have added these changes to support adding of a custom description, author and owner for packing NuGet packages and symbols to give more flexibility and control to the user. I have also added a small convenient error message when the method name is null (OperationId is missing/null) as this initially cost me several hours of trying to figure out what may or may not have been wrong with my own OpenAPI spec.
Changes
Result
NuGet and symbols packages are generated with a custom Author and Custom description. This description does not overwrite the description within the Spec.

Passing Tests