# How to generate request body documentation for API explorer for runtime RPCs?

**URL:** https://forum.heroiclabs.com/t/how-to-generate-request-body-documentation-for-api-explorer-for-runtime-rpcs/3089
**Category:** Runtime Framework
**Tags:** server-framework, golang, docs
**Created:** [September 28, 2022, 3:12pm UTC](https://forum.heroiclabs.com/t/how-to-generate-request-body-documentation-for-api-explorer-for-runtime-rpcs/3089 "2022-09-28T15:12:53Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![thealphadollar](https://avatars.discourse-cdn.com/v4/letter/t/a183cd/32.png) [@thealphadollar](https://forum.heroiclabs.com/u/thealphadollar)
#### Post date: [September 28, 2022, 3:12pm UTC](https://forum.heroiclabs.com/t/how-to-generate-request-body-documentation-for-api-explorer-for-runtime-rpcs/3089/1 "2022-09-28T15:12:53Z")

</div>

The Nakama API explorer shows the request body structure for inbuilt Nakama RPCs.

For our custom RPCs as well, we want to add little documentation that would help the Unity developers integrate the RPCs easily by following the request body structure without having to communicate back and forth - even for the changes.

If it is not possible with the default configuration, what would be the good ways to generate documentation for the RPC APIs so that we can integrate easily just by having documentation as comments around the RPC calls or handlers?

I’m looking to achieve functionality similar to the[apiDoc outcome](https://apidocjs.com/).

1. Versions: Nakama {3.5}, {Windows, Mac, Linux binary or Docker}, {client library (SDK) and version}
2. Server Framework Runtime language (If relevant) {Go, TS/JS, Lua}

```auto
{code or log snippet}

```

📺 **Media:**

> Blockquote

---

<div class="post-metadata">

### Author: ![lugehorsam](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/lugehorsam/32/314_2.png) [@lugehorsam](https://forum.heroiclabs.com/u/lugehorsam)
#### Post date: [September 28, 2022, 5:08pm UTC](https://forum.heroiclabs.com/t/how-to-generate-request-body-documentation-for-api-explorer-for-runtime-rpcs/3089/2 "2022-09-28T17:08:29Z")

</div>

Hey thealphadollar, great question! Basically what you need is a documentation generator that works by taking `.proto` files as input. The `rpcs` themselves will need to be documented by hand, but you can inline in the comments for each message in the .proto what its intended RPC use is. There are a lot of different generators out there. Here’s one: [GitHub - pseudomuto/protoc-gen-doc: Documentation generator plugin for Google Protocol Buffers](https://github.com/pseudomuto/protoc-gen-doc)

---

<div class="post-metadata">

### Author: ![thealphadollar](https://avatars.discourse-cdn.com/v4/letter/t/a183cd/32.png) [@thealphadollar](https://forum.heroiclabs.com/u/thealphadollar)
#### Post date: [September 28, 2022, 8:01pm UTC](https://forum.heroiclabs.com/t/how-to-generate-request-body-documentation-for-api-explorer-for-runtime-rpcs/3089/3 "2022-09-28T20:01:03Z")

</div>

Thanks for the response.

However, I don’t completely understand why we need to write the `.proto` files. As far as my understanding goes, for the RPCs, we just have to return `(string, err)` that gets converted to the protobuf format automatically. What we are currently doing is something like below,

```auto
type User struct {

	// The id of the user's account.
	Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	// The username of the user's account.
	Username string `protobuf:"bytes,2,opt,name=username,proto3" json:"username,omitempty"`
}

```

However, if my understanding is incorrect, I’d definitely like to understand how we can use Nakama Protobuf instead of the responses over the REST API as that would save us a huge network call bandwidth.

---

<div class="post-metadata">

### Author: ![thealphadollar](https://avatars.discourse-cdn.com/v4/letter/t/a183cd/32.png) [@thealphadollar](https://forum.heroiclabs.com/u/thealphadollar)
#### Post date: [September 29, 2022, 6:10pm UTC](https://forum.heroiclabs.com/t/how-to-generate-request-body-documentation-for-api-explorer-for-runtime-rpcs/3089/4 "2022-09-29T18:10:02Z")

</div>

Hey @lugehorsam , can you please help me here? I’d appreciate if you can let me know a decent amount of time we are expected to wait and tagging directly before receiving a response.

---

<div class="post-metadata">

### Author: ![lugehorsam](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/lugehorsam/32/314_2.png) [@lugehorsam](https://forum.heroiclabs.com/u/lugehorsam)
#### Post date: [September 29, 2022, 6:31pm UTC](https://forum.heroiclabs.com/t/how-to-generate-request-body-documentation-for-api-explorer-for-runtime-rpcs/3089/5 "2022-09-29T18:31:07Z")

</div>

Hi @thealphadollar if you are using JSON then you’ll have to document your API by hand or maintain a swagger schema. If you’d like any sort of response time guarantees or even estimates you’d have to reach out to [support@heroiclabs.com](mailto:support@heroiclabs.com) and discuss a support contract.

The forum can only be a good faith effort to help everyone in the community as best we can, and empower them to help each other!
