Forum Discussion

pablocavalieri's avatar
pablocavalieri
New Contributor
5 years ago

Third party DTO as schema reference

Is there a way to set, as schema definition, a DTO defined in a java DTO .class?

requestBody:
content:
application/json:
schema:
$ref: '#/path.to.my.java.class.located.in.a.jar'

 

2 Replies

  • A reference needs to be a valid URI, so technically if your jar is accessible, it could work. However, it's unlikely that the different resolvers would be able to make sense of it. Of course, the expectation that the reference would lead to a JSON Schema, otherwise it's completely meaningless.

    • pablocavalieri's avatar
      pablocavalieri
      New Contributor

      Hi Ron.

      I found out that if you reference the class with quotes, it works

      Ie: 

      $ref: 'MyPOJO'

      if MyPOJO is present in the proyect classpath, it works