-
Notifications
You must be signed in to change notification settings - Fork 13
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
[ZEN-4339] Implement optional 2nd phase of validation with KZOP #457
Conversation
Add Validation preference page for OpenAPI v3. The page contains the option to use the advanced validation from KZOP. This option is enable by default.
@@ -9,7 +9,7 @@ Require-Bundle: org.eclipse.ui, | |||
org.eclipse.ui.editors, | |||
org.eclipse.jface.text, | |||
org.dadacoalition.yedit, | |||
com.google.guava;bundle-version="15.0.0", | |||
com.google.guava;bundle-version="21.0.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ghillairet , we use Guava 16 in the API Studio, see https://github.com/ModelSolv/RepreZen/commit/42f0f2eb0e954dd1c0516e945050ff54c579e901#r30206252 . How was version 21 of Guava chosen?
And... Do we still need Guava, even after migration to Java 8? :)
return errors; | ||
} | ||
|
||
protected JsonSchema getSchema(JsonDocument doc, String type, Map<String, JsonSchema> schemas) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code was extracted to JsonSchemaValidator
, is that right?
try { | ||
OpenApi3 result = new OpenApi3Parser().parse(baseURI.toURL(), true); | ||
|
||
for (ValidationItem item : result.getValidationResults().getItems()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
Passed code review.
Can you please have a look? |
@tfesenko @andylowry It seems that the issue is with KZOP that declares the imported packages as optional. I made a local p2 repository for KZOP that removes the optional declaration in the The problem I'm facing now is during validation with KZOP, I am having the javax.mail package not being found, although it is declared in the MANIFEST.
|
@tfesenko @andylowry This PR RepreZen/KaiZen-OpenApi-Parser#188 could fix the issue with import-packages not being resolved. It solves my previous issue with But I'm still having the tests to fail. |
Remove propertyListener from preference store should be done before preference store is deleted.
Activate advanced validation when there are no previous errors (not warnings).
Update target platform with latest KZOP.
Revert guava version to 15.
@tfesenko Ready to review and QA. |
getPreferenceStore().removePropertyChangeListener(advancedValidationListener); | ||
super.dispose(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
The recent commits passed code review. java.lang.NoSuchMethodError: com.reprezen.kaizen.oasparser.val.ValidationResults.open()Lcom/reprezen/kaizen/oasparser/val/ValidationResults$ValidationResultsInstance;
at com.reprezen.kaizen.oasparser.ovl3.OpenApi3Impl.validate(OpenApi3Impl.java:56)
at com.reprezen.kaizen.oasparser.OpenApiParser.parse(OpenApiParser.java:91)
at com.reprezen.kaizen.oasparser.OpenApiParser.parse(OpenApiParser.java:71)
at com.reprezen.kaizen.oasparser.OpenApi3Parser.parse(OpenApi3Parser.java:59)
at com.reprezen.swagedit.openapi3.validation.OpenApi3Validator.validate(OpenApi3Validator.java:98)
at com.reprezen.swagedit.core.validation.Validator.validate(Validator.java:75)
at com.reprezen.swagedit.core.editor.ValidationOperation.validateSwagger(ValidationOperation.java:110)
at com.reprezen.swagedit.core.editor.ValidationOperation.run(ValidationOperation.java:91)
at com.reprezen.swagedit.core.editor.JsonEditor$6.doRunInWorkspace(JsonEditor.java:419)
at com.reprezen.swagedit.core.editor.JsonEditor$SafeWorkspaceJob.runInWorkspace(JsonEditor.java:493)
at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:39)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:56) |
This strange exception is not present on KZOE installed from a local update site on top of a clean eclipse. Merging |
This PR adds an advanced validation mode for OpenAPI 3 documents. The advanced validation is provided by KaiZen Parser (KZOP). The advanced validation is only performed when the advanced option is passed to the OpenAPi3Validator constructor (which it is now true by default).
This PR should not be merged until we update the target platform to include latest version of KZOP and JsonOverlay. Those are present in this PR but are added as jars in the openapi3 project lib folder.