File tree Expand file tree Collapse file tree 4 files changed +125
-0
lines changed
additions/info-object-summary-field Expand file tree Collapse file tree 4 files changed +125
-0
lines changed Original file line number Diff line number Diff line change
1
+ # OpenAPI 3.1 tests
2
+
3
+ This directory contains tests for changes that made it into [ OpenAPI 3.1 specification] ( https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md ) .
4
+ Changes are categorized into 4 distinct groups:
5
+
6
+ - ** Additions**
7
+ - ** Changes**
8
+ - ** Extended Functionality**
9
+ - ** Breaking Changes**
10
+
11
+ All changes are documented in OpenAPI 3.1 [ changelog] ( https://github.com/OAI/OpenAPI-Specification/pull/2251 ) .
Original file line number Diff line number Diff line change
1
+ {
2
+ "openapi" : " 3.0.0" ,
3
+ "info" : {
4
+ "title" : " Testing API" ,
5
+ "summary" : " info object summary" ,
6
+ "version" : " 1.0.0"
7
+ },
8
+ "components" : {
9
+ "schemas" : {
10
+ "user" : {
11
+ "properties" : {
12
+ "id" : {
13
+ "type" : " integer"
14
+ }
15
+ }
16
+ }
17
+ }
18
+ },
19
+ "servers" : [
20
+ {
21
+ "url" : " http://localhost:8080"
22
+ }
23
+ ],
24
+ "paths" : {
25
+ "/users" : {
26
+ "get" : {
27
+ "operationId" : " getUserList" ,
28
+ "description" : " Get list of users" ,
29
+ "responses" : {
30
+ "200" : {
31
+ "description" : " List of users" ,
32
+ "content" : {
33
+ "application/json" : {
34
+ "schema" : {
35
+ "$ref" : " #/components/schemas/user"
36
+ }
37
+ }
38
+ }
39
+ }
40
+ }
41
+ }
42
+ }
43
+ }
44
+ }
Original file line number Diff line number Diff line change
1
+ {
2
+ "openapi" : " 3.0.0" ,
3
+ "info" : {
4
+ "title" : " Testing API" ,
5
+ "version" : " 1.0.0"
6
+ },
7
+ "components" : {
8
+ "schemas" : {
9
+ "user" : {
10
+ "properties" : {
11
+ "id" : {
12
+ "type" : " integer"
13
+ }
14
+ }
15
+ }
16
+ }
17
+ },
18
+ "servers" : [
19
+ {
20
+ "url" : " http://localhost:8080"
21
+ }
22
+ ],
23
+ "paths" : {
24
+ "/users" : {
25
+ "get" : {
26
+ "operationId" : " getUserList" ,
27
+ "description" : " Get list of users" ,
28
+ "responses" : {
29
+ "200" : {
30
+ "description" : " List of users" ,
31
+ "content" : {
32
+ "application/json" : {
33
+ "schema" : {
34
+ "$ref" : " #/components/schemas/user"
35
+ }
36
+ }
37
+ }
38
+ }
39
+ }
40
+ }
41
+ }
42
+ }
43
+ }
Original file line number Diff line number Diff line change
1
+ import SwaggerClient from '../../../../src' ;
2
+
3
+ describe ( 'OpenAPI Specification 3.1' , ( ) => {
4
+ describe ( 'InfoObject.summary' , ( ) => {
5
+ describe ( 'given definition without summary field' , ( ) => {
6
+ const spec = require ( './data/without-field.json' ) ;
7
+
8
+ test ( 'should not contain summary field in resolved spec' , async ( ) => {
9
+ const client = await new SwaggerClient ( { spec } ) ;
10
+
11
+ expect ( client . spec . info . summary ) . toBeUndefined ( ) ;
12
+ expect ( client . originalSpec . info . summary ) . toBeUndefined ( ) ;
13
+ } ) ;
14
+ } ) ;
15
+
16
+ describe ( 'given definition with summary field' , ( ) => {
17
+ const spec = require ( './data/with-field.json' ) ;
18
+
19
+ test ( 'should contain summary field in resolved spec' , async ( ) => {
20
+ const client = await new SwaggerClient ( { spec } ) ;
21
+
22
+ expect ( client . spec . info . summary ) . toStrictEqual ( 'info object summary' ) ;
23
+ expect ( client . originalSpec . info . summary ) . toStrictEqual ( 'info object summary' ) ;
24
+ } ) ;
25
+ } ) ;
26
+ } ) ;
27
+ } ) ;
You can’t perform that action at this time.
0 commit comments