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

How to insert introduction to generated api docs #269

Open
wutz opened this issue Mar 20, 2019 · 10 comments
Open

How to insert introduction to generated api docs #269

wutz opened this issue Mar 20, 2019 · 10 comments
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@wutz
Copy link
Contributor

wutz commented Mar 20, 2019

Is this a BUG REPORT or FEATURE REQUEST?:

/kind feature

What you expected to happen:

Before to use api, user need to known about general information, like
how to Authentication.

@caicloud-bot caicloud-bot added the kind/feature Categorizes issue or PR as related to a new feature. label Mar 20, 2019
@kdada
Copy link
Collaborator

kdada commented Mar 20, 2019

Write your description to nirvana.yaml.

@wutz
Copy link
Contributor Author

wutz commented Mar 20, 2019

Write to description ? I may be write more than one paragraph.

@wutz
Copy link
Contributor Author

wutz commented Mar 20, 2019

May be like https://docs.docker.com/engine/api/v1.25/ to provide multiple section, example: Errors, Versioning and Authentication.

@kdada
Copy link
Collaborator

kdada commented Mar 20, 2019

YAML supports multi-lines string:

description: |
  Write your description here.
  This is the second paragraph.

@kdada
Copy link
Collaborator

kdada commented Mar 20, 2019

/kind support

@caicloud-bot caicloud-bot added kind/support Categorizes issue or PR as related to support. and removed kind/feature Categorizes issue or PR as related to a new feature. labels Mar 20, 2019
@wutz
Copy link
Contributor Author

wutz commented Mar 21, 2019

I'm refer to https://github.com/Rebilly/ReDoc/blob/master/demo/swagger.yaml, but line start with # can not display as a heading, it just display as origin.

description: |
  The description here.
  # Introduction
  The introduction here.

image

@wutz
Copy link
Contributor Author

wutz commented Mar 21, 2019

I have notice that the new line of description which in nirvana.yaml have been generated as \u003cbr/\u003e (<br/>).

If i change the new line of generated openapi spec json from <br/> to \n, then # introduction can display heading correctly.

@wutz
Copy link
Contributor Author

wutz commented Mar 21, 2019

func (g *Generator) escapeNewline(content string) string {
return strings.Replace(strings.TrimSpace(content), "\n", "<br/>", -1)
}

@kdada Why replace \n to <br/> ?

@kdada
Copy link
Collaborator

kdada commented Mar 21, 2019

@wutzx

If not escape newline, two line will be merged into one line in markdown. It seems that we should not replace the newline character.

@kdada
Copy link
Collaborator

kdada commented Mar 21, 2019

/kind bug

@caicloud-bot caicloud-bot added kind/bug Categorizes issue or PR as related to a bug. and removed kind/support Categorizes issue or PR as related to support. labels Mar 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

No branches or pull requests

3 participants