Skip to content

Commit 208e7d2

Browse files
committed
Add readme info
1 parent 4f4aedc commit 208e7d2

File tree

2 files changed

+42
-18
lines changed

2 files changed

+42
-18
lines changed

docs/doc-comments-guide.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export interface Request extends RequestBase {
5858
([original source code](https://github.com/elastic/elasticsearch-specification/blob/main/specification/_global/rank_eval/RankEvalRequest.ts))
5959

6060
For more information about the tags in this example (and other common tags such
61-
as `@deprecated` and `@doc_id`), refer to the [Modeling Guide](https://github.com/elastic/elasticsearch-specification/blob/main/docs/modeling-guide.md#additional-information).
61+
as `@deprecated` and `@ext_doc_id`), refer to the [Modeling Guide](https://github.com/elastic/elasticsearch-specification/blob/main/docs/modeling-guide.md#additional-information).
6262

6363
## Markup language
6464

@@ -76,9 +76,9 @@ GFM also has implementations in most languages, meaning that code generators wil
7676

7777
**Doc comments are reference material**: they should be as succinct as possible while capturing all the necessary information to use the elements they're documenting. Remember that they will often show up in small IDE autocompletion popups!
7878

79-
In particular, doc comments are not the right place for tutorials or examples, which should be in dedicated documentation pages. These pages can of course be linked from the doc comments.
79+
In particular, doc comments are not the right place for tutorials or extended examples, which should be in dedicated documentation pages. To reduce the risk of broken links, use `@ext_doc_id` to implement a link to additional documentation.
8080

81-
API endpoints will also have a `@doc_url` JSDoc tag that links to that API's detailed documentation page.
81+
API endpoints can also have `@doc_id` or `@doc_url` JSDoc tags that enable clients to link to the API docs, for example.
8282

8383
### Multi-paragraph doc comments
8484

docs/modeling-guide.md

Lines changed: 39 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -598,37 +598,61 @@ class Foo {
598598
}
599599
```
600600
601-
#### `@doc_url`
601+
#### `@doc_id`
602602
603-
The documentation url for the parameter or definition.
604-
If possible, use `@doc_id`.
603+
An identifier that can be used for generating the doc url in clients.
604+
The unique id/url pair must exist in `specification/_doc_ids/table.csv`.
605+
NOTE: This link is *not* included in the OpenAPI output.
605606
606607
```ts
607-
class Foo {
608-
bar: string
609-
/** @doc_url http://localhost:9200 */
610-
baz?: string
611-
faz: string
608+
/**
609+
* @rest_spec_name api
610+
* @doc_id foobar
611+
*/
612+
class Request {
613+
...
612614
}
613615
```
614616
615-
#### `@doc_id`
617+
```csv
618+
foobar,/guide/en/example
619+
```
620+
621+
#### `@ext_doc_id`
616622
617-
The documentation id that can be used for generating the doc url.
618-
You must add the id/url pair in `specification/_doc_ids/table.csv`.
623+
An identifier for a link.
624+
The unique id/url pair must exist in `specification/_doc_ids/table.csv`.
625+
NOTE: This link is included in the OpenAPI output.
619626
620627
```ts
621628
/**
622-
* @rest_spec_name api
623-
* @doc_id foobar
629+
* @variants container
630+
* @non_exhaustive
631+
* @ext_doc_id query-dsl
624632
*/
625-
class Request {
633+
export class QueryContainer {
626634
...
627635
}
628636
```
629637
630638
```csv
631-
foobar,/guide/en/example
639+
query-dsl,/guide/en/example
640+
```
641+
642+
643+
#### `@doc_url`
644+
645+
The documentation url for the parameter or definition.
646+
To reduce the risk of broken links, use `@doc_id` instead.
647+
NOTE: This link is *not* included in the OpenAPI output.
648+
649+
```ts
650+
class Foo {
651+
bar: string
652+
/** @doc_url http://localhost:9200 */
653+
baz?: string
654+
faz: string
655+
}
632656
```
633657
634658
#### `@doc_tag`

0 commit comments

Comments
 (0)