I write OPENAPI 3.0 yaml file as the documentation for java REST api project.It can be nicely rendered with ReDoc . And in order to help other developers and our customers to use the API I should always keep the java response java the same with the OPENAPI yaml
schema definition.
So...it there some tools to help use the OPENAPI yaml schema validate JAVA Response?
I have seen some tools like rest-assured
can use json-schema
for response validation. But it seems that the OPENAPI schema is a little bit different from the json validation. I can not use it directly.
I solved this problem by using https://github.com/mikunn/openapi2schema . This package help translate openapi definitions into valid json schema draft 4 version. And I can then use rest-assured to validate the json response with this json schema file.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.