Skip to content

Instantly share code, notes, and snippets.

@tao-qian
Created August 31, 2016 17:47
Show Gist options
  • Save tao-qian/2fd68d6035186247ee20519b05ffe437 to your computer and use it in GitHub Desktop.
Save tao-qian/2fd68d6035186247ee20519b05ffe437 to your computer and use it in GitHub Desktop.
@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