eclipse / microprofile-starter

MicroProfile project generator source code
Apache License 2.0
74 stars 51 forks source link

Open Liberty printed out an error message for open api #413

Closed Emily-Jiang closed 3 years ago

Emily-Jiang commented 3 years ago

While working on getting MP 4.0 supported on mp starter. The following error messaged was displayed from Open Liberty:


[INFO] [ERROR ] CWWKO1650E: Validation of the OpenAPI document produced the following error(s):  
[INFO]  
[INFO] - Message: The "#/components/schemas/Booking" reference value is not defined within the Components Object, Location: #/paths/~1data~1booking~1{bookingId}/get/responses/200/content/application~1json/schema  
[INFO] - Message: The "#/components/schemas/Booking" value is an invalid reference, Location: #/paths/~1data~1booking~1{bookingId}/get/responses/200/content/application~1json/schema  
[INFO]  
[INFO] [AUDIT ] CWWKT0016I: Web application available (default_host): http://localhost:9080/

After further investigation, it turned out the error message was correct and it reported the wrong usage of schema. In the BookingController.java, it adds the schema with both ref and mpl. According to the open api javadoc, the 'ref` attribute should be used together with other attributes and it strongly advises not to use both. See here for more info.