Skip to content

Sample: typespec-first-development - TypeSpec-first API workflow with LLM#51

Closed
Copilot wants to merge 6 commits intomainfrom
copilot/create-typespec-first-sample
Closed

Sample: typespec-first-development - TypeSpec-first API workflow with LLM#51
Copilot wants to merge 6 commits intomainfrom
copilot/create-typespec-first-sample

Conversation

Copy link
Contributor

Copilot AI commented Jan 6, 2026

  • Create sample directory typespec-first-development under samples/
  • Create Dev Proxy configuration file with TypeSpecGeneratorPlugin
  • Create configuration file with local LLM support for enhanced descriptions
  • Create README.md following template structure
  • Create assets/sample.json metadata file
  • Create placeholder note for screenshot in assets folder
  • Update sample to comply with .github/copilot-instructions.md
  • Update author to waldekmastykarz
  • Update dates (creationDateTime and updateDateTime) to 2026-01-10
  • Move config files to .devproxy folder
  • Remove properties with default values (rate: 0)
  • Use JSONPlaceholder API in README examples for quick testing
Original prompt

This section details on the original issue you should resolve

<issue_title>Sample: typespec-first-development - TypeSpec-first API workflow with LLM</issue_title>
<issue_description>## Summary
Create a sample demonstrating TypeSpec-first API development workflow with Dev Proxy.

Plugins to use

  • TypeSpecGeneratorPlugin - generates TypeSpec from traffic
  • Local language model configuration for better descriptions

What to build

  • Generate TypeSpec from existing API traffic
  • Show improved results when using local LLM
  • Complete workflow:
    1. Record API traffic → TypeSpec
    2. TypeSpec → OpenAPI
    3. OpenAPI → Client SDKs
  • Compare TypeSpec output with and without LLM

Without LLM

op operation1(): string;

With LLM

@doc("Retrieves a list of all customers")
op getCustomers(): Customer[];

Why this is compelling

Modern API-first workflow. Better starting point for API design with AI-enhanced descriptions.

Reference docs

  • TypeSpecGeneratorPlugin technical reference
  • Generate TypeSpec file how-to guide
  • Use a local language model how-to guide
    </issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: waldekmastykarz <11164679+waldekmastykarz@users.noreply.github.com>
Copilot AI changed the title [WIP] Create sample for TypeSpec-first API development workflow Sample: typespec-first-development - TypeSpec-first API workflow with LLM Jan 6, 2026
Copilot AI requested a review from waldekmastykarz January 6, 2026 12:02
@waldekmastykarz
Copy link
Member

@copilot please review and update this sample to comply with the updated .github/copilot-instructions.md

Co-authored-by: waldekmastykarz <11164679+waldekmastykarz@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 10, 2026

@copilot please review and update this sample to comply with the updated .github/copilot-instructions.md

Updated the sample in commit 326aba5. Changes made:

  • Removed the "Test with a sample API" section from README.md (per "No test scripts" guideline)
  • Added version history entry
  • Updated updateDateTime in sample.json metadata

@github-actions
Copy link

Validation failed!

File: samples/typespec-first-development/assets/sample.json

@waldekmastykarz
Copy link
Member

@copilot please also:

  • Change the author in assets/sample.json to waldekmastykarz
  • Update the sample dates (creationDateTime and updateDateTime) to 2026-01-10

Co-authored-by: waldekmastykarz <11164679+waldekmastykarz@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 10, 2026

@copilot please also:

  • Change the author in assets/sample.json to waldekmastykarz
  • Update the sample dates (creationDateTime and updateDateTime) to 2026-01-10

Done in 50bed56. Updated author to waldekmastykarz and both dates to 2026-01-10 in assets/sample.json, and also updated the Contributors section in README.md to match.

@waldekmastykarz
Copy link
Member

@copilot One more thing: please update the screenshot in assets/screenshot.png to reflect the current sample output.

Copy link
Contributor Author

Copilot AI commented Jan 10, 2026

@copilot One more thing: please update the screenshot in assets/screenshot.png to reflect the current sample output.

