Skip to content

Commit 69b482d

Browse files
committed
yaml: add several OpenAPI features
1 parent f3da80e commit 69b482d

File tree

4 files changed

+314
-18
lines changed

4 files changed

+314
-18
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,30 @@
1+
title input.yaml /^ title: test$/;" I
2+
description input.yaml /^ description: test$/;" I
3+
version input.yaml /^ version: '1.0'$/;" I
4+
http://example.com input.yaml /^ - url: http:\/\/example.com$/;" S
5+
http://example2.com input.yaml /^ - url: http:\/\/example2.com$/;" S
16
/sample/path input.yaml /^ \/sample\/path:$/;" p
27
/sample/other/path input.yaml /^ \/sample\/other\/path:$/;" p
38
NullableField input.yaml /^ NullableField:$/;" d
49
NullableFieldStringEnum input.yaml /^ NullableFieldStringEnum:$/;" d
510
CustomHeader input.yaml /^ CustomHeader:$/;" P
611
Response1 input.yaml /^ Response1:$/;" R
712
Response2 input.yaml /^ Response2:$/;" R
13+
Example1 input.yaml /^ Example1:$/;" e
14+
Example2 input.yaml /^ Example2:$/;" e
15+
Body1 input.yaml /^ Body1:$/;" B
16+
Body2 input.yaml /^ Body2:$/;" B
17+
Header1 input.yaml /^ Header1:$/;" h
18+
Header2 input.yaml /^ Header2:$/;" h
19+
SSchema1 input.yaml /^ SSchema1:$/;" C
20+
SSchema2 input.yaml /^ SSchema2:$/;" C
21+
Link1 input.yaml /^ Link1: {}$/;" l
22+
Link2 input.yaml /^ Link2: {}$/;" l
23+
Callback1 input.yaml /^ Callback1: {}$/;" c
24+
Callback2 input.yaml /^ Callback2: {}$/;" c
25+
PathItem1 input.yaml /^ PathItem1: {}$/;" A
26+
PathItem2 input.yaml /^ PathItem2: {}$/;" A
27+
SomeApiKey input.yaml /^ - SomeApiKey:$/;" s
28+
android_handler input.yaml /^ - name: android_handler$/;" t
29+
ios_handler input.yaml /^ - name: ios_handler$/;" t
30+
http://example.com input.yaml /^ url: http:\/\/example.com$/;" D

Units/parser-openapi.r/openapi.d/input.yaml

+65-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
openapi: 3.0.0
1+
openapi: 3.1.0
22
info:
33
title: test
44
description: test
@@ -7,6 +7,8 @@ info:
77
servers:
88
- url: http://example.com
99
description: production
10+
- url: http://example2.com
11+
description: testing
1012

1113
paths:
1214
/sample/path:
@@ -53,3 +55,65 @@ components:
5355
schema:
5456
type: object
5557
properties: {}
58+
examples:
59+
Example1:
60+
summary: xxx
61+
value: yyyyy
62+
Example2:
63+
summary: xxx
64+
value: yyyyy
65+
requestBodies:
66+
Body1:
67+
description: bla bla bla
68+
content:
69+
application/json:
70+
schema:
71+
type: string
72+
Body2:
73+
description: bla bla bla
74+
content:
75+
application/json:
76+
schema:
77+
type: integer
78+
headers:
79+
Header1:
80+
schema:
81+
type: string
82+
Header2:
83+
schema:
84+
type: string
85+
securitySchemes:
86+
SSchema1:
87+
type: http
88+
scheme: basic
89+
SSchema2:
90+
type: http
91+
scheme: basic
92+
links:
93+
Link1: {}
94+
Link2: {}
95+
callbacks:
96+
Callback1: {}
97+
Callback2: {}
98+
# pathItems is allowed in 3.1.0
99+
pathItems:
100+
PathItem1: {}
101+
PathItem2: {}
102+
103+
104+
105+
security:
106+
- {}
107+
- SomeApiKey:
108+
- foo:read
109+
- foo:write
110+
111+
tags:
112+
- name: android_handler
113+
description: Handler for Android clients
114+
- name: ios_handler
115+
description: Handler for iOS clients
116+
117+
externalDocs:
118+
description: some docs
119+
url: http://example.com

Units/parser-openapi.r/swagger.d/expected.tags

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
description input.yaml /^ description: test$/;" I
2+
title input.yaml /^ title: test$/;" I
3+
version input.yaml /^ version: '1.0'$/;" I
14
/sample/path input.yaml /^ \/sample\/path:$/;" p
25
/sample/other/path input.yaml /^ \/sample\/other\/path:$/;" p
36
PolymorphicString input.yaml /^ PolymorphicString:$/;" d

0 commit comments

Comments
 (0)