Skip to content

Commit

Permalink
Update emitter docs to include configuration examples (#4112)
Browse files Browse the repository at this point in the history
For a TypeSpec beginner, it may be difficult to understand how to
configure or format tspconfig.yaml to tweak the different options
available. Adding a basic example should help folks get started.
  • Loading branch information
amsoedal authored Aug 8, 2024
1 parent 1455928 commit dda9db6
Show file tree
Hide file tree
Showing 7 changed files with 65 additions and 0 deletions.
10 changes: 10 additions & 0 deletions docs/emitters/json-schema/reference/emitter.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,16 @@ emit:
- "@typespec/json-schema"
```
The config can be extended with options as follows:
```yaml
emit:
- "@typespec/json-schema"
options:
"@typespec/json-schema":
option: value
```
## Emitter options
### `file-type`
Expand Down
10 changes: 10 additions & 0 deletions docs/emitters/openapi3/reference/emitter.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,16 @@ emit:
- "@typespec/openapi3"
```
The config can be extended with options as follows:
```yaml
emit:
- "@typespec/openapi3"
options:
"@typespec/openapi3":
option: value
```
## Emitter options
### `file-type`
Expand Down
10 changes: 10 additions & 0 deletions docs/emitters/protobuf/reference/emitter.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,16 @@ emit:
- "@typespec/protobuf"
```
The config can be extended with options as follows:
```yaml
emit:
- "@typespec/protobuf"
options:
"@typespec/protobuf":
option: value
```
## Emitter options
### `noEmit`
Expand Down
10 changes: 10 additions & 0 deletions packages/json-schema/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,16 @@ emit:
- "@typespec/json-schema"
```
The config can be extended with options as follows:
```yaml
emit:
- "@typespec/json-schema"
options:
"@typespec/json-schema":
option: value
```
### Emitter options
#### `file-type`
Expand Down
10 changes: 10 additions & 0 deletions packages/openapi3/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,16 @@ emit:
- "@typespec/openapi3"
```
The config can be extended with options as follows:
```yaml
emit:
- "@typespec/openapi3"
options:
"@typespec/openapi3":
option: value
```
### Emitter options
#### `file-type`
Expand Down
10 changes: 10 additions & 0 deletions packages/protobuf/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,16 @@ emit:
- "@typespec/protobuf"
```
The config can be extended with options as follows:
```yaml
emit:
- "@typespec/protobuf"
options:
"@typespec/protobuf":
option: value
```
### Emitter options
#### `noEmit`
Expand Down
5 changes: 5 additions & 0 deletions packages/tspd/src/ref-doc/emitters/markdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,11 @@ export class MarkdownRenderer {
codeblock(`tsp compile . --emit=${refDoc.name}`, "bash"),
"2. Via the config",
codeblock(`emit:\n - "${refDoc.name}" `, "yaml"),
"The config can be extended with options as follows:",
codeblock(
`emit:\n - "${refDoc.name}"\noptions:\n "${refDoc.name}":\n option: value`,
"yaml"
),
]),
this.emitterOptions(refDoc.emitter.options),
]);
Expand Down

0 comments on commit dda9db6

Please sign in to comment.