Skip to content

Add comprehensive annotation extension tests #537

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 20, 2022

Conversation

Azquelt
Copy link
Member

@Azquelt Azquelt commented Jun 17, 2022

Make sure the TCK exercises the extensions attribute on every annotation which has one.

To write the tests, I had to make changes to the annotations on JAXRSApp which had been mangled by the formatter, so as a prerequisite step I added a tweak to the standard microprofile formatting rules and reformatted the code. The update and reformatting are done in separate commits.

For #387

Azquelt added 2 commits June 16, 2022 18:05
The default MicroProfile formatting rules currently don't allow
annotation properties to wrap on a new line, which makes it hard to
maintain the TCK test applications because MP OpenAPI contains large
annotations with lots of attributes.

This change overrides the default formatter config XML file for the tck
project with one which has an additional property, allowing annotation
properties to wrap.
@Azquelt
Copy link
Member Author

Azquelt commented Jun 17, 2022

I've put this in draft for the moment as smallrye-open-api isn't producing some of the extensions correctly yet so I can't verify that I've written the assertions correctly.

@Azquelt Azquelt marked this pull request as ready for review June 17, 2022 15:30
@Azquelt
Copy link
Member Author

Azquelt commented Jun 17, 2022

I now have these passing under Smallrye OpenAPI

Copy link
Contributor

@MikeEdgar MikeEdgar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Azquelt

Make sure the TCK exercises the extensions attribute on every annotation
which has one.
@Azquelt Azquelt force-pushed the further-extension-tests branch from c3592a6 to 4b971e0 Compare June 20, 2022 14:57
@Azquelt
Copy link
Member Author

Azquelt commented Jun 20, 2022

As I went to merge this, I spotted that I'd squashed my last typo changes into the wrong commit and they hadn't been included in this PR, I've just updated it to include them and re-run the tests against smallrye.

Fixes are:

@@ -100,7 +100,7 @@ public class AirlinesAppTest extends AppTestBase {
         ValidatableResponse vr = callEndpoint(type);
         vr.body("externalDocs.description", equalTo("instructions for how to deploy this app"));
         vr.body("externalDocs.url", containsString("README.md"));
-        vr.body("externalDocs.x-external-docs", equalTo("text-external-docs"));
+        vr.body("externalDocs.x-external-docs", equalTo("test-external-docs"));
     }
 
     @RunAsClient
@@ -434,7 +434,7 @@ public class AirlinesAppTest extends AppTestBase {
         vr.body(availabilityParameters + ".findAll { it.name == 'numberOfChildren' }.schema.minimum",
                 both(hasSize(1)).and(contains(0)));
         vr.body(availabilityParameters + ".findAll { it.name == 'airportFrom' }.x-parameter",
-                equalTo("test-parameter"));
+                contains("test-parameter"));
 
         vr.body(availabilityParameters + ".findAll { it.$ref == '#/components/parameters/departureDate'}",
                 notNullValue());
@@ -462,7 +462,7 @@ public class AirlinesAppTest extends AppTestBase {
         endpoint = "paths.'/reviews'.post.callbacks";
         vr.body(endpoint, hasKey("testCallback"));
         vr.body(endpoint + ".testCallback", hasKey("http://localhost:9080/oas3-airlines/reviews"));
-        vr.body(endpoint + "testCallback.x-callback", equalTo("test-callback"));
+        vr.body(endpoint + ".testCallback.x-callback", equalTo("test-callback"));
 
         endpoint = "paths.'/bookings'.post.callbacks";
         vr.body(endpoint, hasKey("bookingCallback"));

@Azquelt Azquelt merged commit 2ac736c into microprofile:master Jun 20, 2022
@Azquelt Azquelt deleted the further-extension-tests branch June 20, 2022 15:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants