@azure-tools/typespec-autorest 0.31.0-dev.8 → 0.31.0-dev.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +2 -144
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -3,148 +3,6 @@
3
3
  This is a TypeSpec library that will emit an enriched OpenAPI 2.0 specification that can be consumed by AutoRest.
4
4
  The generated OpenAPI spec will have custom `x-ms-` extensions properties and conform to standards required by AutoRest to generate a more accurate SDK.
5
5
 
6
- ## Getting started
6
+ ## Documentation
7
7
 
8
- 1. Include `@azure-tools/typespec-autorest` dependencies in package.json
9
-
10
- ```json
11
- {
12
- ...
13
- "dependencies": {
14
- ...
15
- "@azure-tools/typespec-autorest": "latest"
16
- }
17
- }
18
- ```
19
-
20
- 2. Run `npm install` to install the dependency
21
- 3. Import `@azure-tools/typespec-autorest` in your `main.tsp` file
22
-
23
- ```typespec
24
- import "@azure-tools/typespec-autorest";
25
- ```
26
-
27
- 4. Run `tsp compile`. This will result in a `swagger.json` file crated in `./tsp-output/swagger.json`
28
-
29
- ## Use in autorest
30
-
31
- ### Manually
32
-
33
- Generate the OpenAPI spec as shown above then run autorest cli directly on it.
34
-
35
- ## Configuration
36
-
37
- ### Emitter options:
38
-
39
- Emitter options can be configured via the `tspconfig.yaml` configuration:
40
-
41
- ```yaml
42
- emitters:
43
- '@azure-tools/typespec-autorest':
44
- <optionName>: <value>
45
-
46
-
47
- # For example
48
- emitters:
49
- '@azure-tools/typespec-autorest':
50
- output-file: my-custom-swagger.json
51
- ```
52
-
53
- or via the command line with
54
-
55
- ```bash
56
- --option "@azure-tools/typespec-autorest.<optionName>=<value>"
57
-
58
- # For example
59
- --option "@azure-tools/typespec-autorest.output-file=my-custom-swagger.json"
60
- ```
61
-
62
- #### `emitter-output-dir`
63
-
64
- Set the emitter output-dir. [See here](https://microsoft.github.io/typespec/introduction/configuration#output-directory-configuration)
65
-
66
- #### `output-file`
67
-
68
- Configure the name of the swagger output file relative to the `output-dir`.
69
-
70
- #### `examples-directory`
71
-
72
- Directory where the x-ms-examples are located so the emitter can automatically link.
73
-
74
- #### `version`
75
-
76
- Select which version should be emitted if the spec support versioning. By default all the version with be emitted in this format `<outputFileName>.<version>.json`
77
-
78
- ### `new-line`
79
-
80
- Set the newline character for emitting files. Can be either:
81
-
82
- - `lf`(Default)
83
- - `crlf`
84
-
85
- ### `omit-unreachable-types`
86
-
87
- Only include types referenced via an operation.
88
-
89
- ## Decorators
90
-
91
- - [@collectionFormat](#collectionformat)
92
- - [@example](#example)
93
- - [@useRef](#useref)
94
-
95
- ### @collectionFormat
96
-
97
- Syntax:
98
-
99
- ```
100
- @collectionFormat(formatString)
101
- ```
102
-
103
- `@collectionFormat` specifies array property type serialization format. Valid format strings are "csv", "multi", "ssv", "tsv", "pipes" though "csv" or "multi" are recommended.
104
-
105
- `@collectionFormat` can only be specified on model properties that are arrays.
106
-
107
- ### @example
108
-
109
- Syntax:
110
-
111
- ```
112
- @example(pathOrUri, title)
113
- ```
114
-
115
- `@example` attaches example files to an operation. Multiple examples can be specified.
116
-
117
- `@example` can only be specified on operations.
118
-
119
- ### @useRef
120
-
121
- Syntax:
122
-
123
- ```
124
- @useRef(urlString)
125
- ```
126
-
127
- `@useRef` is used to replace the TypeSpec model type in emitter output with a pre-existing named OpenAPI schema such as ARM common types.
128
-
129
- ## How to
130
-
131
- ### Include `x-ms-skip-url-encoding` in `x-ms-parmaeterized-host` parameter
132
-
133
- Every parameter of type `uri` in `@server` will be marked with `x-ms-skip-url-encoding`.
134
-
135
- ```typespec
136
- @server("{endpoint}/v2", "Account endpoint", {endpoint: url})
137
- ```
138
-
139
- Result in
140
-
141
- ```json5
142
- {
143
- in: "path",
144
- name: "endpoint",
145
- required: true,
146
- type: "string",
147
- format: "uri",
148
- "x-ms-skip-url-encoding": true,
149
- }
150
- ```
8
+ [Autorest Documentation](https://azure.github.io/typespec-azure/docs/emitters/typespec-autorest).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azure-tools/typespec-autorest",
3
- "version": "0.31.0-dev.8",
3
+ "version": "0.31.0-dev.9",
4
4
  "author": "Microsoft Corporation",
5
5
  "description": "TypeSpec library for emitting openapi from the TypeSpec REST protocol binding",
6
6
  "homepage": "https://azure.github.io/typespec-azure",