@@ -5409,4 +5409,98 @@ public void testTicket4878() {
5409
5409
SerializationMatchers .assertEqualsToYaml31 (openAPI , yaml );
5410
5410
ModelConverters .reset ();
5411
5411
}
5412
+
5413
+ @ Test (description = "Test model resolution for global path parameters with openAPI 3.1" )
5414
+ public void testTicket4907 () {
5415
+ ModelConverters .reset ();
5416
+
5417
+ // openAPI31 true and no other config
5418
+ SwaggerConfiguration config = new SwaggerConfiguration ().openAPI31 (true );
5419
+ Reader reader = new Reader (config );
5420
+ OpenAPI openAPI = reader .read (Ticket4878Resource .class );
5421
+ String yaml = "openapi: 3.1.0\n " +
5422
+ "paths:\n " +
5423
+ " /{globalPathParam}/{localPathParam}:\n " +
5424
+ " get:\n " +
5425
+ " operationId: getMethod\n " +
5426
+ " parameters:\n " +
5427
+ " - name: globalPathParam\n " +
5428
+ " in: path\n " +
5429
+ " required: true\n " +
5430
+ " schema:\n " +
5431
+ " type: string\n " +
5432
+ " $comment: 3.1 property for global path param\n " +
5433
+ " - name: localPathParam\n " +
5434
+ " in: path\n " +
5435
+ " required: true\n " +
5436
+ " schema:\n " +
5437
+ " type: string\n " +
5438
+ " $comment: 3.1 property for local path param\n " +
5439
+ " responses:\n " +
5440
+ " default:\n " +
5441
+ " description: default response\n " +
5442
+ " content:\n " +
5443
+ " '*/*': {}\n " ;
5444
+ SerializationMatchers .assertEqualsToYaml31 (openAPI , yaml );
5445
+
5446
+ // openAPI31 true and openAPI set
5447
+ config .setOpenAPI (new OpenAPI ().openapi ("3.1.1" ));
5448
+ reader = new Reader (config );
5449
+ openAPI = reader .read (Ticket4878Resource .class );
5450
+ yaml = "openapi: 3.1.1\n " +
5451
+ "paths:\n " +
5452
+ " /{globalPathParam}/{localPathParam}:\n " +
5453
+ " get:\n " +
5454
+ " operationId: getMethod\n " +
5455
+ " parameters:\n " +
5456
+ " - name: globalPathParam\n " +
5457
+ " in: path\n " +
5458
+ " required: true\n " +
5459
+ " schema:\n " +
5460
+ " type: string\n " +
5461
+ " $comment: 3.1 property for global path param\n " +
5462
+ " - name: localPathParam\n " +
5463
+ " in: path\n " +
5464
+ " required: true\n " +
5465
+ " schema:\n " +
5466
+ " type: string\n " +
5467
+ " $comment: 3.1 property for local path param\n " +
5468
+ " responses:\n " +
5469
+ " default:\n " +
5470
+ " description: default response\n " +
5471
+ " content:\n " +
5472
+ " '*/*': {}\n " ;
5473
+ SerializationMatchers .assertEqualsToYaml31 (openAPI , yaml );
5474
+
5475
+ // openAPI31 true and openAPIVersion set
5476
+ config .setOpenAPI (null );
5477
+ config .setOpenAPIVersion ("3.1.1" );
5478
+ reader = new Reader (config );
5479
+ openAPI = reader .read (Ticket4878Resource .class );
5480
+ yaml = "openapi: 3.1.1\n " +
5481
+ "paths:\n " +
5482
+ " /{globalPathParam}/{localPathParam}:\n " +
5483
+ " get:\n " +
5484
+ " operationId: getMethod\n " +
5485
+ " parameters:\n " +
5486
+ " - name: globalPathParam\n " +
5487
+ " in: path\n " +
5488
+ " required: true\n " +
5489
+ " schema:\n " +
5490
+ " type: string\n " +
5491
+ " $comment: 3.1 property for global path param\n " +
5492
+ " - name: localPathParam\n " +
5493
+ " in: path\n " +
5494
+ " required: true\n " +
5495
+ " schema:\n " +
5496
+ " type: string\n " +
5497
+ " $comment: 3.1 property for local path param\n " +
5498
+ " responses:\n " +
5499
+ " default:\n " +
5500
+ " description: default response\n " +
5501
+ " content:\n " +
5502
+ " '*/*': {}\n " ;
5503
+ SerializationMatchers .assertEqualsToYaml31 (openAPI , yaml );
5504
+ ModelConverters .reset ();
5505
+ }
5412
5506
}
0 commit comments