Skip to content
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

Examples #3572

Merged
merged 28 commits into from
Jul 16, 2024
Merged

Examples #3572

merged 28 commits into from
Jul 16, 2024

Conversation

timotheeguerin
Copy link
Member

@timotheeguerin timotheeguerin commented Jun 12, 2024

Fix #2700 Add support for @example and @opExample

Playground demo

@azure-sdk
Copy link
Collaborator

azure-sdk commented Jun 12, 2024

All changed packages have been documented.

  • @typespec/compiler
  • @typespec/openapi3
Show changes

@typespec/openapi3 - feature ✏️

Add support for new @example and @opExample decorator

@typespec/compiler - feature ✏️

Add new @example and @opExample decorator to provide examples on types and operations.,> ,> tsp,> @example(#{,> id: "some",,> date: utcDateTime.fromISO("2020-01-01T00:00:00Z"),,> timeout: duration.fromISO("PT1M"),,> }),> model Foo {,> id: string;,> date: utcDateTime;,> ,> @encode("seconds", int32) timeout: duration;,> },> ,> ,> tsp,> @opExample(,> #{,> parameters: #{,> pet: #{,> id: "some",,> name: "Fluffy",,> dob: plainDate.fromISO("2020-01-01"),,> },,> },,> returnType: #{,> id: "some",,> name: "Fluffy",,> dob: plainDate.fromISO("2020-01-01"),,> },,> },,> #{ title: "First", description: "Show creating a pet" },> ),> op createPet(pet: Pet): Pet;,>

@azure-sdk
Copy link
Collaborator

You can try these changes at https://cadlplayground.z22.web.core.windows.net/prs/3572/

Check the website changes at https://tspwebsitepr.z22.web.core.windows.net/prs/3572/

@timotheeguerin timotheeguerin marked this pull request as ready for review July 1, 2024 17:02
timotheeguerin and others added 5 commits July 16, 2024 09:38
Co-authored-by: Brian Terlson <brian.terlson@microsoft.com>
Co-authored-by: Brian Terlson <brian.terlson@microsoft.com>
@azure-sdk
Copy link
Collaborator

You can try these changes here

🛝 Playground 🌐 Website 📚 Next docs

@timotheeguerin timotheeguerin added this pull request to the merge queue Jul 16, 2024
Merged via the queue into microsoft:main with commit fef3f01 Jul 16, 2024
22 checks passed
@timotheeguerin timotheeguerin deleted the examples branch July 16, 2024 19:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Examples
4 participants