-
Notifications
You must be signed in to change notification settings - Fork 232
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow unversioned project to select a specific version of a versioned…
… library (#346)
- Loading branch information
1 parent
3a96ddd
commit cada697
Showing
10 changed files
with
335 additions
and
122 deletions.
There are no files selected for viewing
10 changes: 10 additions & 0 deletions
10
common/changes/@cadl-lang/openapi3/pick-versioned-dependency_2022-03-21-18-42.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"changes": [ | ||
{ | ||
"packageName": "@cadl-lang/openapi3", | ||
"comment": "Uptake change to allow versioned dependency with unversioned service", | ||
"type": "minor" | ||
} | ||
], | ||
"packageName": "@cadl-lang/openapi3" | ||
} |
10 changes: 10 additions & 0 deletions
10
common/changes/@cadl-lang/versioning/pick-versioned-dependency_2022-03-21-18-42.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"changes": [ | ||
{ | ||
"packageName": "@cadl-lang/versioning", | ||
"comment": "Enable ability to pick a specific version for a versioned dependency when service itself isn't versioned", | ||
"type": "minor" | ||
} | ||
], | ||
"packageName": "@cadl-lang/versioning" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
packages/samples/test/output/use-versioned-lib/openapi.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
{ | ||
"openapi": "3.0.0", | ||
"info": { | ||
"title": "Pet Store Service", | ||
"version": "0000-00-00" | ||
}, | ||
"tags": [], | ||
"paths": { | ||
"/": { | ||
"get": { | ||
"operationId": "VersionedApi_read", | ||
"parameters": [], | ||
"responses": { | ||
"200": { | ||
"description": "Ok", | ||
"content": { | ||
"application/json": { | ||
"schema": { | ||
"$ref": "#/components/schemas/Library.PetToy" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"components": { | ||
"schemas": { | ||
"Library.PetToy": { | ||
"type": "object", | ||
"properties": { | ||
"name": { | ||
"type": "string" | ||
} | ||
}, | ||
"required": [ | ||
"name" | ||
] | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import "@cadl-lang/versioning"; | ||
|
||
@versioned(VERSIONS) | ||
namespace Library; | ||
|
||
alias VERSIONS = "1.0" | "1.1"; | ||
|
||
model PetToy { | ||
name: string; | ||
|
||
@added("1.1") | ||
material: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import "@cadl-lang/versioning"; | ||
import "@cadl-lang/rest"; | ||
import "./library.cadl"; | ||
|
||
// Use version 1.0 of the Library | ||
@serviceTitle("Pet Store Service") | ||
@versionedDependency(Library, "1.0") | ||
namespace VersionedApi; | ||
using Cadl.Http; | ||
|
||
op read(): Library.PetToy; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.