├── .gitignore ├── .settings ├── org.eclipse.jdt.core.prefs └── org.eclipse.jdt.ui.prefs ├── .travis.yml ├── LICENSE.txt ├── README.md ├── pom.xml └── src ├── it ├── allow-json-comments │ ├── invoker.properties │ ├── pom.xml │ └── src │ │ └── main │ │ └── resources │ │ └── allow-json-comments.json ├── allowed-empty-files │ ├── invoker.properties │ ├── pom.xml │ └── src │ │ └── main │ │ └── resources │ │ ├── empty.json │ │ └── empty.yml ├── allowed-trailing-comma │ ├── invoker.properties │ ├── pom.xml │ └── src │ │ └── main │ │ └── resources │ │ ├── trailing-comma.json │ │ └── trailing-comma.yml ├── duplicate-keys-json │ ├── invoker.properties │ ├── pom.xml │ └── src │ │ └── main │ │ └── resources │ │ └── duplicate-keys.json ├── duplicate-keys-yaml │ ├── invoker.properties │ ├── pom.xml │ └── src │ │ └── main │ │ └── resources │ │ └── duplicate-keys.yml ├── multiple-validation-sets │ ├── invoker.properties │ ├── pom.xml │ └── src │ │ └── main │ │ └── resources │ │ ├── malformed.yml │ │ ├── swagger-editor-example.yml │ │ └── swagger-schema.json ├── settings.xml ├── validate-fails │ ├── invoker.properties │ ├── pom.xml │ └── src │ │ └── main │ │ └── resources │ │ ├── not-valid.yml │ │ └── swagger-schema.json ├── validate-skipped │ ├── invoker.properties │ ├── pom.xml │ └── src │ │ └── main │ │ └── resources │ │ └── test.yml ├── validate-succeeds │ ├── invoker.properties │ ├── pom.xml │ └── src │ │ └── main │ │ └── resources │ │ ├── swagger-editor-example.yml │ │ └── swagger-schema.json └── well-formed-fails │ ├── invoker.properties │ ├── pom.xml │ └── src │ └── main │ └── resources │ └── malformed.yml ├── main └── java │ └── com │ └── github │ └── sylvainlaurent │ └── maven │ └── yamljsonvalidator │ ├── ValidateMojo.java │ ├── ValidationResult.java │ ├── ValidationService.java │ ├── ValidationSet.java │ └── downloader │ └── ClasspathDownloader.java └── test ├── java └── com │ └── github │ └── sylvainlaurent │ └── maven │ └── yamljsonvalidator │ ├── ValidateMojoTest.java │ ├── ValidationServiceAllowEmptyFilesTest.java │ └── ValidationServiceTest.java └── resources ├── empty.json ├── empty.yml ├── malformed.json ├── malformed.yml ├── not-valid.json ├── not-valid.yml ├── schema-with-ref.json ├── swagger-editor-example.json ├── swagger-editor-example.yml ├── swagger-schema.json ├── with-comments.json └── with-comments.yml /.gitignore: -------------------------------------------------------------------------------- 1 | .classpath 2 | /.settings/* 3 | !/.settings/org.eclipse.jdt.core.prefs 4 | !/.settings/org.eclipse.jdt.ui.prefs 5 | .project 6 | pom.xml.* 7 | target/ 8 | *.md.html 9 | /.idea 10 | /release.properties 11 | -------------------------------------------------------------------------------- /.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=enabled 3 | org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=warning 4 | org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull 5 | org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault 6 | org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable 7 | org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled 8 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 9 | org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate 10 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 11 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve 12 | org.eclipse.jdt.core.compiler.compliance=1.7 13 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate 14 | org.eclipse.jdt.core.compiler.debug.localVariable=generate 15 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate 16 | org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning 17 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 18 | org.eclipse.jdt.core.compiler.problem.autoboxing=ignore 19 | org.eclipse.jdt.core.compiler.problem.comparingIdentical=error 20 | org.eclipse.jdt.core.compiler.problem.deadCode=warning 21 | org.eclipse.jdt.core.compiler.problem.deprecation=warning 22 | org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled 23 | org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled 24 | org.eclipse.jdt.core.compiler.problem.discouragedReference=warning 25 | org.eclipse.jdt.core.compiler.problem.emptyStatement=error 26 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 27 | org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore 28 | org.eclipse.jdt.core.compiler.problem.fallthroughCase=error 29 | org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled 30 | org.eclipse.jdt.core.compiler.problem.fieldHiding=error 31 | org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning 32 | org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=error 33 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning 34 | org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning 35 | org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=enabled 36 | org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=error 37 | org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=error 38 | org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning 39 | org.eclipse.jdt.core.compiler.problem.localVariableHiding=error 40 | org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning 41 | org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore 42 | org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore 43 | org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled 44 | org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=warning 45 | org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning 46 | org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled 47 | org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning 48 | org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=warning 49 | org.eclipse.jdt.core.compiler.problem.noEffectAssignment=error 50 | org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning 51 | org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore 52 | org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning 53 | org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error 54 | org.eclipse.jdt.core.compiler.problem.nullReference=error 55 | org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error 56 | org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=ignore 57 | org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning 58 | org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore 59 | org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore 60 | org.eclipse.jdt.core.compiler.problem.potentialNullReference=error 61 | org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore 62 | org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning 63 | org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning 64 | org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning 65 | org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore 66 | org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore 67 | org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore 68 | org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore 69 | org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled 70 | org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning 71 | org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=enabled 72 | org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled 73 | org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=enabled 74 | org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore 75 | org.eclipse.jdt.core.compiler.problem.typeParameterHiding=error 76 | org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled 77 | org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning 78 | org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning 79 | org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore 80 | org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning 81 | org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore 82 | org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore 83 | org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore 84 | org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore 85 | org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled 86 | org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled 87 | org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled 88 | org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore 89 | org.eclipse.jdt.core.compiler.problem.unusedImport=warning 90 | org.eclipse.jdt.core.compiler.problem.unusedLabel=warning 91 | org.eclipse.jdt.core.compiler.problem.unusedLocal=warning 92 | org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=error 93 | org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore 94 | org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled 95 | org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled 96 | org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled 97 | org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning 98 | org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore 99 | org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning 100 | org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning 101 | org.eclipse.jdt.core.compiler.source=1.7 102 | org.eclipse.jdt.core.formatter.align_type_members_on_columns=false 103 | org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 104 | org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 105 | org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 106 | org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 107 | org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 108 | org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 109 | org.eclipse.jdt.core.formatter.alignment_for_assignment=0 110 | org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 111 | org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 112 | org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 113 | org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 114 | org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 115 | org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 116 | org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 117 | org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 118 | org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 119 | org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80 120 | org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 121 | org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 122 | org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 123 | org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 124 | org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 125 | org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 126 | org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16 127 | org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 128 | org.eclipse.jdt.core.formatter.blank_lines_after_package=1 129 | org.eclipse.jdt.core.formatter.blank_lines_before_field=0 130 | org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 131 | org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 132 | org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 133 | org.eclipse.jdt.core.formatter.blank_lines_before_method=1 134 | org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 135 | org.eclipse.jdt.core.formatter.blank_lines_before_package=0 136 | org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 137 | org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 138 | org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line 139 | org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line 140 | org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line 141 | org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line 142 | org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line 143 | org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line 144 | org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line 145 | org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line 146 | org.eclipse.jdt.core.formatter.brace_position_for_lambda_body=end_of_line 147 | org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line 148 | org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line 149 | org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line 150 | org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false 151 | org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false 152 | org.eclipse.jdt.core.formatter.comment.format_block_comments=true 153 | org.eclipse.jdt.core.formatter.comment.format_header=false 154 | org.eclipse.jdt.core.formatter.comment.format_html=true 155 | org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true 156 | org.eclipse.jdt.core.formatter.comment.format_line_comments=true 157 | org.eclipse.jdt.core.formatter.comment.format_source_code=true 158 | org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true 159 | org.eclipse.jdt.core.formatter.comment.indent_root_tags=true 160 | org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert 161 | org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert 162 | org.eclipse.jdt.core.formatter.comment.line_length=120 163 | org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true 164 | org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true 165 | org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false 166 | org.eclipse.jdt.core.formatter.compact_else_if=true 167 | org.eclipse.jdt.core.formatter.continuation_indentation=2 168 | org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 169 | org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off 170 | org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on 171 | org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false 172 | org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true 173 | org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true 174 | org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true 175 | org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true 176 | org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true 177 | org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true 178 | org.eclipse.jdt.core.formatter.indent_empty_lines=false 179 | org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true 180 | org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true 181 | org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true 182 | org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false 183 | org.eclipse.jdt.core.formatter.indentation.size=4 184 | org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert 185 | org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert 186 | org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert 187 | org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert 188 | org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert 189 | org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert 190 | org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert 191 | org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert 192 | org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert 193 | org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation=do not insert 194 | org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert 195 | org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert 196 | org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert 197 | org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert 198 | org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert 199 | org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert 200 | org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert 201 | org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert 202 | org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert 203 | org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert 204 | org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert 205 | org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert 206 | org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert 207 | org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert 208 | org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert 209 | org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert 210 | org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert 211 | org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert 212 | org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert 213 | org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert 214 | org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert 215 | org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert 216 | org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert 217 | org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert 218 | org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert 219 | org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert 220 | org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert 221 | org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert 222 | org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert 223 | org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert 224 | org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert 225 | org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert 226 | org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert 227 | org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert 228 | org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert 229 | org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert 230 | org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert 231 | org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert 232 | org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert 233 | org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert 234 | org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert 235 | org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert 236 | org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert 237 | org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert 238 | org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert 239 | org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert 240 | org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert 241 | org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=insert 242 | org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert 243 | org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert 244 | org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert 245 | org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert 246 | org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert 247 | org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert 248 | org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert 249 | org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert 250 | org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert 251 | org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert 252 | org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert 253 | org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert 254 | org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert 255 | org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert 256 | org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert 257 | org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert 258 | org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert 259 | org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert 260 | org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert 261 | org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert 262 | org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert 263 | org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert 264 | org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert 265 | org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert 266 | org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert 267 | org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert 268 | org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert 269 | org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert 270 | org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert 271 | org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert 272 | org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert 273 | org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert 274 | org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert 275 | org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert 276 | org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert 277 | org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert 278 | org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert 279 | org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert 280 | org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert 281 | org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert 282 | org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert 283 | org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert 284 | org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert 285 | org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert 286 | org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert 287 | org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert 288 | org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert 289 | org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert 290 | org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert 291 | org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert 292 | org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert 293 | org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert 294 | org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert 295 | org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert 296 | org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert 297 | org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert 298 | org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert 299 | org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert 300 | org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert 301 | org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert 302 | org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert 303 | org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert 304 | org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert 305 | org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert 306 | org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert 307 | org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert 308 | org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert 309 | org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert 310 | org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert 311 | org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert 312 | org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert 313 | org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert 314 | org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert 315 | org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert 316 | org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert 317 | org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert 318 | org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert 319 | org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow=insert 320 | org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert 321 | org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert 322 | org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert 323 | org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert 324 | org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert 325 | org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert 326 | org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert 327 | org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert 328 | org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert 329 | org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert 330 | org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert 331 | org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert 332 | org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert 333 | org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert 334 | org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert 335 | org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert 336 | org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert 337 | org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert 338 | org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert 339 | org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert 340 | org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert 341 | org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert 342 | org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert 343 | org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert 344 | org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert 345 | org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert 346 | org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert 347 | org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert 348 | org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert 349 | org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert 350 | org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert 351 | org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert 352 | org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert 353 | org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert 354 | org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert 355 | org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert 356 | org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert 357 | org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert 358 | org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert 359 | org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert 360 | org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert 361 | org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert 362 | org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert 363 | org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert 364 | org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert 365 | org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert 366 | org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert 367 | org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert 368 | org.eclipse.jdt.core.formatter.join_lines_in_comments=true 369 | org.eclipse.jdt.core.formatter.join_wrapped_lines=true 370 | org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false 371 | org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false 372 | org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false 373 | org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false 374 | org.eclipse.jdt.core.formatter.lineSplit=120 375 | org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false 376 | org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false 377 | org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 378 | org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 379 | org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true 380 | org.eclipse.jdt.core.formatter.tabulation.char=space 381 | org.eclipse.jdt.core.formatter.tabulation.size=4 382 | org.eclipse.jdt.core.formatter.use_on_off_tags=false 383 | org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=true 384 | org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true 385 | org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true 386 | org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true 387 | -------------------------------------------------------------------------------- /.settings/org.eclipse.jdt.ui.prefs: -------------------------------------------------------------------------------- 1 | cleanup.add_default_serial_version_id=true 2 | cleanup.add_generated_serial_version_id=false 3 | cleanup.add_missing_annotations=true 4 | cleanup.add_missing_deprecated_annotations=true 5 | cleanup.add_missing_methods=false 6 | cleanup.add_missing_nls_tags=false 7 | cleanup.add_missing_override_annotations=true 8 | cleanup.add_missing_override_annotations_interface_methods=true 9 | cleanup.add_serial_version_id=true 10 | cleanup.always_use_blocks=true 11 | cleanup.always_use_parentheses_in_expressions=false 12 | cleanup.always_use_this_for_non_static_field_access=false 13 | cleanup.always_use_this_for_non_static_method_access=false 14 | cleanup.convert_functional_interfaces=false 15 | cleanup.convert_to_enhanced_for_loop=false 16 | cleanup.correct_indentation=true 17 | cleanup.format_source_code=true 18 | cleanup.format_source_code_changes_only=false 19 | cleanup.insert_inferred_type_arguments=false 20 | cleanup.make_local_variable_final=true 21 | cleanup.make_parameters_final=false 22 | cleanup.make_private_fields_final=true 23 | cleanup.make_type_abstract_if_missing_method=false 24 | cleanup.make_variable_declarations_final=true 25 | cleanup.never_use_blocks=false 26 | cleanup.never_use_parentheses_in_expressions=true 27 | cleanup.organize_imports=true 28 | cleanup.qualify_static_field_accesses_with_declaring_class=false 29 | cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true 30 | cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true 31 | cleanup.qualify_static_member_accesses_with_declaring_class=true 32 | cleanup.qualify_static_method_accesses_with_declaring_class=false 33 | cleanup.remove_private_constructors=true 34 | cleanup.remove_redundant_type_arguments=true 35 | cleanup.remove_trailing_whitespaces=true 36 | cleanup.remove_trailing_whitespaces_all=true 37 | cleanup.remove_trailing_whitespaces_ignore_empty=false 38 | cleanup.remove_unnecessary_casts=true 39 | cleanup.remove_unnecessary_nls_tags=true 40 | cleanup.remove_unused_imports=true 41 | cleanup.remove_unused_local_variables=false 42 | cleanup.remove_unused_private_fields=true 43 | cleanup.remove_unused_private_members=false 44 | cleanup.remove_unused_private_methods=true 45 | cleanup.remove_unused_private_types=true 46 | cleanup.sort_members=false 47 | cleanup.sort_members_all=false 48 | cleanup.use_anonymous_class_creation=false 49 | cleanup.use_blocks=true 50 | cleanup.use_blocks_only_for_return_and_throw=false 51 | cleanup.use_lambda=true 52 | cleanup.use_parentheses_in_expressions=false 53 | cleanup.use_this_for_non_static_field_access=false 54 | cleanup.use_this_for_non_static_field_access_only_if_necessary=true 55 | cleanup.use_this_for_non_static_method_access=false 56 | cleanup.use_this_for_non_static_method_access_only_if_necessary=true 57 | cleanup.use_type_arguments=false 58 | cleanup_profile=_PerfLogger code style 59 | cleanup_settings_version=2 60 | eclipse.preferences.version=1 61 | editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true 62 | formatter_profile=_PerfLogger code style 63 | formatter_settings_version=12 64 | org.eclipse.jdt.ui.javadoc=false 65 | org.eclipse.jdt.ui.text.custom_code_templates= 66 | sp_cleanup.add_default_serial_version_id=true 67 | sp_cleanup.add_generated_serial_version_id=false 68 | sp_cleanup.add_missing_annotations=true 69 | sp_cleanup.add_missing_deprecated_annotations=true 70 | sp_cleanup.add_missing_methods=false 71 | sp_cleanup.add_missing_nls_tags=false 72 | sp_cleanup.add_missing_override_annotations=true 73 | sp_cleanup.add_missing_override_annotations_interface_methods=true 74 | sp_cleanup.add_serial_version_id=false 75 | sp_cleanup.always_use_blocks=true 76 | sp_cleanup.always_use_parentheses_in_expressions=false 77 | sp_cleanup.always_use_this_for_non_static_field_access=false 78 | sp_cleanup.always_use_this_for_non_static_method_access=false 79 | sp_cleanup.convert_to_enhanced_for_loop=false 80 | sp_cleanup.correct_indentation=true 81 | sp_cleanup.format_source_code=true 82 | sp_cleanup.format_source_code_changes_only=false 83 | sp_cleanup.make_local_variable_final=true 84 | sp_cleanup.make_parameters_final=true 85 | sp_cleanup.make_private_fields_final=true 86 | sp_cleanup.make_type_abstract_if_missing_method=false 87 | sp_cleanup.make_variable_declarations_final=true 88 | sp_cleanup.never_use_blocks=false 89 | sp_cleanup.never_use_parentheses_in_expressions=true 90 | sp_cleanup.on_save_use_additional_actions=true 91 | sp_cleanup.organize_imports=true 92 | sp_cleanup.qualify_static_field_accesses_with_declaring_class=false 93 | sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true 94 | sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true 95 | sp_cleanup.qualify_static_member_accesses_with_declaring_class=true 96 | sp_cleanup.qualify_static_method_accesses_with_declaring_class=false 97 | sp_cleanup.remove_private_constructors=true 98 | sp_cleanup.remove_trailing_whitespaces=true 99 | sp_cleanup.remove_trailing_whitespaces_all=true 100 | sp_cleanup.remove_trailing_whitespaces_ignore_empty=false 101 | sp_cleanup.remove_unnecessary_casts=true 102 | sp_cleanup.remove_unnecessary_nls_tags=false 103 | sp_cleanup.remove_unused_imports=true 104 | sp_cleanup.remove_unused_local_variables=false 105 | sp_cleanup.remove_unused_private_fields=true 106 | sp_cleanup.remove_unused_private_members=false 107 | sp_cleanup.remove_unused_private_methods=true 108 | sp_cleanup.remove_unused_private_types=true 109 | sp_cleanup.sort_members=false 110 | sp_cleanup.sort_members_all=false 111 | sp_cleanup.use_blocks=true 112 | sp_cleanup.use_blocks_only_for_return_and_throw=false 113 | sp_cleanup.use_parentheses_in_expressions=false 114 | sp_cleanup.use_this_for_non_static_field_access=true 115 | sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true 116 | sp_cleanup.use_this_for_non_static_method_access=false 117 | sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true 118 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | dist: xenial 2 | language: java 3 | jdk: 4 | - openjdk8 5 | 6 | script: mvn clean verify 7 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, and 10 | distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by the copyright 13 | owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all other entities 16 | that control, are controlled by, or are under common control with that entity. 17 | For the purposes of this definition, "control" means (i) the power, direct or 18 | indirect, to cause the direction or management of such entity, whether by 19 | contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the 20 | outstanding shares, or (iii) beneficial ownership of such entity. 21 | 22 | "You" (or "Your") shall mean an individual or Legal Entity exercising 23 | permissions granted by this License. 24 | 25 | "Source" form shall mean the preferred form for making modifications, including 26 | but not limited to software source code, documentation source, and configuration 27 | files. 28 | 29 | "Object" form shall mean any form resulting from mechanical transformation or 30 | translation of a Source form, including but not limited to compiled object code, 31 | generated documentation, and conversions to other media types. 32 | 33 | "Work" shall mean the work of authorship, whether in Source or Object form, made 34 | available under the License, as indicated by a copyright notice that is included 35 | in or attached to the work (an example is provided in the Appendix below). 36 | 37 | "Derivative Works" shall mean any work, whether in Source or Object form, that 38 | is based on (or derived from) the Work and for which the editorial revisions, 39 | annotations, elaborations, or other modifications represent, as a whole, an 40 | original work of authorship. For the purposes of this License, Derivative Works 41 | shall not include works that remain separable from, or merely link (or bind by 42 | name) to the interfaces of, the Work and Derivative Works thereof. 43 | 44 | "Contribution" shall mean any work of authorship, including the original version 45 | of the Work and any modifications or additions to that Work or Derivative Works 46 | thereof, that is intentionally submitted to Licensor for inclusion in the Work 47 | by the copyright owner or by an individual or Legal Entity authorized to submit 48 | on behalf of the copyright owner. For the purposes of this definition, 49 | "submitted" means any form of electronic, verbal, or written communication sent 50 | to the Licensor or its representatives, including but not limited to 51 | communication on electronic mailing lists, source code control systems, and 52 | issue tracking systems that are managed by, or on behalf of, the Licensor for 53 | the purpose of discussing and improving the Work, but excluding communication 54 | that is conspicuously marked or otherwise designated in writing by the copyright 55 | owner as "Not a Contribution." 56 | 57 | "Contributor" shall mean Licensor and any individual or Legal Entity on behalf 58 | of whom a Contribution has been received by Licensor and subsequently 59 | incorporated within the Work. 60 | 61 | 2. Grant of Copyright License. 62 | 63 | Subject to the terms and conditions of this License, each Contributor hereby 64 | grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, 65 | irrevocable copyright license to reproduce, prepare Derivative Works of, 66 | publicly display, publicly perform, sublicense, and distribute the Work and such 67 | Derivative Works in Source or Object form. 68 | 69 | 3. Grant of Patent License. 70 | 71 | Subject to the terms and conditions of this License, each Contributor hereby 72 | grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, 73 | irrevocable (except as stated in this section) patent license to make, have 74 | made, use, offer to sell, sell, import, and otherwise transfer the Work, where 75 | such license applies only to those patent claims licensable by such Contributor 76 | that are necessarily infringed by their Contribution(s) alone or by combination 77 | of their Contribution(s) with the Work to which such Contribution(s) was 78 | submitted. If You institute patent litigation against any entity (including a 79 | cross-claim or counterclaim in a lawsuit) alleging that the Work or a 80 | Contribution incorporated within the Work constitutes direct or contributory 81 | patent infringement, then any patent licenses granted to You under this License 82 | for that Work shall terminate as of the date such litigation is filed. 83 | 84 | 4. Redistribution. 85 | 86 | You may reproduce and distribute copies of the Work or Derivative Works thereof 87 | in any medium, with or without modifications, and in Source or Object form, 88 | provided that You meet the following conditions: 89 | 90 | You must give any other recipients of the Work or Derivative Works a copy of 91 | this License; and 92 | You must cause any modified files to carry prominent notices stating that You 93 | changed the files; and 94 | You must retain, in the Source form of any Derivative Works that You distribute, 95 | all copyright, patent, trademark, and attribution notices from the Source form 96 | of the Work, excluding those notices that do not pertain to any part of the 97 | Derivative Works; and 98 | If the Work includes a "NOTICE" text file as part of its distribution, then any 99 | Derivative Works that You distribute must include a readable copy of the 100 | attribution notices contained within such NOTICE file, excluding those notices 101 | that do not pertain to any part of the Derivative Works, in at least one of the 102 | following places: within a NOTICE text file distributed as part of the 103 | Derivative Works; within the Source form or documentation, if provided along 104 | with the Derivative Works; or, within a display generated by the Derivative 105 | Works, if and wherever such third-party notices normally appear. The contents of 106 | the NOTICE file are for informational purposes only and do not modify the 107 | License. You may add Your own attribution notices within Derivative Works that 108 | You distribute, alongside or as an addendum to the NOTICE text from the Work, 109 | provided that such additional attribution notices cannot be construed as 110 | modifying the License. 111 | You may add Your own copyright statement to Your modifications and may provide 112 | additional or different license terms and conditions for use, reproduction, or 113 | distribution of Your modifications, or for any such Derivative Works as a whole, 114 | provided Your use, reproduction, and distribution of the Work otherwise complies 115 | with the conditions stated in this License. 116 | 117 | 5. Submission of Contributions. 118 | 119 | Unless You explicitly state otherwise, any Contribution intentionally submitted 120 | for inclusion in the Work by You to the Licensor shall be under the terms and 121 | conditions of this License, without any additional terms or conditions. 122 | Notwithstanding the above, nothing herein shall supersede or modify the terms of 123 | any separate license agreement you may have executed with Licensor regarding 124 | such Contributions. 125 | 126 | 6. Trademarks. 127 | 128 | This License does not grant permission to use the trade names, trademarks, 129 | service marks, or product names of the Licensor, except as required for 130 | reasonable and customary use in describing the origin of the Work and 131 | reproducing the content of the NOTICE file. 132 | 133 | 7. Disclaimer of Warranty. 134 | 135 | Unless required by applicable law or agreed to in writing, Licensor provides the 136 | Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, 137 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, 138 | including, without limitation, any warranties or conditions of TITLE, 139 | NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are 140 | solely responsible for determining the appropriateness of using or 141 | redistributing the Work and assume any risks associated with Your exercise of 142 | permissions under this License. 143 | 144 | 8. Limitation of Liability. 145 | 146 | In no event and under no legal theory, whether in tort (including negligence), 147 | contract, or otherwise, unless required by applicable law (such as deliberate 148 | and grossly negligent acts) or agreed to in writing, shall any Contributor be 149 | liable to You for damages, including any direct, indirect, special, incidental, 150 | or consequential damages of any character arising as a result of this License or 151 | out of the use or inability to use the Work (including but not limited to 152 | damages for loss of goodwill, work stoppage, computer failure or malfunction, or 153 | any and all other commercial damages or losses), even if such Contributor has 154 | been advised of the possibility of such damages. 155 | 156 | 9. Accepting Warranty or Additional Liability. 157 | 158 | While redistributing the Work or Derivative Works thereof, You may choose to 159 | offer, and charge a fee for, acceptance of support, warranty, indemnity, or 160 | other liability obligations and/or rights consistent with this License. However, 161 | in accepting such obligations, You may act only on Your own behalf and on Your 162 | sole responsibility, not on behalf of any other Contributor, and only if You 163 | agree to indemnify, defend, and hold each Contributor harmless for any liability 164 | incurred by, or claims asserted against, such Contributor by reason of your 165 | accepting any such warranty or additional liability. 166 | 167 | END OF TERMS AND CONDITIONS 168 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # yaml-json-validator-maven-plugin 2 | 3 | [![Build Status](https://travis-ci.org/sylvainlaurent/yaml-json-validator-maven-plugin.svg?branch=master)](https://travis-ci.org/sylvainlaurent/yaml-json-validator-maven-plugin) 4 | 5 | This maven plugin allows to validate yaml and json files to check that they are well formed and optionally validate against JSON schemas. 6 | 7 | Both JSON and YAML files can be validated against a JSON schema. The library [fge/json-schema-validator](https://github.com/fge/json-schema-validator) is internally used for this. 8 | 9 | ## Plugin configuration 10 | 11 | ```xml 12 | 13 | com.github.sylvainlaurent.maven 14 | yaml-json-validator-maven-plugin 15 | ... 16 | 17 | 18 | validate 19 | validate 20 | 21 | validate 22 | 23 | 24 | 25 | 26 | src/main/resources/my-schema.json 27 | 28 | src/main/resources/*.json 29 | 30 | 31 | src/main/resources/do-not-validate*.json 32 | 33 | 34 | 35 | 36 | 37 | 38 | src/main/resources/*.yml 39 | 40 | 41 | 42 | 43 | false 44 | false 45 | 46 | true 47 | 48 | true 49 | false 50 | 51 | 52 | 53 | 54 | ``` 55 | 56 | Validation failures make the build fail. 57 | 58 | Requires java 1.7. 59 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4.0.0 4 | com.github.sylvainlaurent.maven 5 | yaml-json-validator-maven-plugin 6 | 1.0.5-SNAPSHOT 7 | maven-plugin 8 | yaml-json-validator-maven-plugin Maven Plugin 9 | A Maven Plugin to validate yaml and json document 10 | https://github.com/sylvainlaurent/yaml-json-validator-maven-plugin 11 | 12 | 13 | 14 | The Apache Software License, Version 2.0 15 | http://www.apache.org/licenses/LICENSE-2.0 16 | 17 | 18 | 19 | 20 | 21 | Sylvain LAURENT 22 | slaurent@apache.org 23 | 24 | 25 | 26 | 27 | scm:git:https://github.com/sylvainlaurent/yaml-json-validator-maven-plugin.git 28 | scm:git:https://github.com/sylvainlaurent/yaml-json-validator-maven-plugin.git 29 | HEAD 30 | https://github.com/sylvainlaurent/yaml-json-validator-maven-plugin 31 | 32 | 33 | 34 | 35 | ossrh 36 | https://oss.sonatype.org/content/repositories/snapshots 37 | 38 | 39 | 40 | 41 | UTF-8 42 | 1.8 43 | 2.2.14 44 | 2.11.2 45 | 46 | 47 | 48 | 49 | org.apache.maven 50 | maven-plugin-api 51 | 3.3.9 52 | 53 | 54 | org.apache.maven.plugin-tools 55 | maven-plugin-annotations 56 | 3.4 57 | provided 58 | 59 | 60 | org.codehaus.plexus 61 | plexus-utils 62 | 3.3.0 63 | 64 | 65 | com.fasterxml.jackson.dataformat 66 | jackson-dataformat-yaml 67 | 68 | 69 | com.github.java-json-tools 70 | json-schema-validator 71 | ${json-schema-validator-version} 72 | 73 | 74 | org.junit.jupiter 75 | junit-jupiter-api 76 | test 77 | 78 | 79 | org.junit.jupiter 80 | junit-jupiter-engine 81 | test 82 | 83 | 84 | org.slf4j 85 | slf4j-simple 86 | 1.7.30 87 | test 88 | 89 | 90 | 91 | 92 | 93 | 94 | com.fasterxml.jackson 95 | jackson-bom 96 | ${jackson-version} 97 | import 98 | pom 99 | 100 | 101 | org.junit 102 | junit-bom 103 | 5.7.0 104 | import 105 | pom 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | org.apache.maven.plugins 115 | maven-compiler-plugin 116 | 3.8.1 117 | 118 | ${java.version} 119 | ${java.version} 120 | 121 | 122 | 123 | org.apache.maven.plugins 124 | maven-surefire-plugin 125 | 3.0.0-M5 126 | 127 | 128 | 129 | 130 | 131 | 132 | org.apache.maven.plugins 133 | maven-plugin-plugin 134 | 3.6.0 135 | 136 | 137 | mojo-descriptor 138 | 139 | descriptor 140 | 141 | 142 | 143 | help-goal 144 | 145 | helpmojo 146 | 147 | 148 | 149 | 150 | yaml-json-validator 151 | true 152 | 153 | 154 | 155 | org.apache.maven.plugins 156 | maven-invoker-plugin 157 | 3.2.1 158 | 159 | 160 | integration-test 161 | 162 | install 163 | integration-test 164 | verify 165 | 166 | 167 | 168 | 169 | true 170 | ${project.build.directory}/it 171 | 172 | */pom.xml 173 | 174 | verify 175 | ${project.build.directory}/local-repo 176 | src/it/settings.xml 177 | 178 | clean 179 | test-compile 180 | 181 | 182 | 183 | 184 | org.apache.maven.plugins 185 | maven-release-plugin 186 | 2.5 187 | 188 | true 189 | true 190 | false 191 | @{project.version} 192 | 193 | 194 | 195 | org.sonatype.plugins 196 | nexus-staging-maven-plugin 197 | 1.6.2 198 | true 199 | 200 | ossrh 201 | https://oss.sonatype.org/ 202 | true 203 | 204 | 205 | 206 | org.apache.maven.plugins 207 | maven-enforcer-plugin 208 | 3.0.0-M3 209 | 210 | 211 | enforce-versions 212 | 213 | enforce 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | release-profile 229 | 230 | 231 | performRelease 232 | true 233 | 234 | 235 | 236 | 237 | 238 | org.apache.maven.plugins 239 | maven-gpg-plugin 240 | 1.5 241 | 242 | 243 | sign-artifacts 244 | verify 245 | 246 | sign 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | -------------------------------------------------------------------------------- /src/it/allow-json-comments/invoker.properties: -------------------------------------------------------------------------------- 1 | invoker.buildResult = success 2 | -------------------------------------------------------------------------------- /src/it/allow-json-comments/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 8 | 4.0.0 9 | 10 | com.github.sylvainlaurent.maven.it 11 | validate-it 12 | 1.0-SNAPSHOT 13 | 14 | 15 | 16 | UTF-8 17 | 18 | 19 | 20 | 21 | 22 | @project.groupId@ 23 | @project.artifactId@ 24 | @project.version@ 25 | 26 | 27 | validate 28 | validate 29 | 30 | validate 31 | 32 | 33 | 34 | 35 | 36 | src/main/resources/*.json 37 | 38 | 39 | 40 | true 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /src/it/allow-json-comments/src/main/resources/allow-json-comments.json: -------------------------------------------------------------------------------- 1 | { 2 | // this is an inline comment 3 | "id": 1, 4 | /* this is a comment */ 5 | "value": "XYZ" 6 | } 7 | -------------------------------------------------------------------------------- /src/it/allowed-empty-files/invoker.properties: -------------------------------------------------------------------------------- 1 | invoker.buildResult = success -------------------------------------------------------------------------------- /src/it/allowed-empty-files/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | com.github.sylvainlaurent.maven.it 7 | validate-it 8 | 1.0-SNAPSHOT 9 | 10 | 11 | 12 | UTF-8 13 | 14 | 15 | 16 | 17 | 18 | @project.groupId@ 19 | @project.artifactId@ 20 | @project.version@ 21 | 22 | 23 | validate 24 | validate 25 | 26 | validate 27 | 28 | 29 | true 30 | 31 | 32 | 33 | src/main/resources/*.yml 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /src/it/allowed-empty-files/src/main/resources/empty.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sylvainlaurent/yaml-json-validator-maven-plugin/673ed69da8315dcfd0ea19f1f7e059506da98eab/src/it/allowed-empty-files/src/main/resources/empty.json -------------------------------------------------------------------------------- /src/it/allowed-empty-files/src/main/resources/empty.yml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sylvainlaurent/yaml-json-validator-maven-plugin/673ed69da8315dcfd0ea19f1f7e059506da98eab/src/it/allowed-empty-files/src/main/resources/empty.yml -------------------------------------------------------------------------------- /src/it/allowed-trailing-comma/invoker.properties: -------------------------------------------------------------------------------- 1 | invoker.buildResult = success -------------------------------------------------------------------------------- /src/it/allowed-trailing-comma/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | com.github.sylvainlaurent.maven.it 7 | validate-it 8 | 1.0-SNAPSHOT 9 | 10 | 11 | 12 | UTF-8 13 | 14 | 15 | 16 | 17 | 18 | @project.groupId@ 19 | @project.artifactId@ 20 | @project.version@ 21 | 22 | 23 | validate 24 | validate 25 | 26 | validate 27 | 28 | 29 | true 30 | 31 | 32 | 33 | src/main/resources/*.yml 34 | src/main/resources/*.json 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /src/it/allowed-trailing-comma/src/main/resources/trailing-comma.json: -------------------------------------------------------------------------------- 1 | { 2 | "list": [1, 2,], 3 | "second": 1, 4 | } -------------------------------------------------------------------------------- /src/it/allowed-trailing-comma/src/main/resources/trailing-comma.yml: -------------------------------------------------------------------------------- 1 | root: 2 | list: [1, 2,] 3 | dict: { value: key, value2: key2, } 4 | -------------------------------------------------------------------------------- /src/it/duplicate-keys-json/invoker.properties: -------------------------------------------------------------------------------- 1 | invoker.buildResult = failure -------------------------------------------------------------------------------- /src/it/duplicate-keys-json/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | com.github.sylvainlaurent.maven.it 7 | validate-it 8 | 1.0-SNAPSHOT 9 | 10 | 11 | 12 | UTF-8 13 | 14 | 15 | 16 | 17 | 18 | @project.groupId@ 19 | @project.artifactId@ 20 | @project.version@ 21 | 22 | 23 | validate 24 | validate 25 | 26 | validate 27 | 28 | 29 | 30 | 31 | 32 | src/main/resources/*.json 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /src/it/duplicate-keys-json/src/main/resources/duplicate-keys.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": 1, 3 | "value": "XYZ", 4 | "id": 2 5 | } -------------------------------------------------------------------------------- /src/it/duplicate-keys-yaml/invoker.properties: -------------------------------------------------------------------------------- 1 | invoker.buildResult = failure -------------------------------------------------------------------------------- /src/it/duplicate-keys-yaml/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | com.github.sylvainlaurent.maven.it 7 | validate-it 8 | 1.0-SNAPSHOT 9 | 10 | 11 | 12 | UTF-8 13 | 14 | 15 | 16 | 17 | 18 | @project.groupId@ 19 | @project.artifactId@ 20 | @project.version@ 21 | 22 | 23 | validate 24 | validate 25 | 26 | validate 27 | 28 | 29 | 30 | 31 | 32 | src/main/resources/*.yml 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /src/it/duplicate-keys-yaml/src/main/resources/duplicate-keys.yml: -------------------------------------------------------------------------------- 1 | item: 2 | id: 1 3 | value: XYZ 4 | id: 2 5 | 6 | -------------------------------------------------------------------------------- /src/it/multiple-validation-sets/invoker.properties: -------------------------------------------------------------------------------- 1 | invoker.buildResult = failure -------------------------------------------------------------------------------- /src/it/multiple-validation-sets/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | com.github.sylvainlaurent.maven.it 7 | validate-it 8 | 1.0-SNAPSHOT 9 | 10 | 11 | 12 | UTF-8 13 | 14 | 15 | 16 | 17 | 18 | @project.groupId@ 19 | @project.artifactId@ 20 | @project.version@ 21 | 22 | 23 | validate 24 | validate 25 | 26 | validate 27 | 28 | 29 | 30 | 31 | src/main/resources/swagger-schema.json 32 | 33 | src/main/resources/swagger-editor-example.yml 34 | 35 | 36 | 37 | 38 | src/main/resources/malformed.yml 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /src/it/multiple-validation-sets/src/main/resources/malformed.yml: -------------------------------------------------------------------------------- 1 | hello: 2 | world: "toto 3 | -------------------------------------------------------------------------------- /src/it/multiple-validation-sets/src/main/resources/swagger-editor-example.yml: -------------------------------------------------------------------------------- 1 | # this is an example of the Uber API 2 | # as a demonstration of an API spec in YAML 3 | swagger: '2.0' 4 | info: 5 | title: Uber API 6 | description: Move your app forward with the Uber API 7 | version: "1.0.0" 8 | # the domain of the service 9 | host: api.uber.com 10 | # array of all schemes that your API supports 11 | schemes: 12 | - https 13 | # will be prefixed to all paths 14 | basePath: /v1 15 | produces: 16 | - application/json 17 | paths: 18 | /products: 19 | get: 20 | summary: Product Types 21 | description: | 22 | The Products endpoint returns information about the *Uber* products 23 | offered at a given location. The response includes the display name 24 | and other details about each product, and lists the products in the 25 | proper display order. 26 | parameters: 27 | - name: latitude 28 | in: query 29 | description: Latitude component of location. 30 | required: true 31 | type: number 32 | format: double 33 | - name: longitude 34 | in: query 35 | description: Longitude component of location. 36 | required: true 37 | type: number 38 | format: double 39 | tags: 40 | - Products 41 | responses: 42 | 200: 43 | description: An array of products 44 | schema: 45 | type: array 46 | items: 47 | $ref: '#/definitions/Product' 48 | default: 49 | description: Unexpected error 50 | schema: 51 | $ref: '#/definitions/Error' 52 | /estimates/price: 53 | get: 54 | summary: Price Estimates 55 | description: | 56 | The Price Estimates endpoint returns an estimated price range 57 | for each product offered at a given location. The price estimate is 58 | provided as a formatted string with the full price range and the localized 59 | currency symbol.

The response also includes low and high estimates, 60 | and the [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217) currency code for 61 | situations requiring currency conversion. When surge is active for a particular 62 | product, its surge_multiplier will be greater than 1, but the price estimate 63 | already factors in this multiplier. 64 | parameters: 65 | - name: start_latitude 66 | in: query 67 | description: Latitude component of start location. 68 | required: true 69 | type: number 70 | format: double 71 | - name: start_longitude 72 | in: query 73 | description: Longitude component of start location. 74 | required: true 75 | type: number 76 | format: double 77 | - name: end_latitude 78 | in: query 79 | description: Latitude component of end location. 80 | required: true 81 | type: number 82 | format: double 83 | - name: end_longitude 84 | in: query 85 | description: Longitude component of end location. 86 | required: true 87 | type: number 88 | format: double 89 | tags: 90 | - Estimates 91 | responses: 92 | 200: 93 | description: An array of price estimates by product 94 | schema: 95 | type: array 96 | items: 97 | $ref: '#/definitions/PriceEstimate' 98 | default: 99 | description: Unexpected error 100 | schema: 101 | $ref: '#/definitions/Error' 102 | /estimates/time: 103 | get: 104 | summary: Time Estimates 105 | description: The Time Estimates endpoint returns ETAs for all products offered at a given location, with the responses expressed as integers in seconds. We recommend that this endpoint be called every minute to provide the most accurate, up-to-date ETAs. 106 | parameters: 107 | - name: start_latitude 108 | in: query 109 | description: Latitude component of start location. 110 | required: true 111 | type: number 112 | format: double 113 | - name: start_longitude 114 | in: query 115 | description: Longitude component of start location. 116 | required: true 117 | type: number 118 | format: double 119 | - name: customer_uuid 120 | in: query 121 | type: string 122 | format: uuid 123 | description: Unique customer identifier to be used for experience customization. 124 | - name: product_id 125 | in: query 126 | type: string 127 | description: Unique identifier representing a specific product for a given latitude & longitude. 128 | tags: 129 | - Estimates 130 | responses: 131 | 200: 132 | description: An array of products 133 | schema: 134 | type: array 135 | items: 136 | $ref: '#/definitions/Product' 137 | default: 138 | description: Unexpected error 139 | schema: 140 | $ref: '#/definitions/Error' 141 | /me: 142 | get: 143 | summary: User Profile 144 | description: The User Profile endpoint returns information about the Uber user that has authorized with the application. 145 | tags: 146 | - User 147 | responses: 148 | 200: 149 | description: Profile information for a user 150 | schema: 151 | $ref: '#/definitions/Profile' 152 | default: 153 | description: Unexpected error 154 | schema: 155 | $ref: '#/definitions/Error' 156 | /history: 157 | get: 158 | summary: User Activity 159 | description: The User Activity endpoint returns data about a user's lifetime activity with Uber. The response will include pickup locations and times, dropoff locations and times, the distance of past requests, and information about which products were requested.

