@Test public void shouldValidateOperationUniqueness() { final Oas30Document openApiDoc = new Oas30Document(); final Oas30PathItem pathItem = new Oas30PathItem("/path"); Oas30Operation get = new Oas30Operation("get"); get.operationId = "o1"; pathItem.get = get; Oas30Operation post = new Oas30Operation("post"); post.operationId = "o2"; pathItem.post = post; openApiDoc.paths = openApiDoc.createPaths(); openApiDoc.paths.addPathItem("/path", pathItem); final Oas30PathItem otherPathItem = new Oas30PathItem("/other"); Oas30Operation patch = new Oas30Operation("patch"); patch.operationId = "o2"; otherPathItem.patch = patch; Oas30Operation put = new Oas30Operation("put"); put.operationId = "o3"; otherPathItem.put = put; openApiDoc.paths.addPathItem("/other", otherPathItem); final Oas30PathItem morePathItem = new Oas30PathItem("/more"); Oas30Operation options = new Oas30Operation("options"); options.operationId = "o4"; morePathItem.options = options; Oas30Operation delete = new Oas30Operation("delete"); delete.operationId = "o3"; morePathItem.delete = delete; openApiDoc.paths.addPathItem("/more", morePathItem); final OpenApiModelInfo info = new OpenApiModelInfo.Builder().model(openApiDoc).build(); final OpenApiModelInfo validated = RULES.validateUniqueOperationIds(info); final List<Violation> warnings = validated.getWarnings(); assertThat(warnings).hasSize(1); final Violation nonUniqueWarning = warnings.get(0); assertThat(nonUniqueWarning.error()).isEqualTo("non-unique-operation-ids"); assertThat(nonUniqueWarning.property()).isNull(); assertThat(nonUniqueWarning.message()).isEqualTo("Found operations with non unique operationIds: o2, o3"); }
public static Oas30ValidationRules get(final APIValidationContext context) { return new Oas30ValidationRules(context); }
Oas30ValidationRules extends OpenApiValidationRules<Oas30Response, Oas30SecurityScheme, Oas30SchemaDefinition> { public static Oas30ValidationRules get(final APIValidationContext context) { return new Oas30ValidationRules(context); } }
Oas30ValidationRules extends OpenApiValidationRules<Oas30Response, Oas30SecurityScheme, Oas30SchemaDefinition> { public static Oas30ValidationRules get(final APIValidationContext context) { return new Oas30ValidationRules(context); } Oas30ValidationRules(APIValidationContext context); }
Oas30ValidationRules extends OpenApiValidationRules<Oas30Response, Oas30SecurityScheme, Oas30SchemaDefinition> { public static Oas30ValidationRules get(final APIValidationContext context) { return new Oas30ValidationRules(context); } Oas30ValidationRules(APIValidationContext context); static Oas30ValidationRules get(final APIValidationContext context); }
Oas30ValidationRules extends OpenApiValidationRules<Oas30Response, Oas30SecurityScheme, Oas30SchemaDefinition> { public static Oas30ValidationRules get(final APIValidationContext context) { return new Oas30ValidationRules(context); } Oas30ValidationRules(APIValidationContext context); static Oas30ValidationRules get(final APIValidationContext context);  }