Skip to content

Commit cc13c8b

Browse files
committed
add file content
1 parent c26c1d3 commit cc13c8b

File tree

1 file changed

+156
-0
lines changed
  • test/Microsoft.OpenApi.Readers.Tests/V31Tests/Samples

1 file changed

+156
-0
lines changed
Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
openapi: 3.1.0
2+
info:
3+
title: Sample OpenAPI 3.1 API
4+
description: A sample API demonstrating OpenAPI 3.1 features
5+
version: "2.0.0"
6+
summary: Sample OpenAPI 3.1 API with the latest features
7+
# JSON Schema 2020-12 features
8+
jsonSchemaDialect: "https://json-schema.org/draft/2020-12/schema"
9+
10+
servers:
11+
- url: https://api.example.com/v2
12+
description: Main production server
13+
14+
# Example Webhooks (OpenAPI 3.1 feature)
15+
webhooks:
16+
newPetAlert:
17+
post:
18+
summary: Notify about a new pet being added
19+
requestBody:
20+
required: true
21+
content:
22+
application/json:
23+
schema:
24+
$ref: '#/components/schemas/Pet'
25+
responses:
26+
'200':
27+
description: Webhook processed successfully
28+
paths:
29+
/pets:
30+
get:
31+
summary: List all pets
32+
operationId: listPets
33+
tags:
34+
- pets
35+
parameters:
36+
- name: limit
37+
in: query
38+
description: How many items to return at one time (max 100)
39+
required: false
40+
schema:
41+
type: integer
42+
minimum: 1
43+
maximum: 100
44+
responses:
45+
'200':
46+
description: A paged array of pets
47+
content:
48+
application/json:
49+
schema:
50+
$ref: '#/components/schemas/Pets'
51+
default:
52+
description: Unexpected error
53+
content:
54+
application/json:
55+
schema:
56+
$ref: '#/components/schemas/Error'
57+
post:
58+
summary: Create a new pet
59+
operationId: createPet
60+
tags:
61+
- pets
62+
requestBody:
63+
required: true
64+
content:
65+
application/json:
66+
schema:
67+
$ref: '#/components/schemas/NewPet'
68+
responses:
69+
'201':
70+
description: Pet created successfully
71+
default:
72+
description: Unexpected error
73+
content:
74+
application/json:
75+
schema:
76+
$ref: '#/components/schemas/Error'
77+
78+
/pets/{petId}:
79+
get:
80+
summary: Get details of a specific pet
81+
operationId: getPet
82+
tags:
83+
- pets
84+
parameters:
85+
- name: petId
86+
in: path
87+
required: true
88+
description: The ID of the pet to retrieve
89+
schema:
90+
type: string
91+
responses:
92+
'200':
93+
description: Pet details
94+
content:
95+
application/json:
96+
schema:
97+
$ref: '#/components/schemas/Pet'
98+
default:
99+
description: Unexpected error
100+
content:
101+
application/json:
102+
schema:
103+
$ref: '#/components/schemas/Error'
104+
components:
105+
schemas:
106+
Pet:
107+
type: object
108+
required:
109+
- id
110+
- weight
111+
properties:
112+
id:
113+
type: string
114+
format: uuid
115+
weight:
116+
type: number
117+
exclusiveMinimum: 0
118+
description: Weight of the pet in kilograms
119+
# Pattern properties and Type array feature from JSON Schema
120+
attributes:
121+
type: [ object, "null"]
122+
description: Dynamic attributes for the pet
123+
patternProperties:
124+
"^attr_[A-Za-z]+$":
125+
type: string
126+
$comment: "This schema represents a pet in the system."
127+
$defs:
128+
ExtraInfo:
129+
type: string
130+
131+
NewPet:
132+
allOf:
133+
- $ref: '#/components/schemas/Pet'
134+
- description: A pet to be added to the store
135+
- required:
136+
- id
137+
138+
Pets:
139+
type: array
140+
items:
141+
$ref: '#/components/schemas/Pet'
142+
143+
Error:
144+
type: object
145+
properties:
146+
code:
147+
type: integer
148+
message:
149+
type: string
150+
151+
security:
152+
- api_key: []
153+
154+
tags:
155+
- name: pets
156+
description: Everything about your pets

0 commit comments

Comments
 (0)