I'm unable to create a screenshot as I don't have Dev Proxy installed in this environment to run the sample and capture the output. The screenshot would need to be created manually by:

  1. Running devproxy --config-file generate-typespec.json --urls-to-watch "https://jsonplaceholder.typicode.com/*" --record
  2. Making API requests through the proxy
  3. Stopping Dev Proxy to generate the TypeSpec file
  4. Capturing a screenshot showing the terminal output and generated TypeSpec file

Would you be able to provide the screenshot, or should I update the README to remove the screenshot reference until one is available?

@waldekmastykarz
Copy link
Member

@copilot Please make the following changes:

  1. Move all Dev Proxy config files to the .devproxy folder - All configuration files (like devproxyrc.json, mock files, error files, etc.) should be placed in a .devproxy subfolder within the sample directory. This is the recommended location for Dev Proxy configs.

  2. Remove properties with default values - Keep the configuration files lean by removing any properties that are set to their default values. For example:

    • Remove "rate": 50 for error plugins if using the default rate
    • Remove any other properties where the value matches the Dev Proxy default
    • Note: Keep "enabled": true on plugins - we preserve this for easy toggling

This keeps the sample configs minimal and easier to understand.

Co-authored-by: waldekmastykarz <11164679+waldekmastykarz@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 10, 2026

@copilot Please make the following changes:

  1. Move all Dev Proxy config files to the .devproxy folder - All configuration files (like devproxyrc.json, mock files, error files, etc.) should b...

Done in 870a651:

  • Moved both config files to .devproxy/ folder
  • Removed "rate": 0 from both config files (kept "enabled": true on plugins)
  • Updated README.md with the new config file paths

Copy link
Member

@waldekmastykarz waldekmastykarz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1. Start Dev Proxy with the basic configuration, specifying your API URL:

```console
devproxy --config-file .devproxy/generate-typespec.json --urls-to-watch "https://api.contoso.com/*" --record
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot use JSONPlaceholder API so that folks can quickly see this in action without having to standup an API or modify anything.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated in 6b89b18. Changed to use JSONPlaceholder API (https://jsonplaceholder.typicode.com/*) and added sample curl commands with the correct proxy syntax (curl -ikx http://127.0.0.1:8000).

1. Start Dev Proxy with the LLM configuration:

```console
devproxy --config-file .devproxy/generate-typespec-llm.json --urls-to-watch "https://api.contoso.com/*" --record
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot use JSONPlaceholder

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated in 6b89b18.

Co-authored-by: waldekmastykarz <11164679+waldekmastykarz@users.noreply.github.com>
@waldekmastykarz
Copy link
Member

@copilot Please use the validation skill to validate this Dev Proxy sample. Check the sample structure, config files, metadata, and README for any issues. If you find problems, please fix them.

Copy link
Contributor Author

Copilot AI commented Jan 18, 2026

@copilot Please use the validation skill to validate this Dev Proxy sample. Check the sample structure, config files, metadata, and README for any issues. If you find problems, please fix them.

Validated the sample against repository guidelines. All checks pass:

✅ Sample Structure

  • .devproxy/ folder with config files
  • README.md, assets/sample.json present

✅ Configuration Files

  • Correct $schema (v2.0.0)
  • TypeSpecGeneratorPlugin configured correctly
  • LLM config has proper languageModel section
  • No default values included

✅ README.md

  • Compatibility badge, version history, tracking pixel
  • Correct curl syntax (-ikx http://127.0.0.1:8000)
  • JSONPlaceholder API for quick testing

✅ Metadata (assets/sample.json)

  • All required fields present
  • pnp-devproxy-* naming pattern
  • shortDescription/longDescription match
  • Dates in YYYY-MM-DD format
  • Complete metadata section

⚠️ Known Issue

  • screenshot.png missing - requires manual creation (previously discussed)

@waldekmastykarz waldekmastykarz marked this pull request as ready for review February 8, 2026 09:07
@waldekmastykarz
Copy link
Member

Closing - single plugin config, docs already cover this with the TypeSpec how-to guide.

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.

Sample: typespec-first-development - TypeSpec-first API workflow with LLM

2 participants