The history array in the response will have a maximum length based on the limit parameter. The response value count may exceed limit, therefore subsequent API requests may be necessary. 160 | parameters: 161 | - name: offset 162 | in: query 163 | type: integer 164 | format: int32 165 | description: Offset the list of returned results by this amount. Default is zero. 166 | - name: limit 167 | in: query 168 | type: integer 169 | format: int32 170 | description: Number of items to retrieve. Default is 5, maximum is 100. 171 | tags: 172 | - User 173 | responses: 174 | 200: 175 | description: History information for the given user 176 | schema: 177 | $ref: '#/definitions/Activities' 178 | default: 179 | description: Unexpected error 180 | schema: 181 | $ref: '#/definitions/Error' 182 | definitions: 183 | Product: 184 | type: object 185 | properties: 186 | product_id: 187 | type: string 188 | description: Unique identifier representing a specific product for a given latitude & longitude. For example, uberX in San Francisco will have a different product_id than uberX in Los Angeles. 189 | description: 190 | type: string 191 | description: Description of product. 192 | display_name: 193 | type: string 194 | description: Display name of product. 195 | capacity: 196 | type: string 197 | description: Capacity of product. For example, 4 people. 198 | image: 199 | type: string 200 | description: Image URL representing the product. 201 | PriceEstimate: 202 | type: object 203 | properties: 204 | product_id: 205 | type: string 206 | description: Unique identifier representing a specific product for a given latitude & longitude. For example, uberX in San Francisco will have a different product_id than uberX in Los Angeles 207 | currency_code: 208 | type: string 209 | description: "[ISO 4217](http://en.wikipedia.org/wiki/ISO_4217) currency code." 210 | display_name: 211 | type: string 212 | description: Display name of product. 213 | estimate: 214 | type: string 215 | description: Formatted string of estimate in local currency of the start location. Estimate could be a range, a single number (flat rate) or "Metered" for TAXI. 216 | low_estimate: 217 | type: number 218 | description: Lower bound of the estimated price. 219 | high_estimate: 220 | type: number 221 | description: Upper bound of the estimated price. 222 | surge_multiplier: 223 | type: number 224 | description: Expected surge multiplier. Surge is active if surge_multiplier is greater than 1. Price estimate already factors in the surge multiplier. 225 | Profile: 226 | type: object 227 | properties: 228 | first_name: 229 | type: string 230 | description: First name of the Uber user. 231 | last_name: 232 | type: string 233 | description: Last name of the Uber user. 234 | email: 235 | type: string 236 | description: Email address of the Uber user 237 | picture: 238 | type: string 239 | description: Image URL of the Uber user. 240 | promo_code: 241 | type: string 242 | description: Promo code of the Uber user. 243 | Activity: 244 | type: object 245 | properties: 246 | uuid: 247 | type: string 248 | description: Unique identifier for the activity 249 | Activities: 250 | type: object 251 | properties: 252 | offset: 253 | type: integer 254 | format: int32 255 | description: Position in pagination. 256 | limit: 257 | type: integer 258 | format: int32 259 | description: Number of items to retrieve (100 max). 260 | count: 261 | type: integer 262 | format: int32 263 | description: Total number of items available. 264 | history: 265 | type: array 266 | items: 267 | $ref: '#/definitions/Activity' 268 | Error: 269 | type: object 270 | properties: 271 | code: 272 | type: integer 273 | format: int32 274 | message: 275 | type: string 276 | fields: 277 | type: string 278 | -------------------------------------------------------------------------------- /src/it/settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 21 | 22 | 23 | 24 | 25 | it-repo 26 | 27 | true 28 | 29 | 30 | 31 | local.central 32 | @localRepositoryUrl@ 33 | 34 | true 35 | 36 | 37 | true 38 | 39 | 40 | 41 | 42 | 43 | local.central 44 | @localRepositoryUrl@ 45 | 46 | true 47 | 48 | 49 | true 50 | 51 | 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /src/it/validate-fails/invoker.properties: -------------------------------------------------------------------------------- 1 | invoker.buildResult = failure -------------------------------------------------------------------------------- /src/it/validate-fails/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | com.github.sylvainlaurent.maven.it 7 | validate-it 8 | 1.0-SNAPSHOT 9 | 10 | 11 | 12 | UTF-8 13 | 14 | 15 | 16 | 17 | 18 | @project.groupId@ 19 | @project.artifactId@ 20 | @project.version@ 21 | 22 | 23 | validate 24 | validate 25 | 26 | validate 27 | 28 | 29 | 30 | 31 | src/main/resources/swagger-schema.json 32 | 33 | src/main/resources/not-valid.yml 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /src/it/validate-fails/src/main/resources/not-valid.yml: -------------------------------------------------------------------------------- 1 | # this is an example of the Uber API 2 | # as a demonstration of an API spec in YAML 3 | swagger: '2.0' 4 | info: 5 | title: Uber API 6 | description: Move your app forward with the Uber API 7 | version: "1.0.0" 8 | # the domain of the service 9 | host: api.uber.com 10 | # array of all schemes that your API supports 11 | schemes: 12 | - https 13 | # will be prefixed to all paths 14 | basePath: /v1 15 | produces: 16 | - application/json 17 | paths: 18 | /products: 19 | get: 20 | summary: Product Types 21 | description: | 22 | The Products endpoint returns information about the *Uber* products 23 | offered at a given location. The response includes the display name 24 | and other details about each product, and lists the products in the 25 | proper display order. 26 | parameters: 27 | - name: latitude 28 | in: query2 29 | description: Latitude component of location. 30 | required: true 31 | type: number 32 | format: double 33 | - name: longitude 34 | in: query 35 | description: Longitude component of location. 36 | required: true 37 | type: number 38 | format: double 39 | tags: 40 | - Products 41 | responses: 42 | 200: 43 | description: An array of products 44 | schema: 45 | type: array 46 | items: 47 | $ref: '#/definitions/Product' 48 | default: 49 | description: Unexpected error 50 | schema: 51 | $ref: '#/definitions/Error' 52 | /estimates/price: 53 | get: 54 | summary: Price Estimates 55 | description: | 56 | The Price Estimates endpoint returns an estimated price range 57 | for each product offered at a given location. The price estimate is 58 | provided as a formatted string with the full price range and the localized 59 | currency symbol.

