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

Add documentation of the API methods on Readme #15

Closed
ppcano opened this issue Oct 21, 2021 · 10 comments · Fixed by #54
Closed

Add documentation of the API methods on Readme #15

ppcano opened this issue Oct 21, 2021 · 10 comments · Fixed by #54
Labels
documentation Improvements or additions to documentation

Comments

@ppcano
Copy link
Contributor

ppcano commented Oct 21, 2021

We have added more features to this project, and besides the examples, the documentation is missing.

It would be good to start with:

@javaducky javaducky added the documentation Improvements or additions to documentation label Mar 4, 2022
@pablochacin
Copy link
Contributor

@ppcano Do you have any guidelines on how this documentation should be done? Any existing extension I could use as a guideline?

@ppcano
Copy link
Contributor Author

ppcano commented May 17, 2022

At this moment, we don't have a default or preferred way. Looping @javaducky

Below are two different approaches:

@javaducky
Copy link
Contributor

Rather than including custom API documentation within the README and expose ourselves to "drift", we should simply include a link to the public API at pkg.go.dev.

We should however go through the code to ensure it is adequately documented to make the docs usable. This may be addressed with issue #46.

@javaducky
Copy link
Contributor

Let's add a badge linking to the docs. Here's a Markdown snippet generated from go.dev site:

[![Go Reference](https://pkg.go.dev/badge/github.com/grafana/xk6-kubernetes.svg)](https://pkg.go.dev/github.com/grafana/xk6-kubernetes)

@ppcano
Copy link
Contributor Author

ppcano commented May 18, 2022

@javaducky, correct me if I am wrong but pkg.go.dev is meant to be for the go documentation.

Additionally, we should figure out a format for the Javascript API that can be used as a reference for other k6 extensions.

@javaducky
Copy link
Contributor

@ppcano, yes...that's true...I kinda forgot the target user for this documentation is the Javascript developer. Definitely open for suggestions on the best formatting there.

The fear is still there for drift of the documentation from the code; not sure if there is something that could be hooked into the CICD to generate the docs based upon code. Will have to dig into something.

@pablochacin
Copy link
Contributor

I've found some projects (for example goreadme) for generating markdown from the godoc. The interesting part is that these projects use templates for formatting the output in markdown. I'm wondering if we could tweak those templates for generating JS style documentation (for example, changing the case of the functions and struct members).

This is the template for generating the documentation for a function

{{ define "functions" }}
{{ if .Funcs }}

## Functions

{{ range .Funcs }}

### func [{{ .Name }}]({{ urlOrName (index $.Files .Pos.File) }}#L{{ .Pos.Line }})

{{ inlineCode .Decl.Text }}

{{ doc .Doc }}

{{ template "examplesNoHeading" .Examples }}
{{ end }}

{{ end }}
{{ end }}

@ppcano
Copy link
Contributor Author

ppcano commented May 19, 2022

I think we should not overcomplicate the docs at this moment. The initial goal is to show what the extension can do. imo, the list of APIs linking to the examples might be a good start.

I can work on this issue.

@ppcano
Copy link
Contributor Author

ppcano commented May 30, 2022

PR -> #54

@pablochacin
Copy link
Contributor

pablochacin commented Oct 11, 2022 via email

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

Successfully merging a pull request may close this issue.

3 participants