RepreZen / KaiZen-OpenAPI-Editor

Eclipse Editor for the Swagger-OpenAPI Description Language
Eclipse Public License 1.0
115 stars 12 forks source link

[#439] Validation: Allow references to components in non-OAS files, t… #440

Closed ghillairet closed 6 years ago

ghillairet commented 6 years ago

Validation: Allow references to components in non-OAS files, through any path

This commit modifies the ReferenceValidator to allow references to non OAS/Swagger files. The type validation of referenced elements is still performed but now uses the JsonSchema validator library instead of our builtin mechanism based on JSON schema pointers. The new type validation is done by obtaining the subset of the OAS/Swagger JSON schema for which the reference is typed and validate the actual target node on it. If validation succeeds then the reference is marked as valid.

tedepstein commented 6 years ago

@andylowry , please review when you can.

andylowry commented 6 years ago

@tedepstein FYI, a small nit on this:

When the reference does resolve, but the target JSON structure does not pass the validation to which it is subjected, a single generic error message is provided:

Invalid object reference, the referenced object is not of expected type.

The validation itself creates its own messages, but those are not examined or displayed. It might be preferable to display the specific messages, perhaps, as markers nested beneath the main marker. If you'd prefer that, I'd suggest that we make it a follow-on issue.

tedepstein commented 6 years ago

@andylowry , thanks. The issue with validation messages is covered in #354.