Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 

README.md

Outline

Examples

This directory demonstrates how to use openapi-tools with the Swagger Pet Store specification.

The Pet Store spec is available at:

https://raw.githubusercontent.com/readmeio/oas-examples/main/3.1/yaml/petstore.yaml

Filtering Paths

You can filter the specification to only include certain paths. The example below selects all operations under /pet and writes them to filtered.yaml:

npx @ai-foundry/openapi-tools filter \
  --input https://raw.githubusercontent.com/readmeio/oas-examples/main/3.1/yaml/petstore.yaml \
  --output ./filtered.yaml \
  --select-paths "/pet"

Generate Zod Schemas

To generate Zod schemas for the same path prefix:

npx @ai-foundry/openapi-tools generate-zod \
  --input https://raw.githubusercontent.com/readmeio/oas-examples/main/3.1/yaml/petstore.yaml \
  --output ./models.ts \
  --select-paths "/pet"

Generate Python TypedDicts

To create Python TypedDict definitions:

npx @ai-foundry/openapi-tools generate-python-dict \
  --input https://raw.githubusercontent.com/readmeio/oas-examples/main/3.1/yaml/petstore.yaml \
  --output ./models.py \
  --select-paths "/pet"
Morty Proxy This is a proxified and sanitized view of the page, visit original site.