You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: documentation/cadl-structure-guidelines.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -77,7 +77,7 @@ The folder name should correspond to the RP-name, but dropping the leading "Azur
77
77
78
78
### Packages
79
79
80
-
All services and service family libraries are modeled as Cadl packages, since you must install supporting librarie for proper tooling support. Per this proposal, all packages defined in the repo would be **unpublished**. Only packages in `cadl-azure` would be published. We will annotate the packages with `"private": true` in the `package.json` file to prevent publishing these to npm.
80
+
All services and service family libraries are modeled as Cadl packages, since you must install supporting librarie for proper tooling support. Per this proposal, all packages defined in the repo would be **unpublished**. Only packages in `cadl-azure` would be published.
81
81
82
82
All packages defined in this repo would use the `@cadl-api-spec` scope and use a lowercased, dashed form of the service namespace (ex: `@cadl-api-spec/azure-storage-blob`).
83
83
@@ -86,7 +86,6 @@ All packages defined in this repo would use the `@cadl-api-spec` scope and use a
86
86
Each package should have the following minimum structure:
87
87
88
88
-`cadl-project.yaml`
89
-
-`package.json`
90
89
-`main.cadl` file
91
90
- Supporting `*.cadl` files
92
91
-`examples/` folder for example JSON files
@@ -95,11 +94,12 @@ Authors may use folders as desired for organizing cadl files.
95
94
96
95
Additionally, packages which wish to define custom linter rules or otherwise use TypeScript must place any `*.ts` files under a `src/` folder. Within the `src/` folder, the author may use as many subfolders as desired for organizing code.
97
96
98
-
To distinguish between folders which define a service, an SDK, or both, one can look to the `cadl-project.yaml` and/or the `package.json`.
97
+
To distinguish between folders which define a service, an SDK, or both, one can look to the `cadl-project.yaml`.
99
98
100
99
- SDKs will take dependencies on the `@azure-tools/cadl-dpg` library, as well as SDK-specific emitters such as `@azure-tools/cadl-python` and configure their options within `cadl-project.yaml` but the emitter version should not be configured within `cadl-project.yaml`, and it should be configured globally in SDK repo instead.
101
100
- SDKs _may_ have a sidecar file to customize how the SDK is shaped. Folders that describe service definitions only will not have a sidecar file. _Note: the absence of a sidecar does not mean that a folder does not describe an SDK, but the presence of one means it is an SDK._
102
101
- Services will take a dependency on `@azure-tools/autorest` and configure the emitter in `cadl-project.yaml`.
102
+
- Services should **not** have a `package.json` directly in the cadl directory as they all should be using the global `package.json` in the root specification folder for installing any dependencies needed.
While this would permit services from importing any service library described in the specs repo, as a matter of policy we should probably avoid that and have tooling to detect this scenario. Service family libraries **should** use versioning decorators and spec packages should reference them as versioned dependencies. Tooling would need to ensure that changes to service family libraries does not result in unexpected changes to any service version. One way to do this would be to diff the projection of the service versions on the `main` branch against the projection of the service versions that result from the change.
115
115
116
-
We treat the shared library as a sibling with other packages within the service family. This is similar to what we currently do for services that have a "Shared" package and would allow an arbitrary number of shared packages. A shared library folder should not contain `cadl-project.yaml`and `package.json`as it's not requried to be released. See [Sample Project](#sample-project) for reference.
116
+
We treat the shared library as a sibling with other packages within the service family. This is similar to what we currently do for services that have a "Shared" package and would allow an arbitrary number of shared packages. A shared library folder should not contain `cadl-project.yaml` as it's not requried to be released. See [Sample Project](#sample-project) for reference.
117
117
118
118
```
119
119
-> specification
@@ -137,7 +137,7 @@ Here's an example of how Cognitive Services might use multiple shared libraries:
137
137
```
138
138
## Sample Project
139
139
140
-
Here's a [cadl-sample-project](./cadl-sample-project) to demonstrate the files and folders supposed to be included when check in to this `azure-rest-api-specs` repository.
140
+
Here's a [cadl-sample-project](../specification/contosowidgetmanager) to demonstrate the files and folders supposed to be included when check in to this `azure-rest-api-specs` repository.
Copy file name to clipboardExpand all lines: specification/contosowidgetmanager/Contoso.WidgetManager/examples/2022-11-01-preview/Widgets_CreateOrUpdateWidgetSample.json
0 commit comments