Skip to content

Examples#3572

Merged
timotheeguerin merged 28 commits into
microsoft:mainfrom
timotheeguerin:examples
Jul 16, 2024
Merged

Examples#3572
timotheeguerin merged 28 commits into
microsoft:mainfrom
timotheeguerin:examples

Conversation

@timotheeguerin

@timotheeguerin timotheeguerin commented Jun 12, 2024

Copy link
Copy Markdown
Member

Fix #2700 Add support for @example and @opExample

Playground demo

@timotheeguerin timotheeguerin marked this pull request as draft June 12, 2024 20:37
@azure-sdk

azure-sdk commented Jun 12, 2024

Copy link
Copy Markdown
Collaborator

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
Copy Markdown
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/

Comment thread packages/openapi3/src/schema-emitter.ts
Comment thread .chronus/changes/examples-2024-5-14-18-46-26.md
@timotheeguerin timotheeguerin marked this pull request as ready for review July 1, 2024 17:02
Comment thread packages/compiler/lib/std/decorators.tsp Outdated
Comment thread packages/compiler/src/lib/examples.ts
Comment thread packages/compiler/test/decorators/examples.test.ts
Comment thread packages/compiler/lib/std/decorators.tsp Outdated
Comment thread packages/compiler/lib/std/decorators.tsp Outdated
Comment thread packages/compiler/src/lib/examples.ts
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>
@timotheeguerin timotheeguerin enabled auto-merge July 16, 2024 17:53
@azure-sdk

Copy link
Copy Markdown
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
@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