Skip to content
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

Address issue #1445 and fix failed test #1480

Merged
merged 5 commits into from
Mar 5, 2024
Merged

Conversation

ktsypkina
Copy link
Member

Addresses #1445
As Zally does not support validation for relative refs, no new test cases to cover this scenario

After upgrading to io.swagger.parser.v3:swagger-parser:2.1.9 (from 2.0.32) the test case was failing due to different error message.

This error occured because of changes in OpenAPIDeserializer:
rootMap = new ObjectMapper().convertValue(rootNode, Map.class);
the convert to rootMap was introduced before trying to parse the rootNode. That's why it is not setting the correct message in the result.

Before the upgrade the message was
attribute openApi is not of type "object"

After upgrade the IllegalArgumentException is handled by the library itself, setting the message to

Cannot construct instance of `java.util.LinkedHashMap` (although at least one Creator exists): no String-argument constructor/factory method to deserialize from String value ('no swagger definition') at [Source: UNKNOWN; byte offset: #UNKNOWN]

Aligned with @tkrop on the fix:
handle this exception as violation of rule #101
Since there is 0 attributes in test example "no swagger definition" it is handled as ParseResult.NotApplicable with following details:

{
    externalId: "<some id>",
    title: "provide API specification using OpenAPI",
    description: "attribute  is not of type `object`",
    ruleLink: "https://zalando.github.io/restful-api-guidelines/#101",
   ....
}

@codecov-commenter
Copy link

codecov-commenter commented Feb 19, 2024

Codecov Report

Attention: Patch coverage is 75.00000% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 77.25%. Comparing base (9315868) to head (ae1d160).
Report is 2 commits behind head on main.

Files Patch % Lines
...in/org/zalando/zally/core/DefaultContextFactory.kt 75.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #1480      +/-   ##
============================================
+ Coverage     77.11%   77.25%   +0.13%     
- Complexity      669      672       +3     
============================================
  Files           171      171              
  Lines          2819     2822       +3     
  Branches        442      442              
============================================
+ Hits           2174     2180       +6     
+ Misses          417      414       -3     
  Partials        228      228              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@tkrop
Copy link
Member

tkrop commented Feb 21, 2024

👍

@tkrop
Copy link
Member

tkrop commented Feb 22, 2024

Oh, by the way, there is a drop in coverage. Can you think of a new test case covering it?

@ktsypkina
Copy link
Member Author

Oh, by the way, there is a drop in coverage. Can you think of a new test case covering it?

I've added a new test case before but it's not recognising the new test case as one covering string input scenario

@tkrop
Copy link
Member

tkrop commented Mar 4, 2024

👍

@ktsypkina
Copy link
Member Author

👍

@ktsypkina ktsypkina merged commit 8c7407d into zalando:main Mar 5, 2024
6 checks passed
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.

3 participants