The response also includes low and high estimates, 60 | and the [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217) currency code for 61 | situations requiring currency conversion. When surge is active for a particular 62 | product, its surge_multiplier will be greater than 1, but the price estimate 63 | already factors in this multiplier. 64 | parameters: 65 | - name: start_latitude 66 | in: query 67 | description: Latitude component of start location. 68 | required: true 69 | type: number 70 | format: double 71 | - name: start_longitude 72 | in: query 73 | description: Longitude component of start location. 74 | required: true 75 | type: number 76 | format: double 77 | - name: end_latitude 78 | in: query 79 | description: Latitude component of end location. 80 | required: true 81 | type: number 82 | format: double 83 | - name: end_longitude 84 | in: query 85 | description: Longitude component of end location. 86 | required: true 87 | type: number 88 | format: double 89 | tags: 90 | - Estimates 91 | responses: 92 | 200: 93 | description: An array of price estimates by product 94 | schema: 95 | type: array 96 | items: 97 | $ref: '#/definitions/PriceEstimate' 98 | default: 99 | description: Unexpected error 100 | schema: 101 | $ref: '#/definitions/Error' 102 | /estimates/time: 103 | get: 104 | summary: Time Estimates 105 | description: The Time Estimates endpoint returns ETAs for all products offered at a given location, with the responses expressed as integers in seconds. We recommend that this endpoint be called every minute to provide the most accurate, up-to-date ETAs. 106 | parameters: 107 | - name: start_latitude 108 | in: query 109 | description: Latitude component of start location. 110 | required: true 111 | type: number 112 | format: double 113 | - name: start_longitude 114 | in: query 115 | description: Longitude component of start location. 116 | required: true 117 | type: number 118 | format: double 119 | - name: customer_uuid 120 | in: query 121 | type: string 122 | format: uuid 123 | description: Unique customer identifier to be used for experience customization. 124 | - name: product_id 125 | in: query 126 | type: string 127 | description: Unique identifier representing a specific product for a given latitude & longitude. 128 | tags: 129 | - Estimates 130 | responses: 131 | 200: 132 | description: An array of products 133 | schema: 134 | type: array 135 | items: 136 | $ref: '#/definitions/Product' 137 | default: 138 | description: Unexpected error 139 | schema: 140 | $ref: '#/definitions/Error' 141 | /me: 142 | get: 143 | summary: User Profile 144 | description: The User Profile endpoint returns information about the Uber user that has authorized with the application. 145 | tags: 146 | - User 147 | responses: 148 | 200: 149 | description: Profile information for a user 150 | schema: 151 | $ref: '#/definitions/Profile' 152 | default: 153 | description: Unexpected error 154 | schema: 155 | $ref: '#/definitions/Error' 156 | /history: 157 | get: 158 | summary: User Activity 159 | description: The User Activity endpoint returns data about a user's lifetime activity with Uber. The response will include pickup locations and times, dropoff locations and times, the distance of past requests, and information about which products were requested.

The history array in the response will have a maximum length based on the limit parameter. The response value count may exceed limit, therefore subsequent API requests may be necessary. 160 | parameters: 161 | - name: offset 162 | in: query 163 | type: integer 164 | format: int32 165 | description: Offset the list of returned results by this amount. Default is zero. 166 | - name: limit 167 | in: query 168 | type: integer 169 | format: int32 170 | description: Number of items to retrieve. Default is 5, maximum is 100. 171 | tags: 172 | - User 173 | responses: 174 | 200: 175 | description: History information for the given user 176 | schema: 177 | $ref: '#/definitions/Activities' 178 | default: 179 | description: Unexpected error 180 | schema: 181 | $ref: '#/definitions/Error' 182 | definitions: 183 | Product: 184 | type: object 185 | properties: 186 | product_id: 187 | type: string 188 | description: Unique identifier representing a specific product for a given latitude & longitude. For example, uberX in San Francisco will have a different product_id than uberX in Los Angeles. 189 | description: 190 | type: string 191 | description: Description of product. 192 | display_name: 193 | type: string 194 | description: Display name of product. 195 | capacity: 196 | type: string 197 | description: Capacity of product. For example, 4 people. 198 | image: 199 | type: string 200 | description: Image URL representing the product. 201 | PriceEstimate: 202 | type: object 203 | properties: 204 | product_id: 205 | type: string 206 | description: Unique identifier representing a specific product for a given latitude & longitude. For example, uberX in San Francisco will have a different product_id than uberX in Los Angeles 207 | currency_code: 208 | type: string 209 | description: "[ISO 4217](http://en.wikipedia.org/wiki/ISO_4217) currency code." 210 | display_name: 211 | type: string 212 | description: Display name of product. 213 | estimate: 214 | type: string 215 | description: Formatted string of estimate in local currency of the start location. Estimate could be a range, a single number (flat rate) or "Metered" for TAXI. 216 | low_estimate: 217 | type: number 218 | description: Lower bound of the estimated price. 219 | high_estimate: 220 | type: number 221 | description: Upper bound of the estimated price. 222 | surge_multiplier: 223 | type: number 224 | description: Expected surge multiplier. Surge is active if surge_multiplier is greater than 1. Price estimate already factors in the surge multiplier. 225 | Profile: 226 | type: object 227 | properties: 228 | first_name: 229 | type: string 230 | description: First name of the Uber user. 231 | last_name: 232 | type: string 233 | description: Last name of the Uber user. 234 | email: 235 | type: string 236 | description: Email address of the Uber user 237 | picture: 238 | type: string 239 | description: Image URL of the Uber user. 240 | promo_code: 241 | type: string 242 | description: Promo code of the Uber user. 243 | Activity: 244 | type: object 245 | properties: 246 | uuid: 247 | type: string 248 | description: Unique identifier for the activity 249 | Activities: 250 | type: object 251 | properties: 252 | offset: 253 | type: integer 254 | format: int32 255 | description: Position in pagination. 256 | limit: 257 | type: integer 258 | format: int32 259 | description: Number of items to retrieve (100 max). 260 | count: 261 | type: integer 262 | format: int32 263 | description: Total number of items available. 264 | history: 265 | type: array 266 | items: 267 | $ref: '#/definitions/Activity' 268 | Error: 269 | type: object 270 | properties: 271 | code: 272 | type: integer 273 | format: int32 274 | message: 275 | type: string 276 | fields: 277 | type: string 278 | -------------------------------------------------------------------------------- /src/it/validate-skipped/invoker.properties: -------------------------------------------------------------------------------- 1 | invoker.buildResult = success -------------------------------------------------------------------------------- /src/it/validate-skipped/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | com.github.sylvainlaurent.maven.it 7 | validate-it 8 | 1.0-SNAPSHOT 9 | 10 | 11 | 12 | UTF-8 13 | 14 | 15 | 16 | 17 | 18 | @project.groupId@ 19 | @project.artifactId@ 20 | @project.version@ 21 | 22 | 23 | validate 24 | validate 25 | 26 | validate 27 | 28 | 29 | true 30 | 31 | 32 | 33 | src/main/resources/test.yml 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /src/it/validate-skipped/src/main/resources/test.yml: -------------------------------------------------------------------------------- 1 | root: 2 | - item 3 | key: value 4 | -------------------------------------------------------------------------------- /src/it/validate-succeeds/invoker.properties: -------------------------------------------------------------------------------- 1 | invoker.buildResult = success -------------------------------------------------------------------------------- /src/it/validate-succeeds/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | com.github.sylvainlaurent.maven.it 7 | validate-it 8 | 1.0-SNAPSHOT 9 | 10 | 11 | 12 | UTF-8 13 | 14 | 15 | 16 | 17 | 18 | @project.groupId@ 19 | @project.artifactId@ 20 | @project.version@ 21 | 22 | 23 | validate 24 | validate 25 | 26 | validate 27 | 28 | 29 | false 30 | 31 | 32 | src/main/resources/swagger-schema.json 33 | 34 | src/main/resources/swagger-*.yml 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /src/it/validate-succeeds/src/main/resources/swagger-editor-example.yml: -------------------------------------------------------------------------------- 1 | # this is an example of the Uber API 2 | # as a demonstration of an API spec in YAML 3 | swagger: '2.0' 4 | # Intentional duplicate here to make sure it passes validation 5 | # if detection of duplicate keys is not enabled: 6 | swagger: '2.0' 7 | info: 8 | title: Uber API 9 | description: Move your app forward with the Uber API 10 | version: "1.0.0" 11 | # the domain of the service 12 | host: api.uber.com 13 | # array of all schemes that your API supports 14 | schemes: 15 | - https 16 | # will be prefixed to all paths 17 | basePath: /v1 18 | produces: 19 | - application/json 20 | paths: 21 | /products: 22 | get: 23 | summary: Product Types 24 | description: | 25 | The Products endpoint returns information about the *Uber* products 26 | offered at a given location. The response includes the display name 27 | and other details about each product, and lists the products in the 28 | proper display order. 29 | parameters: 30 | - name: latitude 31 | in: query 32 | description: Latitude component of location. 33 | required: true 34 | type: number 35 | format: double 36 | - name: longitude 37 | in: query 38 | description: Longitude component of location. 39 | required: true 40 | type: number 41 | format: double 42 | tags: 43 | - Products 44 | responses: 45 | 200: 46 | description: An array of products 47 | schema: 48 | type: array 49 | items: 50 | $ref: '#/definitions/Product' 51 | default: 52 | description: Unexpected error 53 | schema: 54 | $ref: '#/definitions/Error' 55 | /estimates/price: 56 | get: 57 | summary: Price Estimates 58 | description: | 59 | The Price Estimates endpoint returns an estimated price range 60 | for each product offered at a given location. The price estimate is 61 | provided as a formatted string with the full price range and the localized 62 | currency symbol.

The response also includes low and high estimates, 63 | and the [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217) currency code for 64 | situations requiring currency conversion. When surge is active for a particular 65 | product, its surge_multiplier will be greater than 1, but the price estimate 66 | already factors in this multiplier. 67 | parameters: 68 | - name: start_latitude 69 | in: query 70 | description: Latitude component of start location. 71 | required: true 72 | type: number 73 | format: double 74 | - name: start_longitude 75 | in: query 76 | description: Longitude component of start location. 77 | required: true 78 | type: number 79 | format: double 80 | - name: end_latitude 81 | in: query 82 | description: Latitude component of end location. 83 | required: true 84 | type: number 85 | format: double 86 | - name: end_longitude 87 | in: query 88 | description: Longitude component of end location. 89 | required: true 90 | type: number 91 | format: double 92 | tags: 93 | - Estimates 94 | responses: 95 | 200: 96 | description: An array of price estimates by product 97 | schema: 98 | type: array 99 | items: 100 | $ref: '#/definitions/PriceEstimate' 101 | default: 102 | description: Unexpected error 103 | schema: 104 | $ref: '#/definitions/Error' 105 | /estimates/time: 106 | get: 107 | summary: Time Estimates 108 | description: The Time Estimates endpoint returns ETAs for all products offered at a given location, with the responses expressed as integers in seconds. We recommend that this endpoint be called every minute to provide the most accurate, up-to-date ETAs. 109 | parameters: 110 | - name: start_latitude 111 | in: query 112 | description: Latitude component of start location. 113 | required: true 114 | type: number 115 | format: double 116 | - name: start_longitude 117 | in: query 118 | description: Longitude component of start location. 119 | required: true 120 | type: number 121 | format: double 122 | - name: customer_uuid 123 | in: query 124 | type: string 125 | format: uuid 126 | description: Unique customer identifier to be used for experience customization. 127 | - name: product_id 128 | in: query 129 | type: string 130 | description: Unique identifier representing a specific product for a given latitude & longitude. 131 | tags: 132 | - Estimates 133 | responses: 134 | 200: 135 | description: An array of products 136 | schema: 137 | type: array 138 | items: 139 | $ref: '#/definitions/Product' 140 | default: 141 | description: Unexpected error 142 | schema: 143 | $ref: '#/definitions/Error' 144 | /me: 145 | get: 146 | summary: User Profile 147 | description: The User Profile endpoint returns information about the Uber user that has authorized with the application. 148 | tags: 149 | - User 150 | responses: 151 | 200: 152 | description: Profile information for a user 153 | schema: 154 | $ref: '#/definitions/Profile' 155 | default: 156 | description: Unexpected error 157 | schema: 158 | $ref: '#/definitions/Error' 159 | /history: 160 | get: 161 | summary: User Activity 162 | description: The User Activity endpoint returns data about a user's lifetime activity with Uber. The response will include pickup locations and times, dropoff locations and times, the distance of past requests, and information about which products were requested.

