DEV Community

Discussion on: Json validation with OpenAPI Schema

Collapse
 
gauamg profile image
gauamg

Thank you for this post - this is helpful. I am attempting something slightly different - I want to be able to validate my YAML specs against the OAS3.0 Spec file. (I am aware there are various tools but I am noticing inconsistencies and would like to be able to figure it out myself). However, if the URL is pointing to the OAS3 spec file, the OpenApi3Parser().parse() call is giving me this exception:
Exception in thread "main" org.openapi4j.core.exception.ResolutionException: Failed to load document from 'file:src/main/resources/object'

Do you know if what I am attempting is possible with openapi4j ?

Regards

Collapse
 
adzubla profile image
Eduardo Issao Ito • Edited

In my example, the json and yaml file are in standard Maven folders.

Try to use use the full path:
"file://c:/Users/MyUser/path_to_files/pets.yaml"

Collapse
 
adzubla profile image
Eduardo Issao Ito

The same program can parse both json and yaml files.