Skip to content

Commit

Permalink
yaml: add several OpenAPI features
Browse files Browse the repository at this point in the history
  • Loading branch information
segoon committed Jan 6, 2022
1 parent f3da80e commit 69b482d
Show file tree
Hide file tree
Showing 4 changed files with 314 additions and 18 deletions.
23 changes: 23 additions & 0 deletions Units/parser-openapi.r/openapi.d/expected.tags
Original file line number Diff line number Diff line change
@@ -1,7 +1,30 @@
title input.yaml /^ title: test$/;" I
description input.yaml /^ description: test$/;" I
version input.yaml /^ version: '1.0'$/;" I
http://example.com input.yaml /^ - url: http:\/\/example.com$/;" S
http://example2.com input.yaml /^ - url: http:\/\/example2.com$/;" S
/sample/path input.yaml /^ \/sample\/path:$/;" p
/sample/other/path input.yaml /^ \/sample\/other\/path:$/;" p
NullableField input.yaml /^ NullableField:$/;" d
NullableFieldStringEnum input.yaml /^ NullableFieldStringEnum:$/;" d
CustomHeader input.yaml /^ CustomHeader:$/;" P
Response1 input.yaml /^ Response1:$/;" R
Response2 input.yaml /^ Response2:$/;" R
Example1 input.yaml /^ Example1:$/;" e
Example2 input.yaml /^ Example2:$/;" e
Body1 input.yaml /^ Body1:$/;" B
Body2 input.yaml /^ Body2:$/;" B
Header1 input.yaml /^ Header1:$/;" h
Header2 input.yaml /^ Header2:$/;" h
SSchema1 input.yaml /^ SSchema1:$/;" C
SSchema2 input.yaml /^ SSchema2:$/;" C
Link1 input.yaml /^ Link1: {}$/;" l
Link2 input.yaml /^ Link2: {}$/;" l
Callback1 input.yaml /^ Callback1: {}$/;" c
Callback2 input.yaml /^ Callback2: {}$/;" c
PathItem1 input.yaml /^ PathItem1: {}$/;" A
PathItem2 input.yaml /^ PathItem2: {}$/;" A
SomeApiKey input.yaml /^ - SomeApiKey:$/;" s
android_handler input.yaml /^ - name: android_handler$/;" t
ios_handler input.yaml /^ - name: ios_handler$/;" t
http://example.com input.yaml /^ url: http:\/\/example.com$/;" D
66 changes: 65 additions & 1 deletion Units/parser-openapi.r/openapi.d/input.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
openapi: 3.0.0
openapi: 3.1.0
info:
title: test
description: test
Expand All @@ -7,6 +7,8 @@ info:
servers:
- url: http://example.com
description: production
- url: http://example2.com
description: testing

paths:
/sample/path:
Expand Down Expand Up @@ -53,3 +55,65 @@ components:
schema:
type: object
properties: {}
examples:
Example1:
summary: xxx
value: yyyyy
Example2:
summary: xxx
value: yyyyy
requestBodies:
Body1:
description: bla bla bla
content:
application/json:
schema:
type: string
Body2:
description: bla bla bla
content:
application/json:
schema:
type: integer
headers:
Header1:
schema:
type: string
Header2:
schema:
type: string
securitySchemes:
SSchema1:
type: http
scheme: basic
SSchema2:
type: http
scheme: basic
links:
Link1: {}
Link2: {}
callbacks:
Callback1: {}
Callback2: {}
# pathItems is allowed in 3.1.0
pathItems:
PathItem1: {}
PathItem2: {}



security:
- {}
- SomeApiKey:
- foo:read
- foo:write

tags:
- name: android_handler
description: Handler for Android clients
- name: ios_handler
description: Handler for iOS clients

externalDocs:
description: some docs
url: http://example.com
3 changes: 3 additions & 0 deletions Units/parser-openapi.r/swagger.d/expected.tags
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
description input.yaml /^ description: test$/;" I
title input.yaml /^ title: test$/;" I
version input.yaml /^ version: '1.0'$/;" I
/sample/path input.yaml /^ \/sample\/path:$/;" p
/sample/other/path input.yaml /^ \/sample\/other\/path:$/;" p
PolymorphicString input.yaml /^ PolymorphicString:$/;" d
Expand Down
Loading

0 comments on commit 69b482d

Please sign in to comment.