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

Documentation Generation #132

Merged

Conversation

Skyppid
Copy link
Contributor

@Skyppid Skyppid commented Sep 6, 2023

One feature that was drastically lacking for this tool was the fact that no documentation is being generated. The information from where it is transpiled is kinda useless compared to explicit explanations what the methods actually invoke and the parameters are.

The changes are absolutely trivial, thus I have not written any tests. We plan on further changes / improvements for our requirements, although not all might make it into the main repository. This improvement I don't want to withhold for the community. It's simple yet useful.

This interface for a receiver:

/// <summary>   Client methods for interaction on active projects.    </summary>
[Receiver]
public interface IActiveProjectHubClient
{
    ///-------------------------------------------------------------------------------------------------
    /// <summary>   Informs the client about a user that joined the current project.    </summary>
    ///
    /// <param name="userInfo"> Information describing the user.    </param>
    /// <param name="testA">    The test a. </param>
    /// <param name="testB">    The test b. </param>
    ///
    /// <returns>   A Task. </returns>
    ///-------------------------------------------------------------------------------------------------
    Task UserJoined(UserInfoDto userInfo, string testA, int testB);

    ///-------------------------------------------------------------------------------------------------
    /// <summary>   Informs the client about a user that left the current project.  </summary>
    ///
    /// <param name="userInfo"> Information describing the user.    </param>
    ///
    /// <returns>   A Task. </returns>
    ///-------------------------------------------------------------------------------------------------
    Task UserLeft(UserInfoDto userInfo);
}

gets transpiled into this interface (namespaces were removed):

/**
* Client methods for interaction on active projects.
*/
export type IActiveProjectHubClient = {
    /**
    * Informs the client about a user that joined the current project.
    * @param userInfo Information describing the user. (Transpiled from ***.UserInfoDto)
    * @param testA The test a. (Transpiled from string)
    * @param testB The test b. (Transpiled from int)
    * @returns A Task. (Transpiled from System.Threading.Tasks.Task)
    */
    userJoined(userInfo: UserInfoDto, testA: string, testB: number): Promise<void>;
    /**
    * Informs the client about a user that left the current project.
    * @param userInfo Information describing the user. (Transpiled from ***.UserInfoDto)
    * @returns A Task. (Transpiled from System.Threading.Tasks.Task)
    */
    userLeft(userInfo: UserInfoDto): Promise<void>;
}

Feel free to merge :)

@nenoNaninu nenoNaninu merged commit 1f18a05 into nenoNaninu:main Sep 9, 2023
1 check passed
@nenoNaninu
Copy link
Owner

Thanks for the PR!

@Skyppid Skyppid deleted the feature/documentation-generation branch September 12, 2023 11:02
@DingbatDev
Copy link

Hi @Skyppid & @nenoNaninu,
This is great... I came here looking to make a suggestion, as it's a bit beyond my capability for now, but looks like all the work is done.
I haven't been able to get this working as yet, even after updating to 1.8.2. So I'm checking through my configuration to make sure I have properly updated the Nuget etc.
I assume there is no configuration or changes required? Once updated it should just replace the "transpiled from" comments with the XMLdocs when available?

@DingbatDev
Copy link

OK I answered my own question... yes I was a bit slow and forgot:

dotnet tool update --global TypedSignalR.Client.TypeScript.Generator Tool 'typedsignalr.client.typescript.generator' was successfully updated from version '1.7.6' to version '1.8.2'.

The new JSDocs are brilliant! For me this completes the tool very nicely. Awesome work and thank you!

@DingbatDev
Copy link

Followup question - any plans to add XMLdocs for records?

@Skyppid
Copy link
Contributor Author

Skyppid commented May 27, 2024

Followup question - any plans to add XMLdocs for records?

Not from my side. We don't use this library anymore as it did not work well with how we generate our DTOs for the frontend. I tried modifying the library for a more dynamic approach but since it's partially implemented in another library it was too tedious to achieve and we abandoned it as a whole.

@nenoNaninu
Copy link
Owner

It is the Tapper's responsibility, not TypedSignalR.Client.TypeScript, to generate JSDoc from the XMLdocs. When I have time, I will add functionality to Tapper.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants