question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Invalid assertion in AirlinesAppTest::testCallbackOperationAnnotations

See original GitHub issue

Here is the assertion I think is problematic:

vr.body(endpoint + ".get.responses.'200'.content.'application/json'.schema.ref", equalTo("#/components/schemas/Review"));

The above assertion appears to be verifying this part of the airlines test app:

@Content(mediaType = "application/json",
                  schema = @Schema(
                            type = SchemaType.ARRAY,
                            implementation = Review.class
                  )
         )
)

However, I question the idea that the above annotation should result in an OAI schema with a $ref. It seems to me that the only time you should get a $ref is if you actually reference something in the annotation. Otherwise the schema should be inline.

The TCK test seems to be asserting (typo of Review/Booking aside) that the resulting OAI schema should be:

{
    "type" : "array",
    "$ref": "#/components/schemas/Review"
}

Even if the implementation property of the @Schema annotation should result in a $ref, the result should be something like this:

{
   "type" : "array",
   "items": {
      "type": "object",
      "$ref": "#/components/schemas/Review"
   }
}

I think we need to have a discussion about @Schema and its implementation property vs its ref property. I think an OAI $ref should only occur when using the ref property of the annotation.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
EricWittmanncommented, Jan 24, 2018

Yes, let’s discuss next hangout for sure. I can be convinced certainly, but it might be more complicated than you expect.

Here is one thing to consider (from the spec) when we have that hangout:

The @Schema annotation has a complex set of possible combinations. It can placed on POJOs (and their fields / methods) and referenced from many other annotations. In the event that a @Schema#implementation value points to a POJO that also contains a @Schema annotation, the values are merged but with precedence given to the referrer annotation (i.e. the one that contains the implementation key). This allows POJO models to be reusable and configurable.

0reactions
arthurdmcommented, Feb 6, 2018

Fixed by PR #199

Read more comments on GitHub >

github_iconTop Results From Across the Web

c# - How do I use Assert to verify that an exception has been ...
I do this with a helpermethod instead. Test [TestMethod] public void AccountRepository_ThrowsExceptionIfFileisCorrupt() { var file = File.Create ...
Read more >
Ignored failing assertions in mock callbacks - Damir's Corner
[Test] public void PassesWithFailedAssertionInCallback() { var mocker = new AutoMocker(); var service = mocker.CreateInstance<Service>() ...
Read more >
OpenID Connect & OAuth 2.0 API - Okta Developer
Okta as the identity platform for your app or API ... tokens along with an authorization grant to the client application as a...
Read more >
typescript type overloading - elevateindy.org
There are two ways to do type assertion in TypeScript: 1. ... The switch statement is used to check for multiple values and...
Read more >
Reference Documentation - Citrus Framework
In this example test case above we use an instance of a custom LoggingService and call some operation log() in the middle of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found