@azure-tools/typespec-azure-core 0.28.0 → 0.29.0-dev.2

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 (3) hide show
  1. package/README.md +27 -24
  2. package/lib/models.tsp +9 -3
  3. package/package.json +12 -12
package/README.md CHANGED
@@ -114,13 +114,13 @@ This marks the `Contoso.WidgetManager` namespace as a service namespace in this
114
114
 
115
115
  ### Using the versioned Azure.Core types
116
116
 
117
- Before you can use the models and operations defined in the `Azure.Core` namespace, you will need to specify the API version of the `Azure.Core` library that your service uses. You can do this by adding the `@versionedDependency` decorator to the `Contoso.WidgetManager` namespace as seen here:
117
+ Before you can use the models and operations defined in the `Azure.Core` namespace, you will need to specify the API version of the `Azure.Core` library that your service uses. You can do this by adding the `@useDependency` decorator to the `Contoso.WidgetManager` namespace as seen here:
118
118
 
119
119
  ```typespec
120
120
  @service({
121
121
  title: "Contoso Widget Manager",
122
122
  })
123
- @versionedDependency(Azure.Core.Versions.v1_0_Preview_2)
123
+ @useDependency(Azure.Core.Versions.v1_0_Preview_2)
124
124
  namespace Contoso.WidgetManager;
125
125
  ```
126
126
 
@@ -364,12 +364,10 @@ Here is an example for the `WidgetManager` service:
364
364
  title: "Contoso Widget Manager",
365
365
  })
366
366
  @versioned(Contoso.WidgetManager.Versions)
367
- @versionedDependency(
368
- [[Contoso.WidgetManager.Versions.v2022_08_31, Azure.Core.Versions.v1_0_Preview_2]]
369
- )
370
367
  namespace Contoso.WidgetManager;
371
368
 
372
369
  enum Versions {
370
+ @useDependency(Azure.Core.Versions.v1_0_Preview_1)
373
371
  v2022_08_31: "2022-08-31",
374
372
  }
375
373
  ```
@@ -378,26 +376,28 @@ There are a few things to point out here:
378
376
 
379
377
  - We define an `enum` called `Versions` inside of the service namespace. For each service version, we map a version symbol like `v2022_08_31` to a version string like `2022-08-31`. This service currently only has a single version, but we can add more to this enum as things change over time.
380
378
  - We add the `@versioned` decorator and reference the `Versions` enum we defined using the fully-qualified name `Contoso.WidgetManager.Versions`. This marks the service as being versioned and specifies the set of versions.
381
- - We change the `@versionedDependency` decorator we used previously to now link each service version to a specific version of `Azure.Core`. See the [Using Azure.Core Versions](#using-azurecore-versions) section for more information.
379
+ - We change the `@useDependency` decorator we used previously to now link each service version to a specific version of `Azure.Core`. See the [Using Azure.Core Versions](#using-azurecore-versions) section for more information.
382
380
 
383
381
  Imagine that it's 3 months later and you want to release a new version of your service with some slight changes. Add a new version to the `Versions` enum:
384
382
 
385
383
  ```typespec
386
384
  enum Versions {
385
+ @useDependency(Azure.Core.Versions.v1_0_Preview_1)
387
386
  v2022_08_31: "2022-08-31",
388
387
  v2022_11_30: "2022-11-30",
389
388
  }
390
389
  ```
391
390
 
392
- You will also need to change the `@versionedDependency` decorator:
391
+ You will also need to add the `@useDependency` decorator:
393
392
 
394
393
  ```typespec
395
- @versionedDependency(
396
- [
397
- [Contoso.WidgetManager.Versions.v2022_08_31, Azure.Core.Versions.v1_0_Preview_2],
398
- [Contoso.WidgetManager.Versions.v2022_11_30, Azure.Core.Versions.v1_0_Preview_2]
399
- ]
400
- )
394
+ enum Versions {
395
+ @useDependency(Azure.Core.Versions.v1_0_Preview_1)
396
+ v2022_08_31: "2022-08-31",
397
+
398
+ @useDependency(Azure.Core.Versions.v1_0_Preview_2)
399
+ v2022_11_30: "2022-11-30",
400
+ }
401
401
  ```
402
402
 
403
403
  Finally, you can express changes to your service using the `@added` and `@removed` decorators. Here's an example of adding a new property to `Widget` and removing an old one:
@@ -425,15 +425,15 @@ You can do a lot more with versioning decorators, so consult the `typespec-versi
425
425
 
426
426
  ### Using Azure.Core versions
427
427
 
428
- `typespec-azure-core` is a versioned TypeSpec library. This means that even as the TypeSpec portions of the typespec-azure-core library are updated, you can anchor each version of your spec to a [specific `Azure.Core` version](#library-versions). This is done by decorating your service namespace with the `@versionedDependency` decorator from the `typespec-versioning` library.
428
+ `typespec-azure-core` is a versioned TypeSpec library. This means that even as the TypeSpec portions of the typespec-azure-core library are updated, you can anchor each version of your spec to a [specific `Azure.Core` version](#library-versions). This is done by decorating your service namespace with the `@useDependency` decorator from the `typespec-versioning` library.
429
429
 
430
- Simple TypeSpec specs need only pass the desired `Azure.Core` version into the `@versionedDependency` decorator:
430
+ Simple TypeSpec specs need only pass the desired `Azure.Core` version into the `@useDependency` decorator:
431
431
 
432
432
  ```typespec
433
433
  @service({
434
434
  title: "Contoso Widget Manager",
435
435
  })
436
- @versionedDependency(Azure.Core.Versions.v1_0_Preview_2)
436
+ @useDependency(Azure.Core.Versions.v1_0_Preview_2)
437
437
  namespace Contoso.WidgetManager;
438
438
  ```
439
439
 
@@ -444,13 +444,15 @@ If your spec has [multiple versions](#versioning-your-service), you will need to
444
444
  title: "Contoso Widget Manager",
445
445
  })
446
446
  @versioned(Contoso.WidgetManager.Versions)
447
- @versionedDependency(
448
- [
449
- [Contoso.WidgetManager.Versions.v2022_08_31, Azure.Core.Versions.v1_0_Preview_2],
450
- [Contoso.WidgetManager.Versions.v2022_11_30, Azure.Core.Versions.v1_0_Preview_2]
451
- ]
452
- )
453
447
  namespace Contoso.WidgetManager;
448
+
449
+ enum Versions {
450
+ @useDependency(Azure.Core.Versions.v1_0_Preview_1)
451
+ v2022_08_31: "v20220831",
452
+
453
+ @useDependency(Azure.Core.Versions.v1_0_Preview_2)
454
+ v2022_11_30: "v20221130",
455
+ }
454
456
  ```
455
457
 
456
458
  ## Advanced Topics
@@ -493,13 +495,14 @@ The operations defined against this singleton resource will also exclude the key
493
495
 
494
496
  ## Library Versions
495
497
 
496
- This is a versioned TypeSpec library which means that you must add the `@versionedDependency` decorator to your service namespace when you use its contents.
498
+ This is a versioned TypeSpec library which means that you must add the `@useDependency` decorator to your service namespace when you use its contents.
497
499
 
498
500
  Here are the current versions:
499
501
 
502
+ - `Azure.Core.Versions.v1_0_Preview_1`
500
503
  - `Azure.Core.Versions.v1_0_Preview_2`
501
504
 
502
- See the [Using Azure.Core Versions](#using-azurecore-versions) section for more details on how to use the `@versionedDependency` decorator.
505
+ See the [Using Azure.Core Versions](#using-azurecore-versions) section for more details on how to use the `@useDependency` decorator.
503
506
 
504
507
  ## Library Tour
505
508
 
package/lib/models.tsp CHANGED
@@ -64,7 +64,9 @@ model MaxPageSizeQueryParameter {
64
64
 
65
65
  @doc("Provides the standard 'orderby' query parameter for list operations.")
66
66
  model OrderByQueryParameter {
67
- @query
67
+ @query({
68
+ format: "multi",
69
+ })
68
70
  @doc("Expressions that specify the order of returned results.")
69
71
  orderby?: string[];
70
72
  }
@@ -78,14 +80,18 @@ model FilterQueryParameter {
78
80
 
79
81
  @doc("Provides the standard 'select' query parameter for list operations.")
80
82
  model SelectQueryParameter {
81
- @query
83
+ @query({
84
+ format: "multi",
85
+ })
82
86
  @doc("Select the specified fields to be included in the response.")
83
87
  select?: string[];
84
88
  }
85
89
 
86
90
  @doc("Provides the standard 'expand' query parameter for list operations.")
87
91
  model ExpandQueryParameter {
88
- @query
92
+ @query({
93
+ format: "multi",
94
+ })
89
95
  @doc("Expand the indicated resources into the response.")
90
96
  expand?: string[];
91
97
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azure-tools/typespec-azure-core",
3
- "version": "0.28.0",
3
+ "version": "0.29.0-dev.2",
4
4
  "author": "Microsoft Corporation",
5
5
  "description": "TypeSpec Azure Core library",
6
6
  "homepage": "https://azure.github.io/typespec-azure",
@@ -42,21 +42,21 @@
42
42
  "!dist/test/**"
43
43
  ],
44
44
  "peerDependencies": {
45
- "@typespec/compiler": "~0.42.0",
46
- "@typespec/http": "~0.42.0",
47
- "@typespec/rest": "~0.42.0"
45
+ "@typespec/compiler": ">=0.42.0",
46
+ "@typespec/http": ">=0.42.0",
47
+ "@typespec/rest": ">=0.42.0"
48
48
  },
49
49
  "dependencies": {
50
- "@typespec/lint": "~0.42.0"
50
+ "@typespec/lint": ">=0.42.0"
51
51
  },
52
52
  "devDependencies": {
53
- "@typespec/compiler": "~0.42.0",
54
- "@typespec/http": "~0.42.0",
55
- "@typespec/rest": "~0.42.0",
56
- "@typespec/eslint-config-typespec": "~0.6.0",
57
- "@typespec/library-linter": "~0.42.0",
58
- "@typespec/eslint-plugin": "~0.42.0",
59
- "@typespec/versioning": "~0.42.0",
53
+ "@typespec/compiler": ">=0.42.0",
54
+ "@typespec/http": ">=0.42.0",
55
+ "@typespec/rest": ">=0.42.0",
56
+ "@typespec/eslint-config-typespec": ">=0.6.0",
57
+ "@typespec/library-linter": ">=0.42.0",
58
+ "@typespec/eslint-plugin": ">=0.42.0",
59
+ "@typespec/versioning": ">=0.42.0",
60
60
  "@types/mocha": "~10.0.0",
61
61
  "@types/node": "~18.11.9",
62
62
  "eslint": "^8.12.0",