Skip to content

Commit 8b2a205

Browse files
authored
Merge pull request #8 from adrianhdezm/codex/add-examples-folder-for-cli-and-schemas
Add CLI examples
2 parents 2279da4 + 3415aa4 commit 8b2a205

1 file changed

Lines changed: 42 additions & 0 deletions

File tree

examples/README.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Examples
2+
3+
This directory demonstrates how to use **openapi-tools** with the Swagger Pet Store specification.
4+
5+
The Pet Store spec is available at:
6+
7+
```
8+
https://raw.githubusercontent.com/readmeio/oas-examples/main/3.1/yaml/petstore.yaml
9+
```
10+
11+
## Filtering Paths
12+
13+
You can filter the specification to only include certain paths. The example below selects all operations under `/pet` and writes them to `filtered.yaml`:
14+
15+
```bash
16+
npx @ai-foundry/openapi-tools filter \
17+
--input https://raw.githubusercontent.com/readmeio/oas-examples/main/3.1/yaml/petstore.yaml \
18+
--output ./filtered.yaml \
19+
--select-paths "/pet"
20+
```
21+
22+
## Generate Zod Schemas
23+
24+
To generate Zod schemas for the same path prefix:
25+
26+
```bash
27+
npx @ai-foundry/openapi-tools generate-zod \
28+
--input https://raw.githubusercontent.com/readmeio/oas-examples/main/3.1/yaml/petstore.yaml \
29+
--output ./zod \
30+
--select-paths "/pet"
31+
```
32+
33+
## Generate Python TypedDicts
34+
35+
To create Python `TypedDict` definitions:
36+
37+
```bash
38+
npx @ai-foundry/openapi-tools generate-python-dict \
39+
--input https://raw.githubusercontent.com/readmeio/oas-examples/main/3.1/yaml/petstore.yaml \
40+
--output ./typed-dict \
41+
--select-paths "/pet"
42+
```

0 commit comments

Comments
 (0)