Swagger 2.0 offline validation

别说谁变了你拦得住时间么 提交于 2019-11-30 22:38:49

I'm very satisfied with this Validator from Atlassian: https://bitbucket.org/atlassian/swagger-request-validator

There is still active development, so I guess they will also provide something for OpenAPI 3.

I have created a Maven project that validates swagger JSON documents if you ever decide to use Maven for running your tests.

You can clone the project here: https://github.com/navidsh/maven.swagger.validator

Well, I finished a Swagger validator using fge/json-schema-validator and Jackson. It uses the Swagger 2.0 schema to validate.

https://gist.github.com/mariosotil/e1219d4e946c643fe0e5

@Singleton
public class SwaggerValidator {

    public ArrayNode validate(JsonNode jsonNode) {
        return Optional.of(jsonNode)
                .map(this::validateWithinSwaggerSchema)
                .map(this::getMessagesAsJsonArray)
                .get();
    }

    // [...]
}

Hope this helps.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!