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
The generator for swagger docs removes some (but not all) of the line breaks, breaking the markdown #111388
Comments
/sig api-machinery |
@ePaul thanks, are you going to send a PR for this? |
Hi @leilajal, I didn't manage to find out where exactly this happens (my Go-knowledge is virtually nonexistent, I'm just a K8s user who stumbled over the broken documentation). If someone can point me to the file(s) I need to look at, I can take a stab (though likely not very soon), otherwise I'll have to leave this to people more experienced than me. |
The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs. This bot triages issues and PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
/remove-lifecycle stale |
The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs. This bot triages issues and PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
/remove-lifecycle stale |
This issue has not been updated in over 1 year, and should be re-triaged. You can:
For more details on the triage process, see https://www.kubernetes.dev/docs/guide/issue-triage/ /remove-triage accepted |
/triage accepted |
What happened?
When generating the networking/v1/types_swagger_doc_generated.go from networking/v1/types.go, some of the line breaks in the input documentation comments are removed (while others are kept).
From this we get https://github.com/kubernetes/kubernetes/blob/master/api/openapi-spec/swagger.json, which in turn is used to generate https://github.com/kubernetes/website/tree/main/content/en/docs/reference/kubernetes-api.
In the final documentation (e.g. https://kubernetes.io/docs/reference/kubernetes-api/service-resources/ingress-v1/#IngressSpec), the result is that list formatting is broken.
What did you expect to happen?
Line breaks in the input are kept for the Markdown processor. (Or the removal is at least smart enough to not remove relevant line breaks.)
How can we reproduce it (as minimally and precisely as possible)?
Input in types.go:
This becomes in types_swagger_doc_generated.go:
We can here see that the first 3 line breaks are removed, the later ones are still there (escaped as \n).
In the generated markdown, ingress-v1.md, this results in this:
Instead, it should be this:
The same is happening for several other cases, this is just the one where I noticed it on the website.
Anything else we need to know?
This investigation was triggered by kubernetes/website#35203 (which pointed me to "this is generated").
The text was updated successfully, but these errors were encountered: