-
Notifications
You must be signed in to change notification settings - Fork 285
draft, add smoke-http-specs for smoke tests #6981
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
weidongxu-microsoft
wants to merge
9
commits into
microsoft:main
from
weidongxu-microsoft:draft_smoke-http-specs
Closed
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
680dcb4
add smoke-http-specs
weidongxu-microsoft a37e309
changelog
weidongxu-microsoft 02abe1f
change to peerDependencies, as what is done in http-specs
weidongxu-microsoft 4df1ae0
update lock
weidongxu-microsoft 9650f8b
spelling
weidongxu-microsoft 92adb1b
start with alpha.0 as unreleased
weidongxu-microsoft d3fea4c
missed tsconfig.build.json
weidongxu-microsoft a231d06
Merge branch 'main' into draft_smoke-http-specs
weidongxu-microsoft 59e3e76
Merge branch 'main' into draft_smoke-http-specs
weidongxu-microsoft File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,7 @@ | ||
--- | ||
changeKind: feature | ||
packages: | ||
- "@typespec/smoke-http-specs" | ||
--- | ||
|
||
Add smoke-http-specs for smoke test |
This file contains hidden or 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,16 @@ | ||
# Smoke Http Specs | ||
|
||
This package contains all the scenarios that should be supported by a client & service generator. | ||
|
||
## Development | ||
|
||
1. [FOLLOW THE MONOREPO INSTRUCTION](https://github.com/microsoft/typespec) to get the environment setup. | ||
2. Scenarios should be in `./specs` folder | ||
|
||
#### Update version for release | ||
|
||
```bash | ||
pnpm change version --only "@typespec/smoke-http-specs" | ||
``` | ||
|
||
Push the changes in branch named after the pattern `publish/xyz`. Once merged, the package will be auto-released. |
This file contains hidden or 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,33 @@ | ||
{ | ||
"name": "@typespec/smoke-http-specs", | ||
"version": "0.1.0-alpha.0", | ||
"description": "Spec scenarios for smoke tests", | ||
"main": "dist/index.js", | ||
"type": "module", | ||
"scripts": { | ||
"watch": "tsc -p ./tsconfig.build.json --watch", | ||
"build": "tsc -p ./tsconfig.build.json", | ||
"clean": "rimraf dist/ temp/", | ||
"ci": "prettier specs --write", | ||
"test": "echo \"Error: no test specified\"" | ||
}, | ||
"engines": { | ||
"node": ">=20.0.0" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/microsoft/typespec.git" | ||
}, | ||
"author": "Microsoft", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/microsoft/typespec/issues" | ||
}, | ||
"homepage": "https://github.com/microsoft/typespec#readme", | ||
"peerDependencies": { | ||
"@typespec/compiler": "workspace:^", | ||
"@typespec/http": "workspace:^", | ||
"@typespec/rest": "workspace:^", | ||
"@typespec/versioning": "workspace:^" | ||
} | ||
} |
This file contains hidden or 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,96 @@ | ||
import "@typespec/rest"; | ||
import "@typespec/openapi"; | ||
|
||
@service(#{ title: "Pet Store Service" }) | ||
namespace PetStore; | ||
|
||
using TypeSpec.Http; | ||
using TypeSpec.Rest; | ||
using TypeSpec.Rest.Resource; | ||
|
||
@error | ||
model PetStoreError { | ||
code: int32; | ||
message: string; | ||
} | ||
|
||
@resource("pets") | ||
model Pet { | ||
@key("petId") | ||
id: int32; | ||
|
||
name: string; | ||
tag?: string; | ||
|
||
@minValue(0) | ||
@maxValue(20) | ||
age: int32; | ||
|
||
ownerId: int64; | ||
} | ||
|
||
@resource("toys") | ||
@parentResource(Pet) | ||
model Toy { | ||
@key("toyId") | ||
id: int64; | ||
|
||
petId: int64; | ||
name: string; | ||
} | ||
|
||
@resource("owners") | ||
model Owner { | ||
@key("ownerId") | ||
id: int64; | ||
|
||
name: string; | ||
age: int32; | ||
} | ||
|
||
@resource("checkups") | ||
model Checkup { | ||
@key("checkupId") | ||
id: int32; | ||
|
||
vetName: string; | ||
notes: string; | ||
} | ||
|
||
@segment("insurance") | ||
model Insurance { | ||
provider: string; | ||
premium: int32; | ||
deductible: int32; | ||
} | ||
|
||
interface Pets extends ResourceOperations<Pet, PetStoreError> {} | ||
|
||
interface PetCheckups | ||
extends ExtensionResourceCreateOrUpdate<Checkup, Pet, PetStoreError>, | ||
ExtensionResourceList<Checkup, Pet, PetStoreError> {} | ||
|
||
interface PetInsurance extends SingletonResourceOperations<Insurance, Pet, PetStoreError> {} | ||
|
||
interface Toys extends ResourceRead<Toy, PetStoreError> { | ||
@autoRoute | ||
@listsResource(Toy) | ||
list( | ||
...ParentKeysOf<Toy>, | ||
@query nameFilter: string, | ||
): CollectionWithNextLink<Toy> | PetStoreError; | ||
} | ||
|
||
interface ToyInsurance extends SingletonResourceOperations<Insurance, Toy, PetStoreError> {} | ||
|
||
interface Checkups | ||
extends ResourceCreateOrUpdate<Checkup, PetStoreError>, | ||
ResourceList<Checkup, PetStoreError> {} | ||
|
||
interface Owners extends ResourceOperations<Owner, PetStoreError> {} | ||
|
||
interface OwnerCheckups | ||
extends ExtensionResourceCreateOrUpdate<Checkup, Owner, PetStoreError>, | ||
ExtensionResourceList<Checkup, Owner, PetStoreError> {} | ||
|
||
interface OwnerInsurance extends SingletonResourceOperations<Insurance, Owner, PetStoreError> {} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is the goal of this probject to have the samples we talked about a while ago that every emitter could share?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was to include the samples from typespec-e2e.
We've agreed that they should not be spector case. The issue chose to call them smoke test.
I haven't figured out with Allen on what is the best approach is, for matching a generated client and a generated (+handwritten) server for e2e test.
But here I first want to see if I can at least pack the tsp files, so each client can get the lib, generate the code from them, compile/lint the code, as a simpler verification.
Let me know your opinon.