The history array in the response will have a maximum length based on the limit parameter. The response value count may exceed limit, therefore subsequent API requests may be necessary. 163 | parameters: 164 | - name: offset 165 | in: query 166 | type: integer 167 | format: int32 168 | description: Offset the list of returned results by this amount. Default is zero. 169 | - name: limit 170 | in: query 171 | type: integer 172 | format: int32 173 | description: Number of items to retrieve. Default is 5, maximum is 100. 174 | tags: 175 | - User 176 | responses: 177 | 200: 178 | description: History information for the given user 179 | schema: 180 | $ref: '#/definitions/Activities' 181 | default: 182 | description: Unexpected error 183 | schema: 184 | $ref: '#/definitions/Error' 185 | definitions: 186 | Product: 187 | type: object 188 | properties: 189 | product_id: 190 | type: string 191 | description: Unique identifier representing a specific product for a given latitude & longitude. For example, uberX in San Francisco will have a different product_id than uberX in Los Angeles. 192 | description: 193 | type: string 194 | description: Description of product. 195 | display_name: 196 | type: string 197 | description: Display name of product. 198 | capacity: 199 | type: string 200 | description: Capacity of product. For example, 4 people. 201 | image: 202 | type: string 203 | description: Image URL representing the product. 204 | PriceEstimate: 205 | type: object 206 | properties: 207 | product_id: 208 | type: string 209 | description: Unique identifier representing a specific product for a given latitude & longitude. For example, uberX in San Francisco will have a different product_id than uberX in Los Angeles 210 | currency_code: 211 | type: string 212 | description: "[ISO 4217](http://en.wikipedia.org/wiki/ISO_4217) currency code." 213 | display_name: 214 | type: string 215 | description: Display name of product. 216 | estimate: 217 | type: string 218 | description: Formatted string of estimate in local currency of the start location. Estimate could be a range, a single number (flat rate) or "Metered" for TAXI. 219 | low_estimate: 220 | type: number 221 | description: Lower bound of the estimated price. 222 | high_estimate: 223 | type: number 224 | description: Upper bound of the estimated price. 225 | surge_multiplier: 226 | type: number 227 | description: Expected surge multiplier. Surge is active if surge_multiplier is greater than 1. Price estimate already factors in the surge multiplier. 228 | Profile: 229 | type: object 230 | properties: 231 | first_name: 232 | type: string 233 | description: First name of the Uber user. 234 | last_name: 235 | type: string 236 | description: Last name of the Uber user. 237 | email: 238 | type: string 239 | description: Email address of the Uber user 240 | picture: 241 | type: string 242 | description: Image URL of the Uber user. 243 | promo_code: 244 | type: string 245 | description: Promo code of the Uber user. 246 | Activity: 247 | type: object 248 | properties: 249 | uuid: 250 | type: string 251 | description: Unique identifier for the activity 252 | Activities: 253 | type: object 254 | properties: 255 | offset: 256 | type: integer 257 | format: int32 258 | description: Position in pagination. 259 | limit: 260 | type: integer 261 | format: int32 262 | description: Number of items to retrieve (100 max). 263 | count: 264 | type: integer 265 | format: int32 266 | description: Total number of items available. 267 | history: 268 | type: array 269 | items: 270 | $ref: '#/definitions/Activity' 271 | Error: 272 | type: object 273 | properties: 274 | code: 275 | type: integer 276 | format: int32 277 | message: 278 | type: string 279 | fields: 280 | type: string 281 | -------------------------------------------------------------------------------- /src/it/well-formed-fails/invoker.properties: -------------------------------------------------------------------------------- 1 | invoker.buildResult = failure -------------------------------------------------------------------------------- /src/it/well-formed-fails/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | com.github.sylvainlaurent.maven.it 7 | validate-it 8 | 1.0-SNAPSHOT 9 | 10 | 11 | 12 | UTF-8 13 | 14 | 15 | 16 | 17 | 18 | @project.groupId@ 19 | @project.artifactId@ 20 | @project.version@ 21 | 22 | 23 | validate 24 | validate 25 | 26 | validate 27 | 28 | 29 | 30 | 31 | 32 | src/main/resources/*.yml 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /src/it/well-formed-fails/src/main/resources/malformed.yml: -------------------------------------------------------------------------------- 1 | hello: 2 | world: "toto 3 | -------------------------------------------------------------------------------- /src/main/java/com/github/sylvainlaurent/maven/yamljsonvalidator/ValidateMojo.java: -------------------------------------------------------------------------------- 1 | package com.github.sylvainlaurent.maven.yamljsonvalidator; 2 | 3 | import org.apache.maven.plugin.AbstractMojo; 4 | import org.apache.maven.plugin.MojoExecutionException; 5 | import org.apache.maven.plugins.annotations.LifecyclePhase; 6 | import org.apache.maven.plugins.annotations.Mojo; 7 | import org.apache.maven.plugins.annotations.Parameter; 8 | 9 | import java.io.File; 10 | import java.io.FileInputStream; 11 | import java.io.FileNotFoundException; 12 | import java.io.InputStream; 13 | 14 | /** 15 | * This mojo validates YAML and JSON files for well-formedness. If JSON schema is provided, it also 16 | * validates JSON files against it. 17 | */ 18 | @Mojo(name = "validate", defaultPhase = LifecyclePhase.PROCESS_SOURCES, threadSafe = true) 19 | public class ValidateMojo extends AbstractMojo { 20 | 21 | @Parameter(defaultValue = "${project.basedir}", required = true, readonly = true) 22 | private File basedir; 23 | 24 | /** 25 | *

Specification of files to be validated.

26 | * 27 | *

Use <includes> and 28 | * <excludes> elements with nested lists of <include> 29 | * and <exclude> elements respectively to specify lists of file masks of 30 | * included and excluded files. The file masks are treated as paths relative to 31 | * ${project.basedir} and their syntax is that of 32 | * org.codehaus.plexus.util.DirectoryScanner.

33 | * 34 | *

JSON schema can be specified with <jsonSchema> element.

35 | */ 36 | @Parameter 37 | private ValidationSet[] validationSets; 38 | 39 | /** 40 | * Set to false to disable printing of files being validated. 41 | */ 42 | @Parameter(defaultValue = "true") 43 | private boolean verbose; 44 | 45 | @Parameter(defaultValue = "false") 46 | private boolean skip; 47 | 48 | /** 49 | * Set to true to accept empty JSON and YAML files as valid. 50 | */ 51 | @Parameter(name = "allowEmptyFiles", defaultValue = "false") 52 | private boolean allowEmptyFiles; 53 | 54 | /** 55 | * Set to true to detect duplicate keys in JSON and YAML dictionaries. 56 | */ 57 | @Parameter(defaultValue = "true") 58 | private boolean detectDuplicateKeys; 59 | 60 | /** 61 | * Set to true to allow json validation to pass if Java/C style 62 | * comments have been placed in JSON files. 63 | */ 64 | @Parameter(defaultValue = "false") 65 | private boolean allowJsonComments; 66 | 67 | /** 68 | * Set to true to allow for single trailing comma following final value or member. 69 | */ 70 | @Parameter(defaultValue = "false") 71 | private boolean allowTrailingComma; 72 | 73 | @Override 74 | public void execute() throws MojoExecutionException { 75 | boolean encounteredError = false; 76 | 77 | if (skip) { 78 | getLog().info("Skipping validation"); 79 | return; 80 | } 81 | 82 | for (final ValidationSet set : validationSets) { 83 | InputStream inputStream = openJsonSchema(set.getJsonSchema()); 84 | final ValidationService validationService = new ValidationService( 85 | inputStream, 86 | allowEmptyFiles, 87 | detectDuplicateKeys, 88 | allowJsonComments, 89 | allowTrailingComma); 90 | 91 | final File[] files = set.getFiles(basedir); 92 | 93 | for (final File file : files) { 94 | if (verbose) { 95 | getLog().info("Validating file " + file); 96 | } 97 | final ValidationResult result = validationService.validate(file); 98 | if (result.hasError()) { 99 | encounteredError = true; 100 | } 101 | for (final String msg : result.getMessages()) { 102 | getLog().warn(msg); 103 | } 104 | } 105 | } 106 | 107 | if (encounteredError) { 108 | throw new MojoExecutionException("Some files are not valid, see previous logs"); 109 | } 110 | } 111 | 112 | InputStream openJsonSchema(String jsonSchemaFile) throws MojoExecutionException { 113 | if (jsonSchemaFile != null && jsonSchemaFile.length() > 0) { 114 | File file = new File(jsonSchemaFile); 115 | if (file.isFile()) { 116 | try { 117 | return new FileInputStream(file); 118 | } catch (FileNotFoundException e) { 119 | throw new MojoExecutionException("Could not load schema file ["+ jsonSchemaFile + "]", e); 120 | } 121 | } else { 122 | try { 123 | InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream(jsonSchemaFile); 124 | if (inputStream != null) { 125 | return inputStream; 126 | } 127 | throw new MojoExecutionException("Could not load schema neither from filesystem nor classpath ["+ jsonSchemaFile + "]"); 128 | } catch (Exception e){ 129 | throw new MojoExecutionException("Could not load schema file from classpath ["+ jsonSchemaFile + "]", e); 130 | } 131 | } 132 | } 133 | return null; 134 | } 135 | 136 | } 137 | -------------------------------------------------------------------------------- /src/main/java/com/github/sylvainlaurent/maven/yamljsonvalidator/ValidationResult.java: -------------------------------------------------------------------------------- 1 | package com.github.sylvainlaurent.maven.yamljsonvalidator; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | public class ValidationResult { 7 | private final Throwable exc; 8 | private final List messages = new ArrayList<>(); 9 | private boolean hasError; 10 | 11 | public ValidationResult() { 12 | exc = null; 13 | } 14 | 15 | public ValidationResult(Throwable exc) { 16 | this.exc = exc; 17 | } 18 | 19 | public static ValidationResult fromException(Throwable exc) { 20 | return new ValidationResult(exc); 21 | } 22 | 23 | public boolean hasError() { 24 | return hasError || exc != null; 25 | } 26 | 27 | public void encounteredError() { 28 | hasError = true; 29 | } 30 | 31 | public Throwable getExc() { 32 | return exc; 33 | } 34 | 35 | public void addMessage(String msg) { 36 | this.messages.add(msg); 37 | } 38 | 39 | public void addMessages(List msgs) { 40 | this.messages.addAll(msgs); 41 | } 42 | 43 | public List getMessages() { 44 | return messages; 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/com/github/sylvainlaurent/maven/yamljsonvalidator/ValidationService.java: -------------------------------------------------------------------------------- 1 | package com.github.sylvainlaurent.maven.yamljsonvalidator; 2 | 3 | import com.fasterxml.jackson.core.JsonParser.Feature; 4 | import com.fasterxml.jackson.databind.JsonNode; 5 | import com.fasterxml.jackson.databind.ObjectMapper; 6 | import com.fasterxml.jackson.databind.node.MissingNode; 7 | import com.fasterxml.jackson.dataformat.yaml.YAMLFactory; 8 | import com.github.fge.jsonschema.core.exceptions.ProcessingException; 9 | import com.github.fge.jsonschema.core.load.Dereferencing; 10 | import com.github.fge.jsonschema.core.load.configuration.LoadingConfiguration; 11 | import com.github.fge.jsonschema.core.report.ProcessingMessage; 12 | import com.github.fge.jsonschema.core.report.ProcessingReport; 13 | import com.github.fge.jsonschema.main.JsonSchema; 14 | import com.github.fge.jsonschema.main.JsonSchemaFactory; 15 | import com.github.sylvainlaurent.maven.yamljsonvalidator.downloader.ClasspathDownloader; 16 | 17 | import java.io.File; 18 | import java.io.IOException; 19 | import java.io.InputStream; 20 | 21 | public class ValidationService { 22 | 23 | private final ObjectMapper jsonMapper = new ObjectMapper(); 24 | private final ObjectMapper yamlMapper = new ObjectMapper(new YAMLFactory()); 25 | private final JsonSchema schema; 26 | 27 | private final boolean isEmptyFileAllowed; 28 | 29 | public ValidationService(final InputStream schemaFile, 30 | final boolean isEmptyFileAllowed, 31 | final boolean detectDuplicateKeys, 32 | final boolean allowJsonComments, 33 | final boolean allowTrailingComma) { 34 | schema = getJsonSchema(schemaFile); 35 | this.isEmptyFileAllowed = isEmptyFileAllowed; 36 | if (detectDuplicateKeys) { 37 | this.jsonMapper.enable(Feature.STRICT_DUPLICATE_DETECTION); 38 | this.yamlMapper.enable(Feature.STRICT_DUPLICATE_DETECTION); 39 | } 40 | if (allowJsonComments) { 41 | this.jsonMapper.enable(Feature.ALLOW_COMMENTS); 42 | } 43 | if (allowTrailingComma) { 44 | this.jsonMapper.enable(Feature.ALLOW_TRAILING_COMMA); 45 | this.yamlMapper.enable(Feature.ALLOW_TRAILING_COMMA); 46 | } 47 | } 48 | 49 | public ValidationService(final InputStream schemaFile) { 50 | this(schemaFile, false, true, false, false); 51 | } 52 | 53 | public ValidationResult validate(final File file) { 54 | final ValidationResult validationResult = new ValidationResult(); 55 | 56 | if (isEmptyFileAllowed && isFileEmpty(file)) { 57 | return validationResult; 58 | } else { 59 | JsonNode spec; 60 | try { 61 | spec = readFileContent(file); 62 | if ((spec == null || spec instanceof MissingNode) && !isEmptyFileAllowed) { 63 | validationResult.addMessage("Empty file is not valid: " + file); 64 | validationResult.encounteredError(); 65 | return validationResult; 66 | } 67 | } catch (final Exception e) { 68 | validationResult.addMessage("Error while parsing file " + file + ": " + e.getMessage()); 69 | validationResult.encounteredError(); 70 | return validationResult; 71 | } 72 | 73 | validateAgainstSchema(spec, validationResult); 74 | } 75 | return validationResult; 76 | } 77 | 78 | private boolean isFileEmpty(final File file) { 79 | return file.length() == 0L; 80 | } 81 | 82 | private void validateAgainstSchema(final JsonNode spec, final ValidationResult validationResult) { 83 | if (schema == null) { 84 | return; 85 | } 86 | try { 87 | final ProcessingReport report = schema.validate(spec); 88 | if (!report.isSuccess()) { 89 | validationResult.encounteredError(); 90 | } 91 | for (final ProcessingMessage processingMessage : report) { 92 | validationResult.addMessage(processingMessage.toString()); 93 | } 94 | } catch (final ProcessingException e) { 95 | validationResult.addMessage(e.getMessage()); 96 | validationResult.encounteredError(); 97 | } 98 | } 99 | 100 | private JsonSchema getJsonSchema(final InputStream schemaFile) { 101 | if (schemaFile == null) { 102 | return null; 103 | } 104 | JsonSchema jsonSchema; 105 | try { 106 | // using INLINE dereferencing to avoid internet access while validating 107 | LoadingConfiguration loadingConfiguration = 108 | LoadingConfiguration.newBuilder().addScheme("classpath", new ClasspathDownloader()) 109 | .dereferencing(Dereferencing.INLINE).freeze(); 110 | final JsonSchemaFactory factory = JsonSchemaFactory.newBuilder() 111 | .setLoadingConfiguration(loadingConfiguration).freeze(); 112 | 113 | final JsonNode schemaObject = jsonMapper.readTree(schemaFile); 114 | jsonSchema = factory.getJsonSchema(schemaObject); 115 | } catch (IOException | ProcessingException e) { 116 | throw new RuntimeException(e); 117 | } 118 | return jsonSchema; 119 | } 120 | 121 | private JsonNode readFileContent(final File file) throws IOException { 122 | final String fileName = file.getName().toLowerCase(); 123 | if (fileName.endsWith(".yml") || fileName.endsWith(".yaml")) { 124 | return yamlMapper.readTree(file); 125 | } else { 126 | return jsonMapper.readTree(file); 127 | } 128 | } 129 | 130 | } 131 | -------------------------------------------------------------------------------- /src/main/java/com/github/sylvainlaurent/maven/yamljsonvalidator/ValidationSet.java: -------------------------------------------------------------------------------- 1 | package com.github.sylvainlaurent.maven.yamljsonvalidator; 2 | 3 | import java.io.File; 4 | 5 | import org.codehaus.plexus.util.DirectoryScanner; 6 | 7 | public class ValidationSet { 8 | /** 9 | * may be null 10 | */ 11 | private String jsonSchema; 12 | 13 | private String[] includes; 14 | 15 | private String[] excludes; 16 | 17 | public String getJsonSchema() { 18 | return jsonSchema; 19 | } 20 | 21 | public void setJsonSchema(final String jsonSchema) { 22 | this.jsonSchema = jsonSchema; 23 | } 24 | 25 | public String[] getIncludes() { 26 | return includes; 27 | } 28 | 29 | public void setIncludes(final String[] includes) { 30 | this.includes = includes; 31 | } 32 | 33 | public String[] getExcludes() { 34 | return excludes; 35 | } 36 | 37 | public void setExcludes(final String[] excludes) { 38 | this.excludes = excludes; 39 | } 40 | 41 | public File[] getFiles(final File basedir) { 42 | final DirectoryScanner ds = new DirectoryScanner(); 43 | ds.setBasedir(basedir); 44 | if (includes != null && includes.length > 0) { 45 | ds.setIncludes(includes); 46 | } 47 | if (excludes != null && excludes.length > 0) { 48 | ds.setExcludes(excludes); 49 | } 50 | ds.scan(); 51 | final String[] filePaths = ds.getIncludedFiles(); 52 | final File[] files = new File[filePaths.length]; 53 | 54 | for (int i = 0; i < filePaths.length; i++) { 55 | files[i] = new File(basedir, filePaths[i]); 56 | } 57 | 58 | return files; 59 | } 60 | 61 | } 62 | -------------------------------------------------------------------------------- /src/main/java/com/github/sylvainlaurent/maven/yamljsonvalidator/downloader/ClasspathDownloader.java: -------------------------------------------------------------------------------- 1 | package com.github.sylvainlaurent.maven.yamljsonvalidator.downloader; 2 | 3 | import java.io.InputStream; 4 | import java.net.URI; 5 | 6 | import com.github.fge.jsonschema.core.load.download.URIDownloader; 7 | 8 | /** 9 | *

Enables loading ref's in schemas from classpath. E.g.: 10 | * "$ref": "classpath:schema/includes/a-include.json"

11 | *

This only works, if the schemas are really on the classpath. 12 | * Adding them only via project dependencies is not enough. They need to be added 13 | * to the plugin dependencies so they will be available through the plugin classloader.

14 | *

To make this all work, schemas defined by the configuration element <jsonSchema>someSchema.json</jsonSchema> 15 | * will also be searched on the classpath if not found on the filesystem.

16 | */ 17 | public class ClasspathDownloader implements URIDownloader { 18 | 19 | @Override 20 | public InputStream fetch(URI source) { 21 | return this.getClass().getClassLoader().getResourceAsStream(source.getSchemeSpecificPart()); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/test/java/com/github/sylvainlaurent/maven/yamljsonvalidator/ValidateMojoTest.java: -------------------------------------------------------------------------------- 1 | 2 | package com.github.sylvainlaurent.maven.yamljsonvalidator; 3 | 4 | import static org.junit.jupiter.api.Assertions.assertNotNull; 5 | import static org.junit.jupiter.api.Assertions.assertNull; 6 | import static org.junit.jupiter.api.Assertions.assertThrows; 7 | 8 | import org.apache.maven.plugin.MojoExecutionException; 9 | import org.junit.jupiter.api.Test; 10 | 11 | public class ValidateMojoTest { 12 | @Test 13 | public void dont_accept_not_found_schema() { 14 | assertThrows(MojoExecutionException.class, () -> { 15 | ValidateMojo validateMojo = new ValidateMojo(); 16 | validateMojo.openJsonSchema("non_existing"); 17 | }); 18 | } 19 | 20 | @Test 21 | public void accept_schema_from_filepath() throws MojoExecutionException { 22 | ValidateMojo validateMojo = new ValidateMojo(); 23 | assertNotNull(validateMojo.openJsonSchema("src/test/resources/schema-with-ref.json")); 24 | } 25 | 26 | 27 | @Test 28 | public void accept_schema_from_classpath() throws MojoExecutionException { 29 | ValidateMojo validateMojo = new ValidateMojo(); 30 | assertNotNull(validateMojo.openJsonSchema("schema-with-ref.json")); 31 | } 32 | 33 | @Test 34 | public void return_null_when_no_schema_entered() throws MojoExecutionException { 35 | ValidateMojo validateMojo = new ValidateMojo(); 36 | assertNull(validateMojo.openJsonSchema(null)); 37 | assertNull(validateMojo.openJsonSchema("")); 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /src/test/java/com/github/sylvainlaurent/maven/yamljsonvalidator/ValidationServiceAllowEmptyFilesTest.java: -------------------------------------------------------------------------------- 1 | 2 | package com.github.sylvainlaurent.maven.yamljsonvalidator; 3 | 4 | import static org.junit.jupiter.api.Assertions.assertFalse; 5 | 6 | import org.junit.jupiter.api.Test; 7 | 8 | import java.io.File; 9 | 10 | public class ValidationServiceAllowEmptyFilesTest { 11 | private final ValidationService service = new ValidationService(null, true, true, true, false); 12 | 13 | @Test 14 | public void test_empty_file_yml() { 15 | final ValidationResult result = service.validate(new File("src/test/resources/empty.yml")); 16 | assertFalse(result.hasError()); 17 | } 18 | 19 | @Test 20 | public void test_empty_file_json() { 21 | final ValidationResult result = service.validate(new File("src/test/resources/empty.json")); 22 | assertFalse(result.hasError()); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/test/java/com/github/sylvainlaurent/maven/yamljsonvalidator/ValidationServiceTest.java: -------------------------------------------------------------------------------- 1 | 2 | package com.github.sylvainlaurent.maven.yamljsonvalidator; 3 | 4 | import static org.junit.jupiter.api.Assertions.assertEquals; 5 | import static org.junit.jupiter.api.Assertions.assertFalse; 6 | import static org.junit.jupiter.api.Assertions.assertTrue; 7 | 8 | import org.junit.jupiter.api.Test; 9 | 10 | import java.io.File; 11 | import java.io.FileInputStream; 12 | import java.io.FileNotFoundException; 13 | 14 | public class ValidationServiceTest { 15 | private ValidationService service = new ValidationService(null); 16 | 17 | @Test 18 | public void test_empty_file_yml() { 19 | final ValidationResult result = service.validate(new File("src/test/resources/empty.yml")); 20 | assertTrue(result.hasError()); 21 | assertEquals(1, result.getMessages().size()); 22 | } 23 | 24 | @Test 25 | public void test_empty_file_json() { 26 | final ValidationResult result = service.validate(new File("src/test/resources/empty.json")); 27 | assertTrue(result.hasError()); 28 | assertEquals(1, result.getMessages().size()); 29 | } 30 | 31 | @Test 32 | public void test_malformed_file_yml() { 33 | final ValidationResult result = service.validate(new File("src/test/resources/malformed.yml")); 34 | assertTrue(result.hasError()); 35 | assertEquals(1, result.getMessages().size()); 36 | } 37 | 38 | @Test 39 | public void test_malformed_file_json() { 40 | final ValidationResult result = service.validate(new File("src/test/resources/malformed.json")); 41 | assertTrue(result.hasError()); 42 | assertEquals(1, result.getMessages().size()); 43 | } 44 | 45 | @Test 46 | public void test_invalid_yml() throws FileNotFoundException { 47 | service = new ValidationService(new FileInputStream("src/test/resources/swagger-schema.json")); 48 | final ValidationResult result = service.validate(new File("src/test/resources/not-valid.yml")); 49 | assertTrue(result.hasError()); 50 | assertTrue(result.getMessages().size() >= 1); 51 | } 52 | 53 | @Test 54 | public void test_not_valid_swagger_json() throws FileNotFoundException { 55 | service = new ValidationService(new FileInputStream("src/test/resources/swagger-schema.json")); 56 | final ValidationResult result = service.validate(new File("src/test/resources/not-valid.json")); 57 | assertTrue(result.hasError()); 58 | assertTrue(result.getMessages().size() >= 1); 59 | } 60 | 61 | @Test 62 | public void test_valid_yml() throws FileNotFoundException { 63 | service = new ValidationService(new FileInputStream("src/test/resources/swagger-schema.json")); 64 | final ValidationResult result = service.validate(new File("src/test/resources/swagger-editor-example.yml")); 65 | assertFalse(result.hasError()); 66 | assertTrue(result.getMessages().isEmpty()); 67 | } 68 | 69 | @Test 70 | public void test_valid_json() throws FileNotFoundException { 71 | service = new ValidationService(new FileInputStream("src/test/resources/swagger-schema.json")); 72 | final ValidationResult result = service.validate(new File("src/test/resources/swagger-editor-example.json")); 73 | assertFalse(result.hasError()); 74 | assertTrue(result.getMessages().isEmpty()); 75 | } 76 | 77 | @Test 78 | public void test_schema_with_reference_to_unreachable_host() throws FileNotFoundException { 79 | service = new ValidationService(new FileInputStream("src/test/resources/schema-with-ref.json")); 80 | final ValidationResult result = service.validate(new File("src/test/resources/swagger-editor-example.json")); 81 | assertFalse(result.hasError()); 82 | } 83 | 84 | @Test 85 | public void test_comments_allowed_in_json() { 86 | service = new ValidationService(null, false, false, true, false); 87 | final ValidationResult result = service.validate(new File("src/test/resources/with-comments.json")); 88 | assertFalse(result.hasError()); 89 | assertTrue(result.getMessages().isEmpty()); 90 | } 91 | 92 | @Test 93 | public void test_comments_not_allowed_in_json() { 94 | service = new ValidationService(null, false, false, false, false); 95 | final ValidationResult result = service.validate(new File("src/test/resources/with-comments.json")); 96 | assertTrue(result.hasError()); 97 | assertFalse(result.getMessages().isEmpty()); 98 | } 99 | 100 | @Test 101 | public void test_comments_allowed_in_yml() { 102 | service = new ValidationService(null, false, false, true, false); 103 | final ValidationResult result = service.validate(new File("src/test/resources/with-comments.yml")); 104 | assertFalse(result.hasError()); 105 | assertTrue(result.getMessages().isEmpty()); 106 | } 107 | 108 | @Test 109 | public void test_comments_not_allowed_in_yml() { 110 | service = new ValidationService(null, false, false, false, false); 111 | final ValidationResult result = service.validate(new File("src/test/resources/with-comments.yml")); 112 | assertFalse(result.hasError()); 113 | assertTrue(result.getMessages().isEmpty()); 114 | } 115 | } 116 | -------------------------------------------------------------------------------- /src/test/resources/empty.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sylvainlaurent/yaml-json-validator-maven-plugin/673ed69da8315dcfd0ea19f1f7e059506da98eab/src/test/resources/empty.json -------------------------------------------------------------------------------- /src/test/resources/empty.yml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sylvainlaurent/yaml-json-validator-maven-plugin/673ed69da8315dcfd0ea19f1f7e059506da98eab/src/test/resources/empty.yml -------------------------------------------------------------------------------- /src/test/resources/malformed.json: -------------------------------------------------------------------------------- 1 | {hello: "world } -------------------------------------------------------------------------------- /src/test/resources/malformed.yml: -------------------------------------------------------------------------------- 1 | hello: 2 | world: "toto 3 | -------------------------------------------------------------------------------- /src/test/resources/not-valid.json: -------------------------------------------------------------------------------- 1 | { 2 | "swagger": "2.0", 3 | "info": { 4 | "title_invalid_attribute_to_test_validation": "Uber API", 5 | "description": "Move your app forward with the Uber API", 6 | "version": "1.0.0" 7 | }, 8 | "host": "api.uber.com", 9 | "schemes": [ 10 | "https" 11 | ], 12 | "basePath": "/v1", 13 | "produces": [ 14 | "application/json" 15 | ], 16 | "paths": { 17 | "/products": { 18 | "get": { 19 | "summary": "Product Types", 20 | "description": "The Products endpoint returns information about the *Uber* products\noffered at a given location. The response includes the display name\nand other details about each product, and lists the products in the\nproper display order.\n", 21 | "parameters": [ 22 | { 23 | "name": "latitude", 24 | "in": "query", 25 | "description": "Latitude component of location.", 26 | "required": true, 27 | "type": "number", 28 | "format": "double" 29 | }, 30 | { 31 | "name": "longitude", 32 | "in": "query", 33 | "description": "Longitude component of location.", 34 | "required": true, 35 | "type": "number", 36 | "format": "double" 37 | } 38 | ], 39 | "tags": [ 40 | "Products" 41 | ], 42 | "responses": { 43 | "200": { 44 | "description": "An array of products", 45 | "schema": { 46 | "type": "array", 47 | "items": { 48 | "$ref": "#/definitions/Product" 49 | } 50 | } 51 | }, 52 | "default": { 53 | "description": "Unexpected error", 54 | "schema": { 55 | "$ref": "#/definitions/Error" 56 | } 57 | } 58 | } 59 | } 60 | }, 61 | "/estimates/price": { 62 | "get": { 63 | "summary": "Price Estimates", 64 | "description": "The Price Estimates endpoint returns an estimated price range\nfor each product offered at a given location. The price estimate is\nprovided as a formatted string with the full price range and the localized\ncurrency symbol.

The response also includes low and high estimates,\nand the [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217) currency code for\nsituations requiring currency conversion. When surge is active for a particular\nproduct, its surge_multiplier will be greater than 1, but the price estimate\nalready factors in this multiplier.\n", 65 | "parameters": [ 66 | { 67 | "name": "start_latitude", 68 | "in": "query", 69 | "description": "Latitude component of start location.", 70 | "required": true, 71 | "type": "number", 72 | "format": "double" 73 | }, 74 | { 75 | "name": "start_longitude", 76 | "in": "query", 77 | "description": "Longitude component of start location.", 78 | "required": true, 79 | "type": "number", 80 | "format": "double" 81 | }, 82 | { 83 | "name": "end_latitude", 84 | "in": "query", 85 | "description": "Latitude component of end location.", 86 | "required": true, 87 | "type": "number", 88 | "format": "double" 89 | }, 90 | { 91 | "name": "end_longitude", 92 | "in": "query", 93 | "description": "Longitude component of end location.", 94 | "required": true, 95 | "type": "number", 96 | "format": "double" 97 | } 98 | ], 99 | "tags": [ 100 | "Estimates" 101 | ], 102 | "responses": { 103 | "200": { 104 | "description": "An array of price estimates by product", 105 | "schema": { 106 | "type": "array", 107 | "items": { 108 | "$ref": "#/definitions/PriceEstimate" 109 | } 110 | } 111 | }, 112 | "default": { 113 | "description": "Unexpected error", 114 | "schema": { 115 | "$ref": "#/definitions/Error" 116 | } 117 | } 118 | } 119 | } 120 | }, 121 | "/estimates/time": { 122 | "get": { 123 | "summary": "Time Estimates", 124 | "description": "The Time Estimates endpoint returns ETAs for all products offered at a given location, with the responses expressed as integers in seconds. We recommend that this endpoint be called every minute to provide the most accurate, up-to-date ETAs.", 125 | "parameters": [ 126 | { 127 | "name": "start_latitude", 128 | "in": "query", 129 | "description": "Latitude component of start location.", 130 | "required": true, 131 | "type": "number", 132 | "format": "double" 133 | }, 134 | { 135 | "name": "start_longitude", 136 | "in": "query", 137 | "description": "Longitude component of start location.", 138 | "required": true, 139 | "type": "number", 140 | "format": "double" 141 | }, 142 | { 143 | "name": "customer_uuid", 144 | "in": "query", 145 | "type": "string", 146 | "format": "uuid", 147 | "description": "Unique customer identifier to be used for experience customization." 148 | }, 149 | { 150 | "name": "product_id", 151 | "in": "query", 152 | "type": "string", 153 | "description": "Unique identifier representing a specific product for a given latitude & longitude." 154 | } 155 | ], 156 | "tags": [ 157 | "Estimates" 158 | ], 159 | "responses": { 160 | "200": { 161 | "description": "An array of products", 162 | "schema": { 163 | "type": "array", 164 | "items": { 165 | "$ref": "#/definitions/Product" 166 | } 167 | } 168 | }, 169 | "default": { 170 | "description": "Unexpected error", 171 | "schema": { 172 | "$ref": "#/definitions/Error" 173 | } 174 | } 175 | } 176 | } 177 | }, 178 | "/me": { 179 | "get": { 180 | "summary": "User Profile", 181 | "description": "The User Profile endpoint returns information about the Uber user that has authorized with the application.", 182 | "tags": [ 183 | "User" 184 | ], 185 | "responses": { 186 | "200": { 187 | "description": "Profile information for a user", 188 | "schema": { 189 | "$ref": "#/definitions/Profile" 190 | } 191 | }, 192 | "default": { 193 | "description": "Unexpected error", 194 | "schema": { 195 | "$ref": "#/definitions/Error" 196 | } 197 | } 198 | } 199 | } 200 | }, 201 | "/history": { 202 | "get": { 203 | "summary": "User Activity", 204 | "description": "The User Activity endpoint returns data about a user's lifetime activity with Uber. The response will include pickup locations and times, dropoff locations and times, the distance of past requests, and information about which products were requested.

The history array in the response will have a maximum length based on the limit parameter. The response value count may exceed limit, therefore subsequent API requests may be necessary.", 205 | "parameters": [ 206 | { 207 | "name": "offset", 208 | "in": "query", 209 | "type": "integer", 210 | "format": "int32", 211 | "description": "Offset the list of returned results by this amount. Default is zero." 212 | }, 213 | { 214 | "name": "limit", 215 | "in": "query", 216 | "type": "integer", 217 | "format": "int32", 218 | "description": "Number of items to retrieve. Default is 5, maximum is 100." 219 | } 220 | ], 221 | "tags": [ 222 | "User" 223 | ], 224 | "responses": { 225 | "200": { 226 | "description": "History information for the given user", 227 | "schema": { 228 | "$ref": "#/definitions/Activities" 229 | } 230 | }, 231 | "default": { 232 | "description": "Unexpected error", 233 | "schema": { 234 | "$ref": "#/definitions/Error" 235 | } 236 | } 237 | } 238 | } 239 | } 240 | }, 241 | "definitions": { 242 | "Product": { 243 | "type": "object", 244 | "properties": { 245 | "product_id": { 246 | "type": "string", 247 | "description": "Unique identifier representing a specific product for a given latitude & longitude. For example, uberX in San Francisco will have a different product_id than uberX in Los Angeles." 248 | }, 249 | "description": { 250 | "type": "string", 251 | "description": "Description of product." 252 | }, 253 | "display_name": { 254 | "type": "string", 255 | "description": "Display name of product." 256 | }, 257 | "capacity": { 258 | "type": "string", 259 | "description": "Capacity of product. For example, 4 people." 260 | }, 261 | "image": { 262 | "type": "string", 263 | "description": "Image URL representing the product." 264 | } 265 | } 266 | }, 267 | "PriceEstimate": { 268 | "type": "object", 269 | "properties": { 270 | "product_id": { 271 | "type": "string", 272 | "description": "Unique identifier representing a specific product for a given latitude & longitude. For example, uberX in San Francisco will have a different product_id than uberX in Los Angeles" 273 | }, 274 | "currency_code": { 275 | "type": "string", 276 | "description": "[ISO 4217](http://en.wikipedia.org/wiki/ISO_4217) currency code." 277 | }, 278 | "display_name": { 279 | "type": "string", 280 | "description": "Display name of product." 281 | }, 282 | "estimate": { 283 | "type": "string", 284 | "description": "Formatted string of estimate in local currency of the start location. Estimate could be a range, a single number (flat rate) or \"Metered\" for TAXI." 285 | }, 286 | "low_estimate": { 287 | "type": "number", 288 | "description": "Lower bound of the estimated price." 289 | }, 290 | "high_estimate": { 291 | "type": "number", 292 | "description": "Upper bound of the estimated price." 293 | }, 294 | "surge_multiplier": { 295 | "type": "number", 296 | "description": "Expected surge multiplier. Surge is active if surge_multiplier is greater than 1. Price estimate already factors in the surge multiplier." 297 | } 298 | } 299 | }, 300 | "Profile": { 301 | "type": "object", 302 | "properties": { 303 | "first_name": { 304 | "type": "string", 305 | "description": "First name of the Uber user." 306 | }, 307 | "last_name": { 308 | "type": "string", 309 | "description": "Last name of the Uber user." 310 | }, 311 | "email": { 312 | "type": "string", 313 | "description": "Email address of the Uber user" 314 | }, 315 | "picture": { 316 | "type": "string", 317 | "description": "Image URL of the Uber user." 318 | }, 319 | "promo_code": { 320 | "type": "string", 321 | "description": "Promo code of the Uber user." 322 | } 323 | } 324 | }, 325 | "Activity": { 326 | "type": "object", 327 | "properties": { 328 | "uuid": { 329 | "type": "string", 330 | "description": "Unique identifier for the activity" 331 | } 332 | } 333 | }, 334 | "Activities": { 335 | "type": "object", 336 | "properties": { 337 | "offset": { 338 | "type": "integer", 339 | "format": "int32", 340 | "description": "Position in pagination." 341 | }, 342 | "limit": { 343 | "type": "integer", 344 | "format": "int32", 345 | "description": "Number of items to retrieve (100 max)." 346 | }, 347 | "count": { 348 | "type": "integer", 349 | "format": "int32", 350 | "description": "Total number of items available." 351 | }, 352 | "history": { 353 | "type": "array", 354 | "items": { 355 | "$ref": "#/definitions/Activity" 356 | } 357 | } 358 | } 359 | }, 360 | "Error": { 361 | "type": "object", 362 | "properties": { 363 | "code": { 364 | "type": "integer", 365 | "format": "int32" 366 | }, 367 | "message": { 368 | "type": "string" 369 | }, 370 | "fields": { 371 | "type": "string" 372 | } 373 | } 374 | } 375 | } 376 | } -------------------------------------------------------------------------------- /src/test/resources/not-valid.yml: -------------------------------------------------------------------------------- 1 | # this is an example of the Uber API 2 | # as a demonstration of an API spec in YAML 3 | swagger: '2.0' 4 | info: 5 | title_not_valid_attribute: Uber API 6 | description: Move your app forward with the Uber API 7 | version: "1.0.0" 8 | # the domain of the service 9 | host: api.uber.com 10 | # array of all schemes that your API supports 11 | schemes: 12 | - https 13 | # will be prefixed to all paths 14 | basePath: /v1 15 | produces: 16 | - application/json 17 | paths: 18 | /products: 19 | get: 20 | summary: Product Types 21 | description: | 22 | The Products endpoint returns information about the *Uber* products 23 | offered at a given location. The response includes the display name 24 | and other details about each product, and lists the products in the 25 | proper display order. 26 | parameters: 27 | - name: latitude 28 | in: query 29 | description: Latitude component of location. 30 | required: true 31 | type: number 32 | format: double 33 | - name: longitude 34 | in: query 35 | description: Longitude component of location. 36 | required: true 37 | type: number 38 | format: double 39 | tags: 40 | - Products 41 | responses: 42 | 200: 43 | description: An array of products 44 | schema: 45 | type: array 46 | items: 47 | $ref: '#/definitions/Product' 48 | default: 49 | description: Unexpected error 50 | schema: 51 | $ref: '#/definitions/Error' 52 | /estimates/price: 53 | get: 54 | summary: Price Estimates 55 | description: | 56 | The Price Estimates endpoint returns an estimated price range 57 | for each product offered at a given location. The price estimate is 58 | provided as a formatted string with the full price range and the localized 59 | currency symbol.

The response also includes low and high estimates, 60 | and the [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217) currency code for 61 | situations requiring currency conversion. When surge is active for a particular 62 | product, its surge_multiplier will be greater than 1, but the price estimate 63 | already factors in this multiplier. 64 | parameters: 65 | - name: start_latitude 66 | in: query 67 | description: Latitude component of start location. 68 | required: true 69 | type: number 70 | format: double 71 | - name: start_longitude 72 | in: query 73 | description: Longitude component of start location. 74 | required: true 75 | type: number 76 | format: double 77 | - name: end_latitude 78 | in: query 79 | description: Latitude component of end location. 80 | required: true 81 | type: number 82 | format: double 83 | - name: end_longitude 84 | in: query 85 | description: Longitude component of end location. 86 | required: true 87 | type: number 88 | format: double 89 | tags: 90 | - Estimates 91 | responses: 92 | 200: 93 | description: An array of price estimates by product 94 | schema: 95 | type: array 96 | items: 97 | $ref: '#/definitions/PriceEstimate' 98 | default: 99 | description: Unexpected error 100 | schema: 101 | $ref: '#/definitions/Error' 102 | /estimates/time: 103 | get: 104 | summary: Time Estimates 105 | description: The Time Estimates endpoint returns ETAs for all products offered at a given location, with the responses expressed as integers in seconds. We recommend that this endpoint be called every minute to provide the most accurate, up-to-date ETAs. 106 | parameters: 107 | - name: start_latitude 108 | in: query 109 | description: Latitude component of start location. 110 | required: true 111 | type: number 112 | format: double 113 | - name: start_longitude 114 | in: query 115 | description: Longitude component of start location. 116 | required: true 117 | type: number 118 | format: double 119 | - name: customer_uuid 120 | in: query 121 | type: string 122 | format: uuid 123 | description: Unique customer identifier to be used for experience customization. 124 | - name: product_id 125 | in: query 126 | type: string 127 | description: Unique identifier representing a specific product for a given latitude & longitude. 128 | tags: 129 | - Estimates 130 | responses: 131 | 200: 132 | description: An array of products 133 | schema: 134 | type: array 135 | items: 136 | $ref: '#/definitions/Product' 137 | default: 138 | description: Unexpected error 139 | schema: 140 | $ref: '#/definitions/Error' 141 | /me: 142 | get: 143 | summary: User Profile 144 | description: The User Profile endpoint returns information about the Uber user that has authorized with the application. 145 | tags: 146 | - User 147 | responses: 148 | 200: 149 | description: Profile information for a user 150 | schema: 151 | $ref: '#/definitions/Profile' 152 | default: 153 | description: Unexpected error 154 | schema: 155 | $ref: '#/definitions/Error' 156 | /history: 157 | get: 158 | summary: User Activity 159 | description: The User Activity endpoint returns data about a user's lifetime activity with Uber. The response will include pickup locations and times, dropoff locations and times, the distance of past requests, and information about which products were requested.

The history array in the response will have a maximum length based on the limit parameter. The response value count may exceed limit, therefore subsequent API requests may be necessary. 160 | parameters: 161 | - name: offset 162 | in: query 163 | type: integer 164 | format: int32 165 | description: Offset the list of returned results by this amount. Default is zero. 166 | - name: limit 167 | in: query 168 | type: integer 169 | format: int32 170 | description: Number of items to retrieve. Default is 5, maximum is 100. 171 | tags: 172 | - User 173 | responses: 174 | 200: 175 | description: History information for the given user 176 | schema: 177 | $ref: '#/definitions/Activities' 178 | default: 179 | description: Unexpected error 180 | schema: 181 | $ref: '#/definitions/Error' 182 | definitions: 183 | Product: 184 | type: object 185 | properties: 186 | product_id: 187 | type: string 188 | description: Unique identifier representing a specific product for a given latitude & longitude. For example, uberX in San Francisco will have a different product_id than uberX in Los Angeles. 189 | description: 190 | type: string 191 | description: Description of product. 192 | display_name: 193 | type: string 194 | description: Display name of product. 195 | capacity: 196 | type: string 197 | description: Capacity of product. For example, 4 people. 198 | image: 199 | type: string 200 | description: Image URL representing the product. 201 | PriceEstimate: 202 | type: object 203 | properties: 204 | product_id: 205 | type: string 206 | description: Unique identifier representing a specific product for a given latitude & longitude. For example, uberX in San Francisco will have a different product_id than uberX in Los Angeles 207 | currency_code: 208 | type: string 209 | description: "[ISO 4217](http://en.wikipedia.org/wiki/ISO_4217) currency code." 210 | display_name: 211 | type: string 212 | description: Display name of product. 213 | estimate: 214 | type: string 215 | description: Formatted string of estimate in local currency of the start location. Estimate could be a range, a single number (flat rate) or "Metered" for TAXI. 216 | low_estimate: 217 | type: number 218 | description: Lower bound of the estimated price. 219 | high_estimate: 220 | type: number 221 | description: Upper bound of the estimated price. 222 | surge_multiplier: 223 | type: number 224 | description: Expected surge multiplier. Surge is active if surge_multiplier is greater than 1. Price estimate already factors in the surge multiplier. 225 | Profile: 226 | type: object 227 | properties: 228 | first_name: 229 | type: string 230 | description: First name of the Uber user. 231 | last_name: 232 | type: string 233 | description: Last name of the Uber user. 234 | email: 235 | type: string 236 | description: Email address of the Uber user 237 | picture: 238 | type: string 239 | description: Image URL of the Uber user. 240 | promo_code: 241 | type: string 242 | description: Promo code of the Uber user. 243 | Activity: 244 | type: object 245 | properties: 246 | uuid: 247 | type: string 248 | description: Unique identifier for the activity 249 | Activities: 250 | type: object 251 | properties: 252 | offset: 253 | type: integer 254 | format: int32 255 | description: Position in pagination. 256 | limit: 257 | type: integer 258 | format: int32 259 | description: Number of items to retrieve (100 max). 260 | count: 261 | type: integer 262 | format: int32 263 | description: Total number of items available. 264 | history: 265 | type: array 266 | items: 267 | $ref: '#/definitions/Activity' 268 | Error: 269 | type: object 270 | properties: 271 | code: 272 | type: integer 273 | format: int32 274 | message: 275 | type: string 276 | fields: 277 | type: string 278 | -------------------------------------------------------------------------------- /src/test/resources/swagger-editor-example.json: -------------------------------------------------------------------------------- 1 | { 2 | "swagger": "2.0", 3 | "info": { 4 | "title": "Uber API", 5 | "description": "Move your app forward with the Uber API", 6 | "version": "1.0.0" 7 | }, 8 | "host": "api.uber.com", 9 | "schemes": [ 10 | "https" 11 | ], 12 | "basePath": "/v1", 13 | "produces": [ 14 | "application/json" 15 | ], 16 | "paths": { 17 | "/products": { 18 | "get": { 19 | "summary": "Product Types", 20 | "description": "The Products endpoint returns information about the *Uber* products\noffered at a given location. The response includes the display name\nand other details about each product, and lists the products in the\nproper display order.\n", 21 | "parameters": [ 22 | { 23 | "name": "latitude", 24 | "in": "query", 25 | "description": "Latitude component of location.", 26 | "required": true, 27 | "type": "number", 28 | "format": "double" 29 | }, 30 | { 31 | "name": "longitude", 32 | "in": "query", 33 | "description": "Longitude component of location.", 34 | "required": true, 35 | "type": "number", 36 | "format": "double" 37 | } 38 | ], 39 | "tags": [ 40 | "Products" 41 | ], 42 | "responses": { 43 | "200": { 44 | "description": "An array of products", 45 | "schema": { 46 | "type": "array", 47 | "items": { 48 | "$ref": "#/definitions/Product" 49 | } 50 | } 51 | }, 52 | "default": { 53 | "description": "Unexpected error", 54 | "schema": { 55 | "$ref": "#/definitions/Error" 56 | } 57 | } 58 | } 59 | } 60 | }, 61 | "/estimates/price": { 62 | "get": { 63 | "summary": "Price Estimates", 64 | "description": "The Price Estimates endpoint returns an estimated price range\nfor each product offered at a given location. The price estimate is\nprovided as a formatted string with the full price range and the localized\ncurrency symbol.

The response also includes low and high estimates,\nand the [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217) currency code for\nsituations requiring currency conversion. When surge is active for a particular\nproduct, its surge_multiplier will be greater than 1, but the price estimate\nalready factors in this multiplier.\n", 65 | "parameters": [ 66 | { 67 | "name": "start_latitude", 68 | "in": "query", 69 | "description": "Latitude component of start location.", 70 | "required": true, 71 | "type": "number", 72 | "format": "double" 73 | }, 74 | { 75 | "name": "start_longitude", 76 | "in": "query", 77 | "description": "Longitude component of start location.", 78 | "required": true, 79 | "type": "number", 80 | "format": "double" 81 | }, 82 | { 83 | "name": "end_latitude", 84 | "in": "query", 85 | "description": "Latitude component of end location.", 86 | "required": true, 87 | "type": "number", 88 | "format": "double" 89 | }, 90 | { 91 | "name": "end_longitude", 92 | "in": "query", 93 | "description": "Longitude component of end location.", 94 | "required": true, 95 | "type": "number", 96 | "format": "double" 97 | } 98 | ], 99 | "tags": [ 100 | "Estimates" 101 | ], 102 | "responses": { 103 | "200": { 104 | "description": "An array of price estimates by product", 105 | "schema": { 106 | "type": "array", 107 | "items": { 108 | "$ref": "#/definitions/PriceEstimate" 109 | } 110 | } 111 | }, 112 | "default": { 113 | "description": "Unexpected error", 114 | "schema": { 115 | "$ref": "#/definitions/Error" 116 | } 117 | } 118 | } 119 | } 120 | }, 121 | "/estimates/time": { 122 | "get": { 123 | "summary": "Time Estimates", 124 | "description": "The Time Estimates endpoint returns ETAs for all products offered at a given location, with the responses expressed as integers in seconds. We recommend that this endpoint be called every minute to provide the most accurate, up-to-date ETAs.", 125 | "parameters": [ 126 | { 127 | "name": "start_latitude", 128 | "in": "query", 129 | "description": "Latitude component of start location.", 130 | "required": true, 131 | "type": "number", 132 | "format": "double" 133 | }, 134 | { 135 | "name": "start_longitude", 136 | "in": "query", 137 | "description": "Longitude component of start location.", 138 | "required": true, 139 | "type": "number", 140 | "format": "double" 141 | }, 142 | { 143 | "name": "customer_uuid", 144 | "in": "query", 145 | "type": "string", 146 | "format": "uuid", 147 | "description": "Unique customer identifier to be used for experience customization." 148 | }, 149 | { 150 | "name": "product_id", 151 | "in": "query", 152 | "type": "string", 153 | "description": "Unique identifier representing a specific product for a given latitude & longitude." 154 | } 155 | ], 156 | "tags": [ 157 | "Estimates" 158 | ], 159 | "responses": { 160 | "200": { 161 | "description": "An array of products", 162 | "schema": { 163 | "type": "array", 164 | "items": { 165 | "$ref": "#/definitions/Product" 166 | } 167 | } 168 | }, 169 | "default": { 170 | "description": "Unexpected error", 171 | "schema": { 172 | "$ref": "#/definitions/Error" 173 | } 174 | } 175 | } 176 | } 177 | }, 178 | "/me": { 179 | "get": { 180 | "summary": "User Profile", 181 | "description": "The User Profile endpoint returns information about the Uber user that has authorized with the application.", 182 | "tags": [ 183 | "User" 184 | ], 185 | "responses": { 186 | "200": { 187 | "description": "Profile information for a user", 188 | "schema": { 189 | "$ref": "#/definitions/Profile" 190 | } 191 | }, 192 | "default": { 193 | "description": "Unexpected error", 194 | "schema": { 195 | "$ref": "#/definitions/Error" 196 | } 197 | } 198 | } 199 | } 200 | }, 201 | "/history": { 202 | "get": { 203 | "summary": "User Activity", 204 | "description": "The User Activity endpoint returns data about a user's lifetime activity with Uber. The response will include pickup locations and times, dropoff locations and times, the distance of past requests, and information about which products were requested.

The history array in the response will have a maximum length based on the limit parameter. The response value count may exceed limit, therefore subsequent API requests may be necessary.", 205 | "parameters": [ 206 | { 207 | "name": "offset", 208 | "in": "query", 209 | "type": "integer", 210 | "format": "int32", 211 | "description": "Offset the list of returned results by this amount. Default is zero." 212 | }, 213 | { 214 | "name": "limit", 215 | "in": "query", 216 | "type": "integer", 217 | "format": "int32", 218 | "description": "Number of items to retrieve. Default is 5, maximum is 100." 219 | } 220 | ], 221 | "tags": [ 222 | "User" 223 | ], 224 | "responses": { 225 | "200": { 226 | "description": "History information for the given user", 227 | "schema": { 228 | "$ref": "#/definitions/Activities" 229 | } 230 | }, 231 | "default": { 232 | "description": "Unexpected error", 233 | "schema": { 234 | "$ref": "#/definitions/Error" 235 | } 236 | } 237 | } 238 | } 239 | } 240 | }, 241 | "definitions": { 242 | "Product": { 243 | "type": "object", 244 | "properties": { 245 | "product_id": { 246 | "type": "string", 247 | "description": "Unique identifier representing a specific product for a given latitude & longitude. For example, uberX in San Francisco will have a different product_id than uberX in Los Angeles." 248 | }, 249 | "description": { 250 | "type": "string", 251 | "description": "Description of product." 252 | }, 253 | "display_name": { 254 | "type": "string", 255 | "description": "Display name of product." 256 | }, 257 | "capacity": { 258 | "type": "string", 259 | "description": "Capacity of product. For example, 4 people." 260 | }, 261 | "image": { 262 | "type": "string", 263 | "description": "Image URL representing the product." 264 | } 265 | } 266 | }, 267 | "PriceEstimate": { 268 | "type": "object", 269 | "properties": { 270 | "product_id": { 271 | "type": "string", 272 | "description": "Unique identifier representing a specific product for a given latitude & longitude. For example, uberX in San Francisco will have a different product_id than uberX in Los Angeles" 273 | }, 274 | "currency_code": { 275 | "type": "string", 276 | "description": "[ISO 4217](http://en.wikipedia.org/wiki/ISO_4217) currency code." 277 | }, 278 | "display_name": { 279 | "type": "string", 280 | "description": "Display name of product." 281 | }, 282 | "estimate": { 283 | "type": "string", 284 | "description": "Formatted string of estimate in local currency of the start location. Estimate could be a range, a single number (flat rate) or \"Metered\" for TAXI." 285 | }, 286 | "low_estimate": { 287 | "type": "number", 288 | "description": "Lower bound of the estimated price." 289 | }, 290 | "high_estimate": { 291 | "type": "number", 292 | "description": "Upper bound of the estimated price." 293 | }, 294 | "surge_multiplier": { 295 | "type": "number", 296 | "description": "Expected surge multiplier. Surge is active if surge_multiplier is greater than 1. Price estimate already factors in the surge multiplier." 297 | } 298 | } 299 | }, 300 | "Profile": { 301 | "type": "object", 302 | "properties": { 303 | "first_name": { 304 | "type": "string", 305 | "description": "First name of the Uber user." 306 | }, 307 | "last_name": { 308 | "type": "string", 309 | "description": "Last name of the Uber user." 310 | }, 311 | "email": { 312 | "type": "string", 313 | "description": "Email address of the Uber user" 314 | }, 315 | "picture": { 316 | "type": "string", 317 | "description": "Image URL of the Uber user." 318 | }, 319 | "promo_code": { 320 | "type": "string", 321 | "description": "Promo code of the Uber user." 322 | } 323 | } 324 | }, 325 | "Activity": { 326 | "type": "object", 327 | "properties": { 328 | "uuid": { 329 | "type": "string", 330 | "description": "Unique identifier for the activity" 331 | } 332 | } 333 | }, 334 | "Activities": { 335 | "type": "object", 336 | "properties": { 337 | "offset": { 338 | "type": "integer", 339 | "format": "int32", 340 | "description": "Position in pagination." 341 | }, 342 | "limit": { 343 | "type": "integer", 344 | "format": "int32", 345 | "description": "Number of items to retrieve (100 max)." 346 | }, 347 | "count": { 348 | "type": "integer", 349 | "format": "int32", 350 | "description": "Total number of items available." 351 | }, 352 | "history": { 353 | "type": "array", 354 | "items": { 355 | "$ref": "#/definitions/Activity" 356 | } 357 | } 358 | } 359 | }, 360 | "Error": { 361 | "type": "object", 362 | "properties": { 363 | "code": { 364 | "type": "integer", 365 | "format": "int32" 366 | }, 367 | "message": { 368 | "type": "string" 369 | }, 370 | "fields": { 371 | "type": "string" 372 | } 373 | } 374 | } 375 | } 376 | } -------------------------------------------------------------------------------- /src/test/resources/swagger-editor-example.yml: -------------------------------------------------------------------------------- 1 | # this is an example of the Uber API 2 | # as a demonstration of an API spec in YAML 3 | swagger: '2.0' 4 | info: 5 | title: Uber API 6 | description: Move your app forward with the Uber API 7 | version: "1.0.0" 8 | # the domain of the service 9 | host: api.uber.com 10 | # array of all schemes that your API supports 11 | schemes: 12 | - https 13 | # will be prefixed to all paths 14 | basePath: /v1 15 | produces: 16 | - application/json 17 | paths: 18 | /products: 19 | get: 20 | summary: Product Types 21 | description: | 22 | The Products endpoint returns information about the *Uber* products 23 | offered at a given location. The response includes the display name 24 | and other details about each product, and lists the products in the 25 | proper display order. 26 | parameters: 27 | - name: latitude 28 | in: query 29 | description: Latitude component of location. 30 | required: true 31 | type: number 32 | format: double 33 | - name: longitude 34 | in: query 35 | description: Longitude component of location. 36 | required: true 37 | type: number 38 | format: double 39 | tags: 40 | - Products 41 | responses: 42 | 200: 43 | description: An array of products 44 | schema: 45 | type: array 46 | items: 47 | $ref: '#/definitions/Product' 48 | default: 49 | description: Unexpected error 50 | schema: 51 | $ref: '#/definitions/Error' 52 | /estimates/price: 53 | get: 54 | summary: Price Estimates 55 | description: | 56 | The Price Estimates endpoint returns an estimated price range 57 | for each product offered at a given location. The price estimate is 58 | provided as a formatted string with the full price range and the localized 59 | currency symbol.

The response also includes low and high estimates, 60 | and the [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217) currency code for 61 | situations requiring currency conversion. When surge is active for a particular 62 | product, its surge_multiplier will be greater than 1, but the price estimate 63 | already factors in this multiplier. 64 | parameters: 65 | - name: start_latitude 66 | in: query 67 | description: Latitude component of start location. 68 | required: true 69 | type: number 70 | format: double 71 | - name: start_longitude 72 | in: query 73 | description: Longitude component of start location. 74 | required: true 75 | type: number 76 | format: double 77 | - name: end_latitude 78 | in: query 79 | description: Latitude component of end location. 80 | required: true 81 | type: number 82 | format: double 83 | - name: end_longitude 84 | in: query 85 | description: Longitude component of end location. 86 | required: true 87 | type: number 88 | format: double 89 | tags: 90 | - Estimates 91 | responses: 92 | 200: 93 | description: An array of price estimates by product 94 | schema: 95 | type: array 96 | items: 97 | $ref: '#/definitions/PriceEstimate' 98 | default: 99 | description: Unexpected error 100 | schema: 101 | $ref: '#/definitions/Error' 102 | /estimates/time: 103 | get: 104 | summary: Time Estimates 105 | description: The Time Estimates endpoint returns ETAs for all products offered at a given location, with the responses expressed as integers in seconds. We recommend that this endpoint be called every minute to provide the most accurate, up-to-date ETAs. 106 | parameters: 107 | - name: start_latitude 108 | in: query 109 | description: Latitude component of start location. 110 | required: true 111 | type: number 112 | format: double 113 | - name: start_longitude 114 | in: query 115 | description: Longitude component of start location. 116 | required: true 117 | type: number 118 | format: double 119 | - name: customer_uuid 120 | in: query 121 | type: string 122 | format: uuid 123 | description: Unique customer identifier to be used for experience customization. 124 | - name: product_id 125 | in: query 126 | type: string 127 | description: Unique identifier representing a specific product for a given latitude & longitude. 128 | tags: 129 | - Estimates 130 | responses: 131 | 200: 132 | description: An array of products 133 | schema: 134 | type: array 135 | items: 136 | $ref: '#/definitions/Product' 137 | default: 138 | description: Unexpected error 139 | schema: 140 | $ref: '#/definitions/Error' 141 | /me: 142 | get: 143 | summary: User Profile 144 | description: The User Profile endpoint returns information about the Uber user that has authorized with the application. 145 | tags: 146 | - User 147 | responses: 148 | 200: 149 | description: Profile information for a user 150 | schema: 151 | $ref: '#/definitions/Profile' 152 | default: 153 | description: Unexpected error 154 | schema: 155 | $ref: '#/definitions/Error' 156 | /history: 157 | get: 158 | summary: User Activity 159 | description: The User Activity endpoint returns data about a user's lifetime activity with Uber. The response will include pickup locations and times, dropoff locations and times, the distance of past requests, and information about which products were requested.

The history array in the response will have a maximum length based on the limit parameter. The response value count may exceed limit, therefore subsequent API requests may be necessary. 160 | parameters: 161 | - name: offset 162 | in: query 163 | type: integer 164 | format: int32 165 | description: Offset the list of returned results by this amount. Default is zero. 166 | - name: limit 167 | in: query 168 | type: integer 169 | format: int32 170 | description: Number of items to retrieve. Default is 5, maximum is 100. 171 | tags: 172 | - User 173 | responses: 174 | 200: 175 | description: History information for the given user 176 | schema: 177 | $ref: '#/definitions/Activities' 178 | default: 179 | description: Unexpected error 180 | schema: 181 | $ref: '#/definitions/Error' 182 | definitions: 183 | Product: 184 | type: object 185 | properties: 186 | product_id: 187 | type: string 188 | description: Unique identifier representing a specific product for a given latitude & longitude. For example, uberX in San Francisco will have a different product_id than uberX in Los Angeles. 189 | description: 190 | type: string 191 | description: Description of product. 192 | display_name: 193 | type: string 194 | description: Display name of product. 195 | capacity: 196 | type: string 197 | description: Capacity of product. For example, 4 people. 198 | image: 199 | type: string 200 | description: Image URL representing the product. 201 | PriceEstimate: 202 | type: object 203 | properties: 204 | product_id: 205 | type: string 206 | description: Unique identifier representing a specific product for a given latitude & longitude. For example, uberX in San Francisco will have a different product_id than uberX in Los Angeles 207 | currency_code: 208 | type: string 209 | description: "[ISO 4217](http://en.wikipedia.org/wiki/ISO_4217) currency code." 210 | display_name: 211 | type: string 212 | description: Display name of product. 213 | estimate: 214 | type: string 215 | description: Formatted string of estimate in local currency of the start location. Estimate could be a range, a single number (flat rate) or "Metered" for TAXI. 216 | low_estimate: 217 | type: number 218 | description: Lower bound of the estimated price. 219 | high_estimate: 220 | type: number 221 | description: Upper bound of the estimated price. 222 | surge_multiplier: 223 | type: number 224 | description: Expected surge multiplier. Surge is active if surge_multiplier is greater than 1. Price estimate already factors in the surge multiplier. 225 | Profile: 226 | type: object 227 | properties: 228 | first_name: 229 | type: string 230 | description: First name of the Uber user. 231 | last_name: 232 | type: string 233 | description: Last name of the Uber user. 234 | email: 235 | type: string 236 | description: Email address of the Uber user 237 | picture: 238 | type: string 239 | description: Image URL of the Uber user. 240 | promo_code: 241 | type: string 242 | description: Promo code of the Uber user. 243 | Activity: 244 | type: object 245 | properties: 246 | uuid: 247 | type: string 248 | description: Unique identifier for the activity 249 | Activities: 250 | type: object 251 | properties: 252 | offset: 253 | type: integer 254 | format: int32 255 | description: Position in pagination. 256 | limit: 257 | type: integer 258 | format: int32 259 | description: Number of items to retrieve (100 max). 260 | count: 261 | type: integer 262 | format: int32 263 | description: Total number of items available. 264 | history: 265 | type: array 266 | items: 267 | $ref: '#/definitions/Activity' 268 | Error: 269 | type: object 270 | properties: 271 | code: 272 | type: integer 273 | format: int32 274 | message: 275 | type: string 276 | fields: 277 | type: string 278 | -------------------------------------------------------------------------------- /src/test/resources/with-comments.json: -------------------------------------------------------------------------------- 1 | { 2 | /* this is a commented json file */ 3 | /* key-string */ 4 | "key-string": "string-value", 5 | /* key-number */ 6 | "key-number": 1, 7 | /* key-boolean */ 8 | // this is an inline comment 9 | "key-boolean": true, 10 | /* key-array */ 11 | "key-array": ["this", "is", "an", "array"] 12 | } 13 | -------------------------------------------------------------------------------- /src/test/resources/with-comments.yml: -------------------------------------------------------------------------------- 1 | # this is a commented json file 2 | # with emulated multi line presented as two single line comments 3 | key-string: "string-value" 4 | # key-number 5 | key-number: 1 6 | # key-boolean 7 | key-boolean: true 8 | # key-array 9 | key-array: 10 | - "this" 11 | - "is" 12 | - "an" 13 | - "array" 14 | key-obj: 15 | this: 1 16 | is: 2 17 | an: 3 18 | array: 4 19 | --------------------------------------------------------------------------------