Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
@Test
public void fieldsUseLowerCaseCamel() {
String schema = readFileToString(new File(getClass().getResource("/schema.json").getPath()), Charset.forName("UTF-8"));
Swagger swagger = new SwaggerParser().parse(schema);
for (Map.Entry<String, Model> entry : swagger.getDefinitions().entrySet()) {
if (entry.getValue().getProperties() == null) {
continue;
}
for (String fieldName : entry.getValue().getProperties().keySet()) {
assertTrue(fieldName + " of " + entry.getKey() + " should be lowerCaseCamel", LOWER_CASE_CAMEL.matcher(fieldName).matches());
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment