Showing preview only (697K chars total). Download the full file or copy to clipboard to get everything.
Repository: viclovsky/swagger-coverage
Branch: master
Commit: 3d420920ce25
Files: 186
Total size: 625.7 KB
Directory structure:
gitextract_lgq7gab1/
├── .github/
│ ├── CODEOWNERS
│ ├── ISSUE_TEMPLATE.md
│ ├── dependabot.yml
│ ├── release-drafter.yml
│ └── workflows/
│ ├── build.yml
│ ├── gradle-wrapper-validation.yml
│ ├── label-verify.yml
│ ├── release-draft.yml
│ └── release.yml
├── .gitignore
├── LICENSE
├── README.md
├── build.gradle.kts
├── gradle/
│ ├── maven-publish.gradle
│ └── wrapper/
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradle.properties
├── gradlew
├── gradlew.bat
├── jitpack.yml
├── run.sh
├── settings.gradle.kts
├── swagger-coverage-commandline/
│ ├── build.gradle.kts
│ └── src/
│ ├── main/
│ │ ├── java/
│ │ │ └── com/
│ │ │ └── github/
│ │ │ └── viclovsky/
│ │ │ └── swagger/
│ │ │ └── coverage/
│ │ │ ├── CommandLine.java
│ │ │ ├── ExitCode.java
│ │ │ ├── configuration/
│ │ │ │ ├── Configuration.java
│ │ │ │ ├── ConfigurationBuilder.java
│ │ │ │ └── options/
│ │ │ │ ├── ConfigurationOptions.java
│ │ │ │ ├── MainOptions.java
│ │ │ │ ├── ResultsWriterOptions.java
│ │ │ │ └── RuleConfigurationOptions.java
│ │ │ ├── core/
│ │ │ │ ├── generator/
│ │ │ │ │ ├── Generator.java
│ │ │ │ │ ├── OperationConditionGenerator.java
│ │ │ │ │ └── SwaggerSpecificationProcessor.java
│ │ │ │ ├── model/
│ │ │ │ │ ├── Condition.java
│ │ │ │ │ ├── ConditionOperationCoverage.java
│ │ │ │ │ ├── OperationKey.java
│ │ │ │ │ ├── OperationsHolder.java
│ │ │ │ │ └── SinglePredicateCondition.java
│ │ │ │ ├── predicate/
│ │ │ │ │ ├── ConditionPredicate.java
│ │ │ │ │ ├── DefaultBodyConditionPredicate.java
│ │ │ │ │ ├── DefaultParameterConditionPredicate.java
│ │ │ │ │ ├── DefaultParameterValueConditionPredicate.java
│ │ │ │ │ ├── DefaultPropertyConditionPredicate.java
│ │ │ │ │ ├── DefaultStatusConditionPredicate.java
│ │ │ │ │ ├── FullStatusConditionPredicate.java
│ │ │ │ │ ├── NotOnlyParameterListValueConditionPredicate.java
│ │ │ │ │ ├── ParameterConditionPredicate.java
│ │ │ │ │ ├── ParameterUtils.java
│ │ │ │ │ ├── ParameterValueConditionPredicate.java
│ │ │ │ │ ├── PropertyConditionPredicate.java
│ │ │ │ │ ├── PropertyValueConditionPredicate.java
│ │ │ │ │ └── PropertyValueNotOnlyConditionPredicate.java
│ │ │ │ ├── results/
│ │ │ │ │ ├── Results.java
│ │ │ │ │ ├── builder/
│ │ │ │ │ │ ├── core/
│ │ │ │ │ │ │ ├── StatisticsBuilder.java
│ │ │ │ │ │ │ ├── StatisticsOperationPostBuilder.java
│ │ │ │ │ │ │ ├── StatisticsPostBuilder.java
│ │ │ │ │ │ │ └── StatisticsPreBuilder.java
│ │ │ │ │ │ ├── postbuilder/
│ │ │ │ │ │ │ ├── ConditionStatisticsBuilder.java
│ │ │ │ │ │ │ ├── ConfigurationStatisticsBuilder.java
│ │ │ │ │ │ │ ├── FlatOperationBuilder.java
│ │ │ │ │ │ │ ├── SwaggerInfoBuilder.java
│ │ │ │ │ │ │ ├── TagStatisticsBuilder.java
│ │ │ │ │ │ │ └── ZeroCallStatisticsBuilder.java
│ │ │ │ │ │ └── prebuilder/
│ │ │ │ │ │ ├── CoverageStatisticsBuilder.java
│ │ │ │ │ │ └── GenerationStatisticsBuilder.java
│ │ │ │ │ ├── data/
│ │ │ │ │ │ ├── ConditionCounter.java
│ │ │ │ │ │ ├── ConditionStatistics.java
│ │ │ │ │ │ ├── ConditionStatisticsItem.java
│ │ │ │ │ │ ├── CoverageCounter.java
│ │ │ │ │ │ ├── CoverageOperationMap.java
│ │ │ │ │ │ ├── CoverageState.java
│ │ │ │ │ │ ├── GenerationStatistics.java
│ │ │ │ │ │ ├── OperationResult.java
│ │ │ │ │ │ └── TagCoverage.java
│ │ │ │ │ └── util/
│ │ │ │ │ └── DateTimeUtil.java
│ │ │ │ ├── rule/
│ │ │ │ │ ├── body/
│ │ │ │ │ │ ├── NotEmptyBodyRule.java
│ │ │ │ │ │ ├── PropertyConditionRule.java
│ │ │ │ │ │ ├── PropertyEnumAllValuesRule.java
│ │ │ │ │ │ ├── PropertyNotEmptyRule.java
│ │ │ │ │ │ └── PropertyNotOnlyEnumValuesRule.java
│ │ │ │ │ ├── core/
│ │ │ │ │ │ └── ConditionRule.java
│ │ │ │ │ ├── parameter/
│ │ │ │ │ │ ├── EmptyHeaderRule.java
│ │ │ │ │ │ ├── EnumAllValuesRule.java
│ │ │ │ │ │ ├── NotEmptyParameterRule.java
│ │ │ │ │ │ ├── NotOnlyEnumValuesRule.java
│ │ │ │ │ │ └── ParameterConditionRule.java
│ │ │ │ │ └── status/
│ │ │ │ │ ├── HTTPStatusRule.java
│ │ │ │ │ ├── OnlyDeclaredHTTPStatusesRule.java
│ │ │ │ │ └── StatusConditionRule.java
│ │ │ │ └── writer/
│ │ │ │ ├── CoverageResultsWriter.java
│ │ │ │ ├── FileSystemResultsWriter.java
│ │ │ │ ├── HtmlReportResultsWriter.java
│ │ │ │ └── LogResultsWriter.java
│ │ │ └── option/
│ │ │ ├── MainOptions.java
│ │ │ └── VerboseOptions.java
│ │ └── resources/
│ │ └── logback.xml
│ └── test/
│ ├── java/
│ │ └── com/
│ │ └── github/
│ │ └── viclovsky/
│ │ └── swagger/
│ │ └── coverage/
│ │ ├── Config.java
│ │ ├── CustomReportTemplateTest.java
│ │ ├── ParseOptionsTest.java
│ │ └── SimpleTest.java
│ └── resources/
│ ├── configuration.json
│ ├── full_configuration.json
│ ├── report_custom.ftl
│ ├── v2/
│ │ ├── petstory.json
│ │ ├── petstory_no_tags.json
│ │ ├── petstory_operation_wo_tags.json
│ │ ├── petstory_with_x_example.json
│ │ ├── petstory_without_parameters.json
│ │ └── swagger-coverage-output/
│ │ ├── empty_parameters.json
│ │ ├── enum_param_1.json
│ │ ├── enum_param_2.json
│ │ ├── ignore_header.json
│ │ ├── match_pattern.json
│ │ ├── missed_in_swagger.json
│ │ ├── missed_in_swagger_without_x_example.json
│ │ ├── not_200.json
│ │ ├── one_coverage.json
│ │ ├── one_parameter.json
│ │ ├── one_partial_coverage.json
│ │ ├── test_empty_operation.json
│ │ └── two_coverage.json
│ └── v3/
│ ├── operations/
│ │ └── pet_petId.yaml
│ ├── petstory.yaml
│ ├── petstory_no_tags.yaml
│ ├── petstory_operation_wo_tags.yaml
│ ├── petstory_ref_operations.yaml
│ ├── petstory_with_x_example.yaml
│ ├── petstory_without_parameters.yaml
│ └── swagger-coverage-output/
│ ├── empty_parameters.yaml
│ ├── enum_param_1.yaml
│ ├── enum_param_2.yaml
│ ├── ignore_header.yaml
│ ├── match_pattern.yaml
│ ├── missed_in_swagger.yaml
│ ├── missed_in_swagger_without_x_example.yaml
│ ├── not_200.yaml
│ ├── one_coverage.yaml
│ ├── one_parameter.yaml
│ ├── one_partial_coverage.yaml
│ ├── test_empty_operation.yaml
│ └── two_coverage.yaml
├── swagger-coverage-commons/
│ ├── build.gradle.kts
│ └── src/
│ └── main/
│ ├── java/
│ │ └── com/
│ │ └── github/
│ │ └── viclovsky/
│ │ └── swagger/
│ │ └── coverage/
│ │ ├── CoverageOutputReader.java
│ │ ├── CoverageOutputWriter.java
│ │ ├── FileSystemOutputReader.java
│ │ ├── FileSystemOutputWriter.java
│ │ ├── SwaggerCoverageConstants.java
│ │ ├── SwaggerCoverageReadException.java
│ │ ├── SwaggerCoverageUtils.java
│ │ ├── SwaggerCoverageWriteException.java
│ │ ├── model/
│ │ │ └── SwaggerCoverage2ModelJackson.java
│ │ └── utils/
│ │ └── FreemarkerUtils.java
│ └── resources/
│ ├── details/
│ │ ├── condition.ftl
│ │ ├── operation.ftl
│ │ └── tag.ftl
│ ├── message.en
│ ├── message.ru
│ ├── report.ftl
│ ├── sections/
│ │ ├── generation.ftl
│ │ └── summary.ftl
│ └── ui.ftl
├── swagger-coverage-karate/
│ ├── README.md
│ ├── build.gradle.kts
│ └── src/
│ ├── main/
│ │ ├── java/
│ │ │ └── com/
│ │ │ └── github/
│ │ │ └── viclovsky/
│ │ │ └── swagger/
│ │ │ └── coverage/
│ │ │ └── karate/
│ │ │ ├── Request.java
│ │ │ ├── RequestWriter.java
│ │ │ ├── SwaggerCoverageOptions.java
│ │ │ └── SwaggerCoverageRunner.java
│ │ └── resources/
│ │ ├── httpProxy.feature
│ │ └── karate-base.js
│ └── test/
│ ├── java/
│ │ └── com/
│ │ └── github/
│ │ └── viclovsky/
│ │ └── swagger/
│ │ └── coverage/
│ │ └── karate/
│ │ ├── RequestWriterTest.java
│ │ └── SwaggerCoverageRunnerTest.java
│ └── resources/
│ ├── api-test-coverage-v2/
│ │ ├── swagger-coverage-config.json
│ │ └── swagger-specification.json
│ ├── api-test-coverage-v3/
│ │ ├── swagger-coverage-config.json
│ │ └── swagger-specification.yaml
│ ├── petv2.feature
│ ├── petv3.feature
│ ├── request.json
│ └── wiremock/
│ └── __files/
│ ├── openapi.yaml
│ └── swagger.json
└── swagger-coverage-rest-assured/
├── build.gradle.kts
└── src/
├── main/
│ └── java/
│ └── com/
│ └── github/
│ └── viclovsky/
│ └── swagger/
│ └── coverage/
│ ├── SwaggerCoverageRestAssured.java
│ └── SwaggerCoverageV3RestAssured.java
└── test/
└── java/
└── com/
└── github/
└── viclovsky/
└── swagger/
└── coverage/
├── RequestLoggerFilterTest.java
└── RequestLoggerV3FilterTest.java
================================================
FILE CONTENTS
================================================
================================================
FILE: .github/CODEOWNERS
================================================
* @viclovsky
================================================
FILE: .github/ISSUE_TEMPLATE.md
================================================
[//]: # (
. This repository's issues are reserved for feature requests and bug reports.
.
. Make sure you have a clear name for your issue. The name should start with a capital
. letter and no dot is required in the end of the sentence. An example of good issue names:
.
. - Bad perfomance with a large specification
. - Support OAS3
)
#### I'm submitting a ...
- [ ] bug report
- [ ] feature request
#### What is the current behavior?
#### If the current behavior is a bug, please provide steps to reproduce, broken swagger specification and swagger-coverage-output:
#### What is the expected behavior?
#### What is the motivation / use case for changing the behavior?
#### Other information
[//]: # (
. e.g. detailed explanation, stacktraces, related issues, suggestions
. how to fix, links for us to have more context
)
================================================
FILE: .github/dependabot.yml
================================================
version: 2
updates:
- package-ecosystem: gradle
directory: /
schedule:
interval: weekly
- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly
================================================
FILE: .github/release-drafter.yml
================================================
name-template: '$NEXT_MINOR_VERSION'
tag-template: '$NEXT_MINOR_VERSION'
categories:
- title: '🚀 New Features'
label: 'type:new feature'
- title: '🔬 Improvements'
label: 'type:improvement'
- title: '🐞 Bug Fixes'
label: 'type:bug'
change-template: '* $TITLE (via #$NUMBER) - @$AUTHOR'
template: |
$CHANGES
## 👀 Links
[Commits since $PREVIOUS_TAG](https://github.com/viclovsky/swagger-coverage/compare/$PREVIOUS_TAG...master)
================================================
FILE: .github/workflows/build.yml
================================================
name: CI
on:
pull_request:
branches:
- '*'
push:
branches:
- 'master'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 8
cache: 'gradle'
- name: Gradle Build
run: ./gradlew build
- name: Run Demo
if: github.event_name == 'pull_request'
run: ./run.sh
- uses: actions/upload-artifact@v3
if: github.event_name == 'pull_request'
with:
name: custom-report.html
path: custom-report.html
================================================
FILE: .github/workflows/gradle-wrapper-validation.yml
================================================
name: "Validate Gradle Wrapper"
on:
push:
branches:
- master
paths:
- 'gradlew'
- 'gradlew.bat'
- 'gradle/wrapper/**'
- '.github/workflows/gradle-wrapper-validation.yml'
pull_request:
branches:
- master
paths:
- 'gradlew'
- 'gradlew.bat'
- 'gradle/wrapper/**'
- '.github/workflows/gradle-wrapper-validation.yml'
jobs:
validation:
name: "Validation"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: gradle/wrapper-validation-action@v1
================================================
FILE: .github/workflows/label-verify.yml
================================================
name: "Verify type labels"
on:
pull_request:
types: [opened, labeled, unlabeled, synchronize]
jobs:
triage:
runs-on: ubuntu-latest
steps:
- uses: zwaldowski/match-label-action@v2
with:
allowed: 'type:new feature, type:improvement, type:bug'
================================================
FILE: .github/workflows/release-draft.yml
================================================
name: Release Draft
on:
push:
branches:
- master
jobs:
update_draft_release:
runs-on: ubuntu-latest
steps:
- uses: toolmantim/release-drafter@v5.2.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
================================================
FILE: .github/workflows/release.yml
================================================
name: Release
on:
release:
types: [published]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Set up JDK
uses: actions/setup-java@v1
with:
java-version: 8
- run: echo "::set-output name=version::${GITHUB_REF:10}"
id: release
- name: "Gradle Build"
run: ./gradlew build -Pversion=${{ steps.release.outputs.version }}
- name: Prepare to publish
run: |
echo '${{secrets.GPG_KEY_CONTENTS}}' | base64 -d > ${{ github.workspace }}/publish_key.gpg
gpg --quiet --batch --yes --decrypt --passphrase="${{secrets.SECRET_PASSPHRASE}}" \
--output ${{ github.workspace }}/secret.gpg ${{ github.workspace }}/publish_key.gpg
- name: "Publish packages to Maven Central"
env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
run: ./gradlew --no-parallel publishAllPublicationsToSonatypeRepository -Pversion=${{ steps.release.outputs.version }} -Psigning.secretKeyRingFile=${{ github.workspace }}/secret.gpg -Psigning.keyId=${{secrets.SIGNING_KEYID}} -Psigning.password=${{secrets.SIGNING_PASSWORD}}
- name: "Publish Zip to GitHub"
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./swagger-coverage-commandline/build/distributions/swagger-coverage-commandline-${{ steps.release.outputs.version }}.zip
asset_name: swagger-coverage-${{ steps.release.outputs.version }}.zip
asset_content_type: application/octet-stream
- name: "Publish Tar to GitHub"
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./swagger-coverage-commandline/build/distributions/swagger-coverage-commandline-${{ steps.release.outputs.version }}.tar
asset_name: swagger-coverage-${{ steps.release.outputs.version }}.tar
asset_content_type: application/octet-stream
================================================
FILE: .gitignore
================================================
# IDEA files
.idea
*.iml
# Gradle
.gradle
build
# Mac OS
.DS_Store
# Allure
allure-results
bin/
================================================
FILE: LICENSE
================================================
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [2019] [viclovsky]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
================================================
FILE: README.md
================================================
[license]: http://www.apache.org/licenses/LICENSE-2.0 "Apache License 2.0"
[release]: https://github.com/viclovsky/swagger-coverage/releases/latest "Latest release"
[release-badge]: https://img.shields.io/github/release/viclovsky/swagger-coverage.svg?style=flat
[maven]: https://repo.maven.apache.org/maven2/com/github/viclovsky/swagger-coverage-commandline/ "Maven Central"
[maven-badge]: https://img.shields.io/maven-central/v/com.github.viclovsky/swagger-coverage-commandline.svg?style=flat
[](https://github.com/viclovsky/swagger-coverage/actions)
[![release-badge][]][release]
[![maven-badge][]][maven]
# swagger-coverage
Swagger-coverage gives a full picture about coverage of API tests (regression) based on OAS (Swagger).
By saying coverage we mean not a broad theme functionality, but presence (or absence) of calls defined by API methods, parameters, return codes or other conditions which corresponds specification of API.

## How it works
Producing coverage report consists of two parts. Firstly, during test execution, filter/interceptor/proxy save information of calls in swagger format in specific folder on executing tests.
The next stage is to compare saved result with generated conditions from current API specification and builds report.
## How to use and examples
You can use swagger-coverage with any language and framework. You need to have proxy/filter/interceptor that accumulates data in swagger format.
Swagger-coverage have rest-assured integration from the box.
> There is also a Karate integration, which has its own [manual](/swagger-coverage-karate/README.md).
Add filter dependency:
```xml
<dependency>
<groupId>com.github.viclovsky</groupId>
<artifactId>swagger-coverage-rest-assured</artifactId>
<version>${latest-swagger-coverage-version}</version>
</dependency>
```
or if use gradle, it can be added like
```
compile "com.github.viclovsky:swagger-coverage-rest-assured:$latest-swagger-coverage-version"
```
Just add filter into test client SwaggerCoverageRestAssured (SwaggerCoverageV3RestAssured for v3). For instance, as presented below:
```java
RestAssured.given().filter(new SwaggerCoverageRestAssured())
```
* Download and run command line.
Download zip archive and unpack it. Don't forget to replace {latest-swagger-coverage-version} to latest version.
```
wget https://github.com/viclovsky/swagger-coverage/releases/download/{latest-swagger-coverage-version}/swagger-coverage-{latest-swagger-coverage-version}.zip
unzip swagger-coverage-commandline-{latest-swagger-coverage-version}.zip
```
Here is help of unzip swagger-commandline
```
./swagger-coverage-commandline --help
Options:
* -s, --spec
Path to local or URL to remote swagger specification.
* -i, --input
Path to folder with generated files with coverage.
-c, --configuration
Path to file with report configuration.
--help
Print commandline help.
-q, --quiet
Switch on the quiet mode.
Default: false
-v, --verbose
Switch on the verbose mode.
Default: false
```
To compare result of API tests with current API specification and build report call command line tool after running tests like that:
```
./swagger-coverage-commandline -s swagger.json -i swagger-coverage-output
```
Output of the command:
```
19:21:21 INFO OperationSwaggerCoverageCalculator - Empty coverage:
...
19:21:21 INFO OperationSwaggerCoverageCalculator - Partial coverage:
...
19:21:21 INFO OperationSwaggerCoverageCalculator - Full coverage:
...
19:21:21 INFO OperationSwaggerCoverageCalculator - Conditions: 874/2520
19:21:21 INFO OperationSwaggerCoverageCalculator - Empty coverage 49.284 %
19:21:21 INFO OperationSwaggerCoverageCalculator - Partial coverage 12.034 %
19:21:21 INFO OperationSwaggerCoverageCalculator - Full coverage 38.682 %
19:21:21 INFO FileSystemResultsWriter - Write html report in file '.../swagger-coverage-report.html'
```
Results (swagger-coverage-report.html/swagger-coverage-results.json) will be created after running of swagger-coverage.
## Configuration options
Swagger-coverage report can be configured by json-file.
You can control list of coverage, which be generated and checked for results.
## Rules configuration options
Options for different rules are placed in "rules" section.
You can disable some rules or change their behavior.
#### Checking response http-status
This rule create condition for every status from *responses*-section of swagger specification.
Condition mark *covered* when report generator find specific status in results files.
Options for this rules are placed in *status* subsection in *rules* sections.
You can setup next options:
**enable** - *true/false*. You can disable this rule. Default value is *true*.
**filter** - *[val1,val2]*. Rule will ignore all status, which not in filter list.
**ignore** - *[val1,val2]*. Rule will ignore all status, which in ignore list.
````
{
"rules" : {
"status": {
"enable": true,
"ignore": ["400","500"],
"filter": ["200"]
},
....
},
....
}
````
#### Checking the list of declared and received statuses
This rule create condition for comparing declared and received status.
Condition marked as *covered* when result not contains any of undeclared status.
*Uncovered* state of this condition indicates missed status in original swagger-documentation
or server errors.
Options for this rules are placed in *only-declared-status* subsection in *rules* sections.
You can setup next options:
**enable** - *true/false*. You can disable this rule. Default value is *true*.
````
{
"rules" : {
....
"only-declared-status" : {
"enable" : true
}
},
....
}
````
#### Excluding deprecated operations from the coverage report statistic
This rule is created for cases when you don't want to measure coverage of deprecated operations, but only for actual ones. <br>
If an operation is deprecated then it will be excluded from *Full*, *Partial*, and *Empty* categories and won't affect the "Operations coverage summary"
Options for this rule are placed in "*exclude-deprecated*" subsection in *rules* sections.
You can set up next options:
**enable** - *true/false*. <br>
By default, this rule is not enabled. Add it to the config file with *true* value to enable this rule, like in the example below:
````
{
"rules" : {
....
"exclude-deprecated" : {
"enable" : true
}
},
....
}
````
If you need you can add your rules for generation of conditions. So, please, send your PRs.
## Result writer configuration
Options for report generation setting are placed in *writers* sections.
#### HTML report writer
Options for html-report placed in subsection *html* of *writers* sections.
You can setup next options:
**locale** - two latter language code. Now supported only *en/ru*.
**filename** - filename for html report.
**numberFormat** - [Extended Java decimal format](https://freemarker.apache.org/docs/ref_builtins_number.html#topic.extendedJavaDecimalFormat) to control how numbers are displayed in the report.
````
{
....
"writers": {
"html": {
"locale": "ru",
"filename":"report.html",
"numberFormat": "0.##"
}
}
}
````
#### Report customization
To customize your http report with your own template set full path to the template like below:
````
{
....
"writers": {
"html": {
....
"customTemplatePath": "/full/path/to/report_custom.ftl"
}
}
}
````
[Look here](https://github.com/swagger-api/swagger-parser/blob/master/modules/swagger-parser-core/src/main/java/io/swagger/v3/parser/core/models/ParseOptions.java) to see all available options.
## Demo
I have prepared several tests. Thus you are able to have a look and touch swagger-coverage. Just run ```run.sh``` script.
## Important remark
Swagger-coverage works fine with clients which were generated from swagger (for example: https://github.com/OpenAPITools/openapi-generator).
Because all methods/parameters which will be saved are 100% compatible with current API specification.
## Requirements
For a moment swagger-coverage is compatible only with OpenApi specifications v2 & v3. It is possible that swagger-coverage will support other versions.
## Pull Requests
My project is open for any enhancement. So, your help is much appreciated. Please, feel free to open your pull request or issue and I will consider it in several days.
## Created & Maintained By
[Victor Orlovsky](https://github.com/viclovsky)
## Contributing to swagger-coverage
Thanks to all people who contributed. Especially
* [@TemaMak](https://github.com/TemaMak)
* [@Emilio-Pega](https://github.com/Emilio-Pega)
who have contributed significant improvements to swagger-coverage.
## License
Swagger coverage is released under version 2.0 of the [Apache License](http://www.apache.org/licenses/LICENSE-2.0)
================================================
FILE: build.gradle.kts
================================================
import io.spring.gradle.dependencymanagement.dsl.DependencyManagementExtension
buildscript {
repositories {
mavenLocal()
}
}
plugins {
java
id("io.spring.dependency-management") version "1.0.11.RELEASE"
}
group = "com.github.viclovsky"
version = version
val root = rootProject.projectDir
val gradleScriptDir by extra("$root/gradle")
java {
sourceCompatibility = JavaVersion.VERSION_1_8
}
configure(subprojects) {
group = "com.github.viclovsky"
version = version
apply(plugin = "io.spring.dependency-management")
apply(plugin = "java")
apply(plugin = "java-library")
configure<DependencyManagementExtension> {
imports {
mavenBom("com.fasterxml.jackson:jackson-bom:2.9.8")
}
dependencies {
dependency("org.freemarker:freemarker:2.3.31")
//swagger 2.x
dependency("io.swagger:swagger-models:1.6.6")
//swagger 3.x
dependency("io.swagger.core.v3:swagger-core:2.2.0")
dependency("io.swagger.core.v3:swagger-models:2.2.0")
dependency("io.swagger.parser.v3:swagger-parser:2.0.32")
dependency("org.slf4j:slf4j-api:1.7.32")
dependency("ch.qos.logback:logback-classic:1.2.10")
dependency("com.beust:jcommander:1.81")
dependency("junit:junit:4.13.2")
dependency("org.hamcrest:hamcrest:2.2")
dependency("com.jayway.jsonpath:json-path-assert:2.7.0")
dependency("io.rest-assured:rest-assured:4.4.0")
dependency("com.github.tomakehurst:wiremock:2.27.2")
dependency("com.fasterxml.jackson.core:jackson-core:2.12.3")
dependency("com.fasterxml.jackson.core:jackson-databind:2.12.3")
dependency("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.12.3")
dependency("com.fasterxml.jackson.core:jackson-annotations:2.12.3")
dependency("org.springframework:spring-web:5.3.7")
dependency("com.intuit.karate:karate-core:1.2.0.RC1")
}
}
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
val sourceJar by tasks.creating(Jar::class) {
from(sourceSets.getByName("main").allSource)
archiveClassifier.set("sources")
}
val javadocJar by tasks.creating(Jar::class) {
from(tasks.getByName("javadoc"))
archiveClassifier.set("javadoc")
}
tasks.withType(Javadoc::class) {
(options as StandardJavadocDocletOptions).addStringOption("Xdoclint:none", "-quiet")
}
tasks.withType<GenerateModuleMetadata> {
enabled = false
}
artifacts.add("archives", sourceJar)
artifacts.add("archives", javadocJar)
tasks.compileJava {
options.encoding = "UTF-8"
}
tasks.compileTestJava {
options.encoding = "UTF-8"
options.compilerArgs.add("-parameters")
}
tasks.jar {
manifest {
attributes(mapOf(
"Implementation-Title" to project.name,
"Implementation-Version" to project.version
))
}
}
apply(from = "$gradleScriptDir/maven-publish.gradle")
}
repositories {
mavenCentral()
}
================================================
FILE: gradle/maven-publish.gradle
================================================
apply plugin: 'maven-publish'
apply plugin: 'signing'
publishing {
publications {
gpr(MavenPublication) {
from components.java
artifact sourceJar
artifact javadocJar
pom {
name = project.name
description = project.name
url = "https://github.com/viclovsky/swagger-coverage"
organization {
name = "viclovsky"
url = "https://github.com/viclovsky"
}
licenses {
license {
name = 'The Apache Software License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution = 'repo'
}
}
scm {
url = 'https://github.com/viclovsky/swagger-coverage'
connection = 'scm:git:git://github.com/viclovsky/swagger-coverage'
developerConnection = 'scm:git:git://github.com/viclovsky/swagger-coverage'
}
developers {
developer {
id = 'viclovsky'
name = 'Victor Orlovsky'
email = 'viclovsky@gmail.com'
}
}
issueManagement {
system = 'Github Issues'
url = 'https://github.com/viclovsky/swagger-coverage/issues'
}
}
}
}
repositories {
maven {
name = "sonatype"
url = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2")
credentials {
username = project.hasProperty('SONATYPE_USERNAME') ? project.property('SONATYPE_USERNAME') : System.getenv('SONATYPE_USERNAME')
password = project.hasProperty('SONATYPE_PASSWORD') ? project.property('SONATYPE_PASSWORD') : System.getenv('SONATYPE_PASSWORD')
}
}
}
}
signing {
sign publishing.publications
}
================================================
FILE: gradle/wrapper/gradle-wrapper.properties
================================================
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
================================================
FILE: gradle.properties
================================================
version=1.0-SNAPSHOT
================================================
FILE: gradlew
================================================
#!/bin/sh
#
# Copyright © 2015-2021 the original authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
##############################################################################
#
# Gradle start up script for POSIX generated by Gradle.
#
# Important for running:
#
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
# noncompliant, but you have some other compliant shell such as ksh or
# bash, then to run this script, type that shell name before the whole
# command line, like:
#
# ksh Gradle
#
# Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features:
# * functions;
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit».
#
# Important for patching:
#
# (2) This script targets any POSIX shell, so it avoids extensions provided
# by Bash, Ksh, etc; in particular arrays are avoided.
#
# The "traditional" practice of packing multiple parameters into a
# space-separated string is a well documented source of bugs and security
# problems, so this is (mostly) avoided, by progressively accumulating
# options in "$@", and eventually passing that to Java.
#
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
# see the in-line comments for details.
#
# There are tweaks for specific operating systems such as AIX, CygWin,
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
#
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
app_path=$0
# Need this for daisy-chained symlinks.
while
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
[ -h "$app_path" ]
do
ls=$( ls -ld "$app_path" )
link=${ls#*' -> '}
case $link in #(
/*) app_path=$link ;; #(
*) app_path=$APP_HOME$link ;;
esac
done
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
warn () {
echo "$*"
} >&2
die () {
echo
echo "$*"
echo
exit 1
} >&2
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "$( uname )" in #(
CYGWIN* ) cygwin=true ;; #(
Darwin* ) darwin=true ;; #(
MSYS* | MINGW* ) msys=true ;; #(
NONSTOP* ) nonstop=true ;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD=$JAVA_HOME/jre/sh/java
else
JAVACMD=$JAVA_HOME/bin/java
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
fi
# Collect all arguments for the java command, stacking in reverse order:
# * args from the command line
# * the main class name
# * -classpath
# * -D...appname settings
# * --module-path (only if needed)
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
# For Cygwin or MSYS, switch paths to Windows format before running java
if "$cygwin" || "$msys" ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
JAVACMD=$( cygpath --unix "$JAVACMD" )
# Now convert the arguments - kludge to limit ourselves to /bin/sh
for arg do
if
case $arg in #(
-*) false ;; # don't mess with options #(
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
[ -e "$t" ] ;; #(
*) false ;;
esac
then
arg=$( cygpath --path --ignore --mixed "$arg" )
fi
# Roll the args list around exactly as many times as the number of
# args, so each arg winds up back in the position where it started, but
# possibly modified.
#
# NB: a `for` loop captures its iteration list before it begins, so
# changing the positional parameters here affects neither the number of
# iterations, nor the values presented in `arg`.
shift # remove old arg
set -- "$@" "$arg" # push replacement arg
done
fi
# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
"$@"
# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi
# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
#
# In Bash we could simply go:
#
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
# set -- "${ARGS[@]}" "$@"
#
# but POSIX shell has neither arrays nor command substitution, so instead we
# post-process each arg (as a line of input to sed) to backslash-escape any
# character that might be a shell metacharacter, then use eval to reverse
# that process (while maintaining the separation between arguments), and wrap
# the whole thing up as a single "set" statement.
#
# This will of course break if any of these variables contains a newline or
# an unmatched quote.
#
eval "set -- $(
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
xargs -n1 |
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
tr '\n' ' '
)" '"$@"'
exec "$JAVACMD" "$@"
================================================
FILE: gradlew.bat
================================================
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end
@rem End local scope for the variables with windows NT shell
if %ERRORLEVEL% equ 0 goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega
================================================
FILE: jitpack.yml
================================================
jdk:
- openjdk8
install:
- ./gradlew clean build publishToMavenLocal -x signGprPublication
================================================
FILE: run.sh
================================================
./gradlew clean build -x test
rm -r -f swagger-coverage-commandline-1.0-SNAPSHOT
unzip swagger-coverage-commandline/build/distributions/swagger-coverage-commandline-1.0-SNAPSHOT.zip
./swagger-coverage-commandline-1.0-SNAPSHOT/bin/swagger-coverage-commandline -s swagger-coverage-commandline/src/test/resources/v3/petstory.yaml -i swagger-coverage-commandline/src/test/resources/v3/swagger-coverage-output -c swagger-coverage-commandline/src/test/resources/configuration.json
================================================
FILE: settings.gradle.kts
================================================
rootProject.name = "swagger-coverage"
include("swagger-coverage-commandline")
include("swagger-coverage-rest-assured")
include("swagger-coverage-commons")
include("swagger-coverage-karate")
================================================
FILE: swagger-coverage-commandline/build.gradle.kts
================================================
plugins {
java
`java-library`
application
}
description = "Swagger-coverage Commandline"
application {
mainClass.set("com.github.viclovsky.swagger.coverage.CommandLine")
}
java {
sourceCompatibility = JavaVersion.VERSION_1_8
}
repositories {
mavenCentral()
}
dependencies {
api(project(":swagger-coverage-commons"))
implementation("io.swagger.parser.v3:swagger-parser")
implementation("org.slf4j:slf4j-api")
implementation("ch.qos.logback:logback-classic")
implementation("com.beust:jcommander")
implementation("org.springframework:spring-web")
testImplementation("junit:junit")
testImplementation("org.hamcrest:hamcrest")
testImplementation("com.jayway.jsonpath:json-path-assert")
}
tasks {
test {
//set the workingDir to the build dir so we don't pollute the main project dir
//with generated test files
workingDir(buildDir)
}
}
================================================
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/CommandLine.java
================================================
package com.github.viclovsky.swagger.coverage;
import ch.qos.logback.classic.Level;
import com.beust.jcommander.JCommander;
import com.beust.jcommander.ParameterException;
import com.beust.jcommander.Parameters;
import com.beust.jcommander.ParametersDelegate;
import com.github.viclovsky.swagger.coverage.core.generator.Generator;
import com.github.viclovsky.swagger.coverage.option.MainOptions;
import com.github.viclovsky.swagger.coverage.option.VerboseOptions;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Optional;
@Parameters(commandNames = "swagger-coverage", commandDescription = "Swagger-coverage Commandline")
public class CommandLine {
@ParametersDelegate
private MainOptions mainOptions = new MainOptions();
@ParametersDelegate
private VerboseOptions verboseOptions = new VerboseOptions();
private static final Logger LOGGER = LoggerFactory.getLogger(CommandLine.class);
private final JCommander commander = new JCommander(this);
public static void main(final String[] argv) {
final CommandLine commandLine = new CommandLine();
final ExitCode exitCode = commandLine
.parse(argv)
.orElseGet(commandLine::run);
System.exit(exitCode.getCode());
}
@SuppressWarnings({"PMD.AvoidLiteralsInIfCondition", "ReturnCount"})
public Optional<ExitCode> parse(final String... args) {
if (args.length == 0) {
printUsage(commander);
return Optional.of(ExitCode.ARGUMENT_PARSING_ERROR);
}
try {
commander.parse(args);
} catch (ParameterException e) {
LOGGER.debug("Error during arguments parsing: {}", e);
LOGGER.info("Could not parse arguments: {}", e.getMessage());
printUsage(commander);
return Optional.of(ExitCode.ARGUMENT_PARSING_ERROR);
}
return Optional.empty();
}
private ExitCode run() {
ch.qos.logback.classic.Logger rootLogger =
(ch.qos.logback.classic.Logger) LoggerFactory.getLogger(org.slf4j.Logger.ROOT_LOGGER_NAME);
if (verboseOptions.isQuiet()) {
rootLogger.setLevel(Level.OFF);
}
if (verboseOptions.isVerbose()) {
rootLogger.setLevel(Level.DEBUG);
}
if (mainOptions.isHelp()) {
printUsage(commander);
return ExitCode.NO_ERROR;
}
new Generator().setInputPath(mainOptions.getInputPath())
.setSpecPath(mainOptions.getSpecPath())
.setConfigurationPath(mainOptions.getConfiguration())
.run();
return ExitCode.NO_ERROR;
}
private void printUsage(final JCommander commander) {
commander.usage();
}
}
================================================
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/ExitCode.java
================================================
package com.github.viclovsky.swagger.coverage;
public enum ExitCode {
NO_ERROR(0),
GENERIC_ERROR(1),
ARGUMENT_PARSING_ERROR(127);
private final int code;
ExitCode(final int code) {
this.code = code;
}
public int getCode() {
return code;
}
public boolean isSuccess() {
return 0 == code;
}
}
================================================
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/configuration/Configuration.java
================================================
package com.github.viclovsky.swagger.coverage.configuration;
import com.github.viclovsky.swagger.coverage.configuration.options.ConfigurationOptions;
import com.github.viclovsky.swagger.coverage.configuration.options.RuleConfigurationOptions;
import com.github.viclovsky.swagger.coverage.core.results.builder.core.StatisticsBuilder;
import com.github.viclovsky.swagger.coverage.core.rule.core.ConditionRule;
import com.github.viclovsky.swagger.coverage.core.writer.CoverageResultsWriter;
import io.swagger.v3.oas.models.OpenAPI;
import java.util.List;
import java.util.stream.Collectors;
public class Configuration {
protected ConfigurationOptions options = new ConfigurationOptions();
private List<ConditionRule> defaultRules;
private List<StatisticsBuilder> registeredBuilders;
/**
* Configured data
**/
private List<ConditionRule> configuredRules = null;
private List<StatisticsBuilder> configuredBuilders = null;
private List<CoverageResultsWriter> configuredResultsWriters = null;
public Configuration() {
}
public List<ConditionRule> getRulesList() {
if (configuredRules == null) {
configuredRules = defaultRules.stream()
.filter(rule -> enableByRuleOptions(rule.getId()))
.map(rule -> rule.configure(options.getRules().getOrDefault(rule.getId(),
new RuleConfigurationOptions())))
.collect(Collectors.toList());
}
return configuredRules;
}
public List<StatisticsBuilder> getStatisticsBuilders(OpenAPI specification) {
if (configuredBuilders == null) {
configuredBuilders = registeredBuilders
.stream().map(builder -> builder
.configure(options)
.configure(specification, getRulesList())
)
.collect(Collectors.toList());
}
return configuredBuilders;
}
protected boolean enableByRuleOptions(String id) {
RuleConfigurationOptions option = options.getRules().get(id);
if (option != null) {
return option.isEnable();
}
return true;
}
public Configuration setOptions(ConfigurationOptions options) {
this.options = options;
return this;
}
public RuleConfigurationOptions getOption(String optionKey) {
return this.options.getRules().get(optionKey);
}
public Configuration setDefaultRules(List<ConditionRule> defaultRules) {
this.defaultRules = defaultRules;
return this;
}
public Configuration setRegisteredBuilders(List<StatisticsBuilder> registeredBuilders) {
this.registeredBuilders = registeredBuilders;
return this;
}
public List<StatisticsBuilder> getConfiguredBuilders() {
return configuredBuilders;
}
public Configuration setConfiguredBuilders(List<StatisticsBuilder> configuredBuilders) {
this.configuredBuilders = configuredBuilders;
return this;
}
public List<CoverageResultsWriter> getConfiguredResultsWriters() {
return configuredResultsWriters;
}
public Configuration setConfiguredResultsWriters(List<CoverageResultsWriter> configuredResultsWriters) {
this.configuredResultsWriters = configuredResultsWriters;
return this;
}
}
================================================
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/configuration/ConfigurationBuilder.java
================================================
package com.github.viclovsky.swagger.coverage.configuration;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.github.viclovsky.swagger.coverage.configuration.options.ConfigurationOptions;
import com.github.viclovsky.swagger.coverage.core.results.builder.core.StatisticsBuilder;
import com.github.viclovsky.swagger.coverage.core.results.builder.postbuilder.ConditionStatisticsBuilder;
import com.github.viclovsky.swagger.coverage.core.results.builder.postbuilder.ConfigurationStatisticsBuilder;
import com.github.viclovsky.swagger.coverage.core.results.builder.postbuilder.FlatOperationBuilder;
import com.github.viclovsky.swagger.coverage.core.results.builder.postbuilder.SwaggerInfoBuilder;
import com.github.viclovsky.swagger.coverage.core.results.builder.postbuilder.TagStatisticsBuilder;
import com.github.viclovsky.swagger.coverage.core.results.builder.postbuilder.ZeroCallStatisticsBuilder;
import com.github.viclovsky.swagger.coverage.core.results.builder.prebuilder.CoverageStatisticsBuilder;
import com.github.viclovsky.swagger.coverage.core.results.builder.prebuilder.GenerationStatisticsBuilder;
import com.github.viclovsky.swagger.coverage.core.rule.body.PropertyEnumAllValuesRule;
import com.github.viclovsky.swagger.coverage.core.rule.body.PropertyNotEmptyRule;
import com.github.viclovsky.swagger.coverage.core.rule.body.PropertyNotOnlyEnumValuesRule;
import com.github.viclovsky.swagger.coverage.core.rule.core.ConditionRule;
import com.github.viclovsky.swagger.coverage.core.rule.parameter.EmptyHeaderRule;
import com.github.viclovsky.swagger.coverage.core.rule.body.NotEmptyBodyRule;
import com.github.viclovsky.swagger.coverage.core.rule.parameter.EnumAllValuesRule;
import com.github.viclovsky.swagger.coverage.core.rule.parameter.NotEmptyParameterRule;
import com.github.viclovsky.swagger.coverage.core.rule.parameter.NotOnlyEnumValuesRule;
import com.github.viclovsky.swagger.coverage.core.rule.status.HTTPStatusRule;
import com.github.viclovsky.swagger.coverage.core.rule.status.OnlyDeclaredHTTPStatusesRule;
import com.github.viclovsky.swagger.coverage.core.writer.CoverageResultsWriter;
import com.github.viclovsky.swagger.coverage.core.writer.FileSystemResultsWriter;
import com.github.viclovsky.swagger.coverage.core.writer.HtmlReportResultsWriter;
import com.github.viclovsky.swagger.coverage.core.writer.LogResultsWriter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.List;
public class ConfigurationBuilder {
private static final Logger LOGGER = LoggerFactory.getLogger(ConfigurationBuilder.class);
public static Configuration build(Path path) {
Configuration configuration = new Configuration();
ConfigurationOptions options = new ConfigurationOptions();
ObjectMapper mapper = new ObjectMapper();
try {
if (path != null) {
options = mapper.readValue(path.toFile(), ConfigurationOptions.class);
}
} catch (IOException e) {
LOGGER.info("can't read configuration, use default configuration");
}
configuration.setOptions(options)
.setDefaultRules(getDefaultList())
.setRegisteredBuilders(getDefaultBuilderList())
.setConfiguredResultsWriters(getResultsWriters(options));
return configuration;
}
private static List<CoverageResultsWriter> getResultsWriters(ConfigurationOptions options) {
List<CoverageResultsWriter> configuredResultsWriters = new ArrayList<>();
if (options.getWriters().isEmpty()) {
configuredResultsWriters.add(new HtmlReportResultsWriter());
configuredResultsWriters.add(new LogResultsWriter());
configuredResultsWriters.add(new FileSystemResultsWriter());
} else {
options.getWriters()
.forEach((key, value) -> {
switch (key) {
case "html":
configuredResultsWriters.add(
new HtmlReportResultsWriter(value)
);
break;
case "LOGGER":
configuredResultsWriters.add(
new LogResultsWriter()
);
break;
case "json":
configuredResultsWriters.add(
new FileSystemResultsWriter(value.getFilename())
);
break;
}
});
}
return configuredResultsWriters;
}
private static List<ConditionRule> getDefaultList() {
List<ConditionRule> registeredRules = new ArrayList<>();
registeredRules.add(new HTTPStatusRule());
registeredRules.add(new NotEmptyParameterRule());
registeredRules.add(new EnumAllValuesRule());
registeredRules.add(new NotEmptyBodyRule());
registeredRules.add(new OnlyDeclaredHTTPStatusesRule());
registeredRules.add(new EmptyHeaderRule());
registeredRules.add(new NotOnlyEnumValuesRule());
registeredRules.add(new PropertyEnumAllValuesRule());
registeredRules.add(new PropertyNotOnlyEnumValuesRule());
registeredRules.add(new PropertyNotEmptyRule());
return registeredRules;
}
private static List<StatisticsBuilder> getDefaultBuilderList() {
List<StatisticsBuilder> registeredBuilders = new ArrayList<>();
registeredBuilders.add(new CoverageStatisticsBuilder());
registeredBuilders.add(new GenerationStatisticsBuilder());
registeredBuilders.add(new ConditionStatisticsBuilder());
registeredBuilders.add(new ZeroCallStatisticsBuilder());
registeredBuilders.add(new TagStatisticsBuilder());
registeredBuilders.add(new ConfigurationStatisticsBuilder());
registeredBuilders.add(new FlatOperationBuilder());
registeredBuilders.add(new SwaggerInfoBuilder());
return registeredBuilders;
}
}
================================================
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/configuration/options/ConfigurationOptions.java
================================================
package com.github.viclovsky.swagger.coverage.configuration.options;
import io.swagger.v3.parser.core.models.ParseOptions;
import java.util.HashMap;
import java.util.Map;
public class ConfigurationOptions {
private Map<String, RuleConfigurationOptions> rules = new HashMap<>();
private Map<String, ResultsWriterOptions> writers = new HashMap<>();
public Map<String, RuleConfigurationOptions> getRules() {
return rules;
}
public ConfigurationOptions setRules(Map<String, RuleConfigurationOptions> rules) {
this.rules = rules;
return this;
}
public Map<String, ResultsWriterOptions> getWriters() {
return writers;
}
public ConfigurationOptions setWriters(Map<String, ResultsWriterOptions> writers) {
this.writers = writers;
return this;
}
@Override
public String toString() {
return "ConfigurationOptions{" +
"rules=" + rules.toString() +
", writers=" + writers.toString() +
'}';
}
}
================================================
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/configuration/options/MainOptions.java
================================================
package com.github.viclovsky.swagger.coverage.configuration.options;
public class MainOptions {
//todo: add more options
@Override
public String toString() {
return "MainOptions{" +
'}';
}
}
================================================
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/configuration/options/ResultsWriterOptions.java
================================================
package com.github.viclovsky.swagger.coverage.configuration.options;
public class ResultsWriterOptions {
private String filename;
private String locale = "en";
private String customTemplatePath;
private String numberFormat = "0.###";
public String getFilename() {
return filename;
}
public ResultsWriterOptions setFilename(String filename) {
this.filename = filename;
return this;
}
public String getLocale() {
return locale;
}
public ResultsWriterOptions setLocale(String locale) {
this.locale = locale;
return this;
}
@Override
public String toString() {
return "ResultsWriterOptions{" +
", filename='" + filename + '\'' +
", locale='" + locale + '\'' +
", customTemplatePath='" + customTemplatePath + '\'' +
", numberFormat='" + numberFormat + '\'' +
'}';
}
public ResultsWriterOptions setCustomTemplatePath(String customTemplatePath) {
this.customTemplatePath = customTemplatePath;
return this;
}
public String getCustomTemplatePath() {
return customTemplatePath;
}
public String getNumberFormat() {return numberFormat;}
public ResultsWriterOptions setNumberFormat(String numberFormat){
this.numberFormat = numberFormat;
return this;
}
}
================================================
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/configuration/options/RuleConfigurationOptions.java
================================================
package com.github.viclovsky.swagger.coverage.configuration.options;
import java.util.List;
public class RuleConfigurationOptions {
private boolean enable = true;
private List<String> filter;
private List<String> ignore;
public boolean isEnable() {
return enable;
}
public RuleConfigurationOptions setEnable(boolean enable) {
this.enable = enable;
return this;
}
public List<String> getFilter() {
return filter;
}
public RuleConfigurationOptions setFilter(List<String> filter) {
this.filter = filter;
return this;
}
public List<String> getIgnore() {
return ignore;
}
public RuleConfigurationOptions setIgnore(List<String> ignore) {
this.ignore = ignore;
return this;
}
@Override
public String toString() {
return "RuleConfigurationOptions{" +
"enable=" + enable +
", filter=" + filter +
'}';
}
}
================================================
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/generator/Generator.java
================================================
package com.github.viclovsky.swagger.coverage.core.generator;
import com.github.viclovsky.swagger.coverage.CoverageOutputReader;
import com.github.viclovsky.swagger.coverage.FileSystemOutputReader;
import com.github.viclovsky.swagger.coverage.configuration.Configuration;
import com.github.viclovsky.swagger.coverage.configuration.ConfigurationBuilder;
import com.github.viclovsky.swagger.coverage.core.results.Results;
import com.github.viclovsky.swagger.coverage.core.results.builder.core.StatisticsBuilder;
import io.swagger.parser.OpenAPIParser;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.parser.core.models.AuthorizationValue;
import io.swagger.v3.parser.core.models.ParseOptions;
import io.swagger.v3.parser.core.models.SwaggerParseResult;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.net.URI;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.List;
public class Generator {
private static final Logger LOGGER = LoggerFactory.getLogger(Generator.class);
private URI specPath;
private List<AuthorizationValue> specAuths;
private Path inputPath;
private Path configurationPath;
private final OpenAPIParser parser = new OpenAPIParser();
private List<StatisticsBuilder> statisticsBuilders = new ArrayList<>();
public void run() {
Configuration configuration = ConfigurationBuilder.build(configurationPath);
ParseOptions parseOptions = new ParseOptions();
parseOptions.setResolve(true);
SwaggerParseResult parsed = parser.readLocation(specPath.toString(), specAuths, parseOptions);
parsed.getMessages().forEach(LOGGER::info);
OpenAPI spec = parsed.getOpenAPI();
LOGGER.info("spec is {}", spec);
statisticsBuilders = configuration.getStatisticsBuilders(spec);
CoverageOutputReader reader = new FileSystemOutputReader(getInputPath());
reader.getOutputs().forEach(this::processFile);
Results result = new Results();
statisticsBuilders.stream().filter(StatisticsBuilder::isPreBuilder).forEach(
statisticsBuilder -> statisticsBuilder.build(result, configuration));
statisticsBuilders.stream().filter(StatisticsBuilder::isPostBuilder).forEach(
statisticsBuilder -> statisticsBuilder.build(result, configuration));
configuration.getConfiguredResultsWriters().forEach(writer -> writer.write(result));
}
public void processFile(Path path) {
SwaggerParseResult parsed = parser.readLocation(path.toUri().toString(), null, null);
parsed.getMessages().forEach(LOGGER::info);
OpenAPI spec = parsed.getOpenAPI();
statisticsBuilders.stream().filter(StatisticsBuilder::isPreBuilder).forEach(builder ->
builder.add(path.toString()).add(spec));
}
public URI getSpecPath() {
return specPath;
}
public Generator setSpecPath(URI specPath) {
this.specPath = specPath;
return this;
}
public List<AuthorizationValue> getSpecAuths() {
return specAuths;
}
public Generator setSpecAuths(List<AuthorizationValue> specAuths) {
this.specAuths = specAuths;
return this;
}
public Path getInputPath() {
return inputPath;
}
public Generator setInputPath(Path inputPath) {
this.inputPath = inputPath;
return this;
}
public Path getConfigurationPath() {
return configurationPath;
}
public Generator setConfigurationPath(Path configurationPath) {
this.configurationPath = configurationPath;
return this;
}
}
================================================
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/generator/OperationConditionGenerator.java
================================================
package com.github.viclovsky.swagger.coverage.core.generator;
import com.github.viclovsky.swagger.coverage.core.model.Condition;
import com.github.viclovsky.swagger.coverage.core.model.ConditionOperationCoverage;
import com.github.viclovsky.swagger.coverage.core.model.OperationKey;
import com.github.viclovsky.swagger.coverage.core.model.OperationsHolder;
import com.github.viclovsky.swagger.coverage.core.rule.core.ConditionRule;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.Operation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.TreeMap;
import java.util.stream.Collectors;
public class OperationConditionGenerator {
private static final Logger LOGGER = LoggerFactory.getLogger(OperationConditionGenerator.class);
public static Map<OperationKey, ConditionOperationCoverage> getOperationMap(OpenAPI swagger, List<ConditionRule> rules) {
OperationsHolder operations = SwaggerSpecificationProcessor.extractOperation(swagger);
Map<OperationKey, ConditionOperationCoverage> coverage = new TreeMap<>();
operations.getOperations().forEach((key, value) -> {
ConditionOperationCoverage oc = buildConditionOperationCoverage(value, rules);
LOGGER.debug(String.format("put operation %s", key));
coverage.put(key, oc);
});
return coverage;
}
private static ConditionOperationCoverage buildConditionOperationCoverage(Operation operation, List<ConditionRule> rules) {
ConditionOperationCoverage operationCoverage = new ConditionOperationCoverage();
operationCoverage.setOperation(operation);
operationCoverage.setConditions(generateConditionList(operation, rules));
return operationCoverage;
}
private static List<Condition> generateConditionList(Operation operation, List<ConditionRule> rules) {
List<Condition> conditions = rules
.stream()
.map(rule -> rule.createCondition(operation))
.filter(Objects::nonNull)
.flatMap(List::stream)
.collect(Collectors.toList());
LOGGER.debug(String.format("created list is %s", conditions));
return conditions;
}
}
================================================
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/generator/SwaggerSpecificationProcessor.java
================================================
package com.github.viclovsky.swagger.coverage.core.generator;
import com.github.viclovsky.swagger.coverage.core.model.OperationKey;
import com.github.viclovsky.swagger.coverage.core.model.OperationsHolder;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.media.ArraySchema;
import io.swagger.v3.oas.models.media.Schema;
import io.swagger.v3.oas.models.parameters.Parameter;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
public class SwaggerSpecificationProcessor {
private static final String X_EXAMPLE = "x-example";
public static OperationsHolder extractOperation(OpenAPI swagger) {
OperationsHolder operations = new OperationsHolder();
swagger.getPaths().keySet().forEach(path
-> swagger.getPaths().get(path).readOperationsMap().forEach((httpMethod, operation)
-> operations.addOperation(new OperationKey().setPath(path).setHttpMethod(httpMethod), operation)
));
return operations;
}
public static String extractValue(Parameter p) {
if (p.getExtensions() != null && p.getExtensions().containsKey(X_EXAMPLE)) {
return (String) p.getExtensions().get(X_EXAMPLE);
}
if(p.getExample() != null) {
return p.getExample().toString();
}
return p.getName();
}
public static String extractValue(Schema schema) {
if (schema.getExtensions() !=null && schema.getExtensions().containsKey(X_EXAMPLE)) {
return (String) schema.getExtensions().get(X_EXAMPLE);
}
if(schema.getExample() != null) {
return schema.getExample().toString();
}
return schema.getName();
}
public static List<String> extractEnum(Parameter p) {
return extractEnum(p.getSchema());
}
public static List<String> extractEnum(Schema schema) {
List enums = null;
if (schema != null) {
enums = schema.getEnum();
if (enums == null &&
schema instanceof ArraySchema &&
((ArraySchema) schema).getItems() != null) {
enums = ((ArraySchema) schema).getItems().getEnum();
}
}
if (enums != null) {
return ((Stream<Object>) enums.stream())
.map(o -> o.toString())
.collect(Collectors.toList());
} else {
return null;
}
}
}
================================================
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/model/Condition.java
================================================
package com.github.viclovsky.swagger.coverage.core.model;
import io.swagger.v3.oas.models.Operation;
public abstract class Condition {
private String name;
private String description;
boolean covered = false;
public Condition(String name, String description) {
this.name = name;
this.description = description;
}
public abstract void postCheck();
public abstract boolean isHasPostCheck();
public abstract boolean isNeedCheck();
public abstract boolean check(Operation operation);
public abstract String getReason();
public abstract String getType();
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public boolean isCovered() {
return covered;
}
public void setCovered(boolean covered) {
this.covered = covered;
}
@Override
public String toString() {
return "Condition{" +
"name='" + name + '\'' +
", description='" + description + '\'' +
", covered=" + covered +
'}';
}
}
================================================
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/model/ConditionOperationCoverage.java
================================================
package com.github.viclovsky.swagger.coverage.core.model;
import io.swagger.v3.oas.models.Operation;
import java.util.List;
public class ConditionOperationCoverage {
private long processCount = 0;
private Operation operation;
private List<Condition> conditions;
public Operation getOperation() {
return operation;
}
public ConditionOperationCoverage setOperation(Operation operation) {
this.operation = operation;
return this;
}
public List<Condition> getConditions() {
return conditions;
}
public ConditionOperationCoverage setConditions(List<Condition> conditions) {
this.conditions = conditions;
return this;
}
public long getProcessCount() {
return processCount;
}
public ConditionOperationCoverage setProcessCount(long processCount) {
this.processCount = processCount;
return this;
}
public ConditionOperationCoverage increaseProcessCount() {
this.processCount++;
return this;
}
}
================================================
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/model/OperationKey.java
================================================
package com.github.viclovsky.swagger.coverage.core.model;
import io.swagger.v3.oas.models.PathItem;
public class OperationKey implements Comparable {
private String path;
private PathItem.HttpMethod httpMethod;
@Override
public String toString() {
return path + " " + httpMethod;
}
public String getPath() {
return path;
}
public OperationKey setPath(String path) {
this.path = path;
return this;
}
public PathItem.HttpMethod getHttpMethod() {
return httpMethod;
}
public OperationKey setHttpMethod(PathItem.HttpMethod httpMethod) {
this.httpMethod = httpMethod;
return this;
}
@Override
public int compareTo(Object o) {
return this.toString().compareTo(o.toString());
}
}
================================================
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/model/OperationsHolder.java
================================================
package com.github.viclovsky.swagger.coverage.core.model;
import io.swagger.v3.oas.models.Operation;
import java.util.Map;
import java.util.TreeMap;
public class OperationsHolder {
private Map<OperationKey, Operation> operations = new TreeMap<>();
public Map<OperationKey, Operation> getOperations() {
return operations;
}
public OperationsHolder setOperations(Map<OperationKey, Operation> operations) {
this.operations = operations;
return this;
}
public OperationsHolder addOperation(OperationKey operationKey, Operation operation) {
this.operations.put(operationKey, operation);
return this;
}
}
================================================
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/model/SinglePredicateCondition.java
================================================
package com.github.viclovsky.swagger.coverage.core.model;
import com.github.viclovsky.swagger.coverage.core.predicate.ConditionPredicate;
import io.swagger.v3.oas.models.Operation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class SinglePredicateCondition extends Condition {
private static final Logger LOGGER = LoggerFactory.getLogger(SinglePredicateCondition.class);
protected ConditionPredicate predicate;
public SinglePredicateCondition(String name, String description) {
super(name, description);
}
public SinglePredicateCondition(String name, String description, ConditionPredicate predicate) {
super(name, description);
this.predicate = predicate;
}
@Override
public void postCheck() {
this.covered = predicate.postCheck();
}
@Override
public boolean isHasPostCheck() {
return predicate.hasPostCheck();
}
@Override
public boolean isNeedCheck() {
return !this.covered || predicate.hasPostCheck();
}
@Override
public boolean check(Operation operation) {
this.covered = predicate.check(operation);
return this.covered;
}
@Override
public String getReason() {
if (predicate.getReason() != null) {
return predicate.getReason();
}
return "";
}
@Override
public String getType() {
return predicate.getClass().getSimpleName();
}
}
================================================
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/predicate/ConditionPredicate.java
================================================
package com.github.viclovsky.swagger.coverage.core.predicate;
import io.swagger.v3.oas.models.Operation;
public abstract class ConditionPredicate {
public abstract boolean check(Operation operation);
public abstract boolean postCheck();
public abstract boolean hasPostCheck();
public abstract String getReason();
}
================================================
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/predicate/DefaultBodyConditionPredicate.java
================================================
package com.github.viclovsky.swagger.coverage.core.predicate;
import io.swagger.v3.oas.models.Operation;
public class DefaultBodyConditionPredicate extends ConditionPredicate {
@Override
public boolean check(Operation operation) {
if(operation.getRequestBody() != null && operation.getRequestBody().getContent() != null) {
return operation.getRequestBody().getContent().values().size() > 0;
} else {
return false;
}
}
@Override
public boolean postCheck() {
return false;
}
@Override
public boolean hasPostCheck() {
return false;
}
@Override
public String getReason() {
return null;
}
}
================================================
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/predicate/DefaultParameterConditionPredicate.java
================================================
package com.github.viclovsky.swagger.coverage.core.predicate;
import io.swagger.v3.oas.models.parameters.Parameter;
import io.swagger.v3.oas.models.responses.ApiResponse;
import java.util.List;
import java.util.Map;
import java.util.Optional;
public class DefaultParameterConditionPredicate extends ParameterConditionPredicate {
private boolean isEmpty;
private String name;
private String in;
public DefaultParameterConditionPredicate(boolean isEmpty, String name, String in) {
this.isEmpty = isEmpty;
this.name = name;
this.in = in;
}
@Override
public boolean check(List<Parameter> params, Map<String, ApiResponse> responses) {
if (params != null) {
Optional<Parameter> p = params.stream().filter(ParameterUtils.equalsParam(name, in)).findFirst();
return (isEmpty() ^ p.isPresent());
}
return isEmpty();
}
@Override
public boolean postCheck() {
return false;
}
@Override
public boolean hasPostCheck() {
return false;
}
@Override
public String getReason() {
return null;
}
public boolean isEmpty() {
return isEmpty;
}
public void setEmpty(boolean empty) {
isEmpty = empty;
}
public String getName() {
return name;
}
public void setParamName(String paramName) {
this.name = name;
}
@Override
public String toString() {
return "ConditionPredicate{" +
"isEmpty=" + isEmpty +
", paramName='" + name + '\'' +
'}';
}
}
================================================
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/predicate/DefaultParameterValueConditionPredicate.java
================================================
package com.github.viclovsky.swagger.coverage.core.predicate;
import com.github.viclovsky.swagger.coverage.core.generator.SwaggerSpecificationProcessor;
import io.swagger.v3.oas.models.parameters.Parameter;
import io.swagger.v3.oas.models.responses.ApiResponse;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Optional;
public class DefaultParameterValueConditionPredicate extends ParameterConditionPredicate {
private String name;
private String in;
private String reason;
private String expectedValue;
private List<String> currentValue = new ArrayList<>();
public DefaultParameterValueConditionPredicate(String name, String in, String value) {
this.name = name;
this.in = in;
this.expectedValue = value;
}
@Override
public boolean check(List<Parameter> params, Map<String, ApiResponse> responses) {
if (params != null) {
Optional<Parameter> p = params.stream().filter(ParameterUtils.equalsParam(name, in)).findFirst();
if (p.isPresent()) {
String val = SwaggerSpecificationProcessor.extractValue(p.get());
currentValue.add(val);
}
}
return currentValue.contains(expectedValue);
}
@Override
public boolean postCheck() {
return false;
}
@Override
public boolean hasPostCheck() {
return false;
}
@Override
public String getReason() {
return reason;
}
public String getName() {
return name;
}
public DefaultParameterValueConditionPredicate setName(String name) {
this.name = name;
return this;
}
public String getValue() {
return expectedValue;
}
public DefaultParameterValueConditionPredicate setValue(String value) {
this.expectedValue = value;
return this;
}
}
================================================
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/predicate/DefaultPropertyConditionPredicate.java
================================================
package com.github.viclovsky.swagger.coverage.core.predicate;
import io.swagger.v3.oas.models.media.Schema;
import java.util.Optional;
public class DefaultPropertyConditionPredicate extends PropertyConditionPredicate {
protected boolean isEmpty;
public DefaultPropertyConditionPredicate(String mediaTypeName, String propertyName, boolean isEmpty) {
super(mediaTypeName, propertyName);
this.isEmpty = isEmpty;
}
@Override
public boolean postCheck() {
return false;
}
@Override
public boolean hasPostCheck() {
return false;
}
@Override
public String getReason() {
return null;
}
public boolean isEmpty() {
return isEmpty;
}
@Override
protected boolean check(Optional<Schema> schema) {
return (isEmpty() ^ schema.isPresent());
}
@Override
public DefaultPropertyConditionPredicate setPropertyName(String propertyName) {
return (DefaultPropertyConditionPredicate) super.setPropertyName(propertyName);
}
@Override
public DefaultPropertyConditionPredicate setMediaTypeName(String mediaTypeName) {
return (DefaultPropertyConditionPredicate) super.setMediaTypeName(mediaTypeName);
}
DefaultPropertyConditionPredicate setEmpty(boolean isEmpty) {
this.isEmpty = isEmpty;
return this;
}
}
================================================
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/predicate/DefaultStatusConditionPredicate.java
================================================
package com.github.viclovsky.swagger.coverage.core.predicate;
import io.swagger.v3.oas.models.parameters.Parameter;
import io.swagger.v3.oas.models.responses.ApiResponse;
import java.util.List;
import java.util.Map;
public class DefaultStatusConditionPredicate extends ParameterConditionPredicate {
private String statusCode;
public DefaultStatusConditionPredicate(String statusCode) {
this.statusCode = statusCode;
}
@Override
public boolean check(List<Parameter> params, Map<String, ApiResponse> responses) {
return responses.containsKey(getStatusCode());
}
@Override
public boolean postCheck() {
return false;
}
@Override
public boolean hasPostCheck() {
return false;
}
@Override
public String getReason() {
return null;
}
public String getStatusCode() {
return statusCode;
}
public void setStatusCode(String statusCode) {
this.statusCode = statusCode;
}
@Override
public String toString() {
return "StatusConditionPredicate{" +
"statusCode=" + statusCode +
'}';
}
}
================================================
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/predicate/FullStatusConditionPredicate.java
================================================
package com.github.viclovsky.swagger.coverage.core.predicate;
import io.swagger.v3.oas.models.parameters.Parameter;
import io.swagger.v3.oas.models.responses.ApiResponse;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
public class FullStatusConditionPredicate extends ParameterConditionPredicate {
private Set<String> expectedStatuses;
private Set<String> currentStatuses = new HashSet<>();
private String reason;
public FullStatusConditionPredicate(Set<String> expectedStatuses) {
this.expectedStatuses = expectedStatuses;
}
@Override
public boolean check(List<Parameter> params, Map<String, ApiResponse> responses) {
responses.forEach((key, value) -> currentStatuses.add(key));
return true;
}
@Override
public boolean postCheck() {
if (currentStatuses.isEmpty() && expectedStatuses != null) {
reason = "No call - no statuses...";
return false;
}
boolean covered = expectedStatuses.containsAll(currentStatuses);
if (!covered) {
currentStatuses.removeAll(expectedStatuses);
reason = "Undeclared status: " + String.join(",", currentStatuses);
}
return covered;
}
@Override
public boolean hasPostCheck() {
return true;
}
@Override
public String getReason() {
return reason;
}
public Set<String> getExpectedStatuses() {
return expectedStatuses;
}
public FullStatusConditionPredicate setExpectedStatuses(Set<String> expectedStatuses) {
this.expectedStatuses = expectedStatuses;
return this;
}
public Set<String> getCurrentStatuses() {
return currentStatuses;
}
public FullStatusConditionPredicate setCurrentStatuses(Set<String> currentStatuses) {
this.currentStatuses = currentStatuses;
return this;
}
}
================================================
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/predicate/NotOnlyParameterListValueConditionPredicate.java
================================================
package com.github.viclovsky.swagger.coverage.core.predicate;
import com.github.viclovsky.swagger.coverage.core.generator.SwaggerSpecificationProcessor;
import io.swagger.v3.oas.models.parameters.Parameter;
import io.swagger.v3.oas.models.responses.ApiResponse;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
public class NotOnlyParameterListValueConditionPredicate extends ParameterConditionPredicate {
private String name;
private String in;
private String reason;
private Set<String> expectedValue = new HashSet<>();
private Set<String> currentValue = new HashSet<>();
public NotOnlyParameterListValueConditionPredicate(String name, String in, List<String> value) {
this.name = name;
this.in = in;
this.expectedValue.addAll(value);
reason = "Checked values: -";
}
@Override
public boolean check(List<Parameter> params, Map<String, ApiResponse> responses) {
if (params != null) {
Optional<Parameter> p = params.stream().filter(ParameterUtils.equalsParam(name, in)).findFirst();
if (p.isPresent()) {
String val = SwaggerSpecificationProcessor.extractValue(p.get());
currentValue.add(val);
}
}
return true;
}
@Override
public boolean postCheck() {
reason = "Checked values: " + currentValue.toString();
currentValue.removeAll(expectedValue);
return !currentValue.isEmpty();
}
@Override
public boolean hasPostCheck() {
return true;
}
@Override
public String getReason() {
return reason;
}
public String getName() {
return name;
}
public NotOnlyParameterListValueConditionPredicate setName(String name) {
this.name = name;
return this;
}
public Set<String> getValue() {
return expectedValue;
}
public NotOnlyParameterListValueConditionPredicate setValue(Set<String> value) {
this.expectedValue = value;
return this;
}
}
================================================
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/predicate/ParameterConditionPredicate.java
================================================
package com.github.viclovsky.swagger.coverage.core.predicate;
import io.swagger.v3.oas.models.Operation;
import io.swagger.v3.oas.models.parameters.Parameter;
import io.swagger.v3.oas.models.responses.ApiResponse;
import java.util.List;
import java.util.Map;
public abstract class ParameterConditionPredicate extends ConditionPredicate {
@Override
public boolean check(Operation operation) {
return check(operation.getParameters(), operation.getResponses());
}
public abstract boolean check(List<Parameter> params, Map<String, ApiResponse> responses);
}
================================================
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/predicate/ParameterUtils.java
================================================
package com.github.viclovsky.swagger.coverage.core.predicate;
import io.swagger.v3.oas.models.parameters.Parameter;
import java.util.function.Predicate;
class ParameterUtils {
private ParameterUtils() {
}
static Predicate<Parameter> equalsParam(String name, String in) {
return p -> (p.getName().equals(name) && p.getIn().equals(in));
}
}
================================================
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/predicate/ParameterValueConditionPredicate.java
================================================
package com.github.viclovsky.swagger.coverage.core.predicate;
import com.github.viclovsky.swagger.coverage.core.generator.SwaggerSpecificationProcessor;
import io.swagger.v3.oas.models.parameters.Parameter;
import io.swagger.v3.oas.models.responses.ApiResponse;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Optional;
public class ParameterValueConditionPredicate extends ParameterConditionPredicate {
private String name;
private String in;
private String reason;
private List<String> expectedValue = new ArrayList<>();
private List<String> currentValue = new ArrayList<>();
public ParameterValueConditionPredicate(String name, String in, List<String> value) {
this.name = name;
this.expectedValue.addAll(value);
this.in = in;
}
@Override
public boolean check(List<Parameter> params, Map<String, ApiResponse> responses) {
if (params != null) {
Optional<Parameter> p = params.stream().filter(ParameterUtils.equalsParam(name, in)).findFirst();
if (p.isPresent()) {
String val = SwaggerSpecificationProcessor.extractValue(p.get());
currentValue.add(val);
}
}
return true;
}
@Override
public boolean postCheck() {
boolean covered = currentValue.containsAll(expectedValue);
if (!covered) {
expectedValue.removeAll(currentValue);
reason = "Missed values " + expectedValue.toString();
}
return covered;
}
@Override
public boolean hasPostCheck() {
return true;
}
@Override
public String getReason() {
return reason;
}
public String getName() {
return name;
}
public ParameterValueConditionPredicate setName(String name) {
this.name = name;
return this;
}
public List<String> getValue() {
return expectedValue;
}
public ParameterValueConditionPredicate setValue(List<String> value) {
this.expectedValue = value;
return this;
}
}
================================================
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/predicate/PropertyConditionPredicate.java
================================================
package com.github.viclovsky.swagger.coverage.core.predicate;
import io.swagger.v3.oas.models.Operation;
import io.swagger.v3.oas.models.media.Schema;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.stream.Stream;
public abstract class PropertyConditionPredicate extends ConditionPredicate {
protected String mediaTypeName;
protected String propertyName;
public PropertyConditionPredicate(String mediaTypeName, String propertyName) {
this.mediaTypeName = mediaTypeName;
this.propertyName = propertyName;
}
@Override
public boolean check(Operation operation) {
if (operation.getRequestBody() == null ||
operation.getRequestBody().getContent() == null ||
operation.getRequestBody().getContent().isEmpty()) {
return false;
}
Optional<Schema> schema = operation.getRequestBody().getContent().entrySet()
.stream()
.filter(o -> mediaTypeName.equals(o.getKey()))
.map(o -> o.getValue().getSchema())
.filter(Objects::nonNull)
.flatMap(o -> (Stream<Map.Entry<String, Schema>>) o.getProperties().entrySet().stream())
.filter(o -> propertyName.equals(o.getKey()))
.map(o -> o.getValue())
.findFirst();
return check(schema);
}
public String getPropertyName() {
return propertyName;
}
public String getMediaTypeName() {
return mediaTypeName;
}
public PropertyConditionPredicate setPropertyName(String propertyName) {
this.propertyName = propertyName;
return this;
}
public PropertyConditionPredicate setMediaTypeName(String mediaTypeName) {
this.mediaTypeName = mediaTypeName;
return this;
}
protected abstract boolean check(Optional<Schema> schema);
}
================================================
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/predicate/PropertyValueConditionPredicate.java
================================================
package com.github.viclovsky.swagger.coverage.core.predicate;
import com.github.viclovsky.swagger.coverage.core.generator.SwaggerSpecificationProcessor;
import io.swagger.v3.oas.models.media.Schema;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
public class PropertyValueConditionPredicate extends PropertyConditionPredicate {
private List<String> expectedValue = new ArrayList<>();
private List<String> currentValue = new ArrayList<>();
protected String reason;
public PropertyValueConditionPredicate(String mediaTypeName, String propertyName, List<String> value) {
super(mediaTypeName, propertyName);
expectedValue.addAll(value);
}
@Override
public boolean postCheck() {
reason = "Checked values: " + currentValue.toString();
currentValue.removeAll(expectedValue);
return !currentValue.isEmpty();
}
@Override
public boolean hasPostCheck() {
return true;
}
@Override
public String getReason() {
return reason;
}
@Override
protected boolean check(Optional<Schema> schema) {
if (schema.isPresent()) {
currentValue.add(SwaggerSpecificationProcessor.extractValue(schema.get()));
}
return true;
}
public List<String> getValue() {
return expectedValue;
}
@Override
public PropertyValueConditionPredicate setPropertyName(String propertyName) {
return (PropertyValueConditionPredicate) super.setPropertyName(propertyName);
}
@Override
public PropertyValueConditionPredicate setMediaTypeName(String mediaTypeName) {
return (PropertyValueConditionPredicate) super.setMediaTypeName(mediaTypeName);
}
public PropertyValueConditionPredicate setValue(List<String> value) {
this.expectedValue = value;
return this;
}
}
================================================
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/predicate/PropertyValueNotOnlyConditionPredicate.java
================================================
package com.github.viclovsky.swagger.coverage.core.predicate;
import com.github.viclovsky.swagger.coverage.core.generator.SwaggerSpecificationProcessor;
import io.swagger.v3.oas.models.media.Schema;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
public class PropertyValueNotOnlyConditionPredicate extends PropertyConditionPredicate {
private List<String> expectedValue = new ArrayList<>();
private List<String> currentValue = new ArrayList<>();
protected String reason;
public PropertyValueNotOnlyConditionPredicate(String mediaTypeName, String propertyName, List<String> value) {
super(mediaTypeName, propertyName);
expectedValue.addAll(value);
}
@Override
public boolean postCheck() {
boolean covered = currentValue.containsAll(expectedValue);
if (!covered) {
expectedValue.removeAll(currentValue);
reason = "Missed values " + expectedValue.toString();
}
return covered;
}
@Override
public boolean hasPostCheck() {
return true;
}
@Override
public String getReason() {
return reason;
}
@Override
protected boolean check(Optional<Schema> schema) {
if (schema.isPresent()) {
currentValue.add(SwaggerSpecificationProcessor.extractValue(schema.get()));
}
return true;
}
public List<String> getValue() {
return expectedValue;
}
@Override
public PropertyValueNotOnlyConditionPredicate setPropertyName(String propertyName) {
return (PropertyValueNotOnlyConditionPredicate) super.setPropertyName(propertyName);
}
@Override
public PropertyValueNotOnlyConditionPredicate setMediaTypeName(String mediaTypeName) {
return (PropertyValueNotOnlyConditionPredicate) super.setMediaTypeName(mediaTypeName);
}
public PropertyValueNotOnlyConditionPredicate setValue(List<String> value) {
this.expectedValue = value;
return this;
}
}
================================================
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/results/Results.java
================================================
package com.github.viclovsky.swagger.coverage.core.results;
import com.github.viclovsky.swagger.coverage.core.model.OperationKey;
import com.github.viclovsky.swagger.coverage.core.results.data.ConditionCounter;
import com.github.viclovsky.swagger.coverage.core.results.data.ConditionStatistics;
import com.github.viclovsky.swagger.coverage.core.results.data.CoverageCounter;
import com.github.viclovsky.swagger.coverage.core.results.data.CoverageOperationMap;
import com.github.viclovsky.swagger.coverage.core.results.data.GenerationStatistics;
import com.github.viclovsky.swagger.coverage.core.results.data.OperationResult;
import com.github.viclovsky.swagger.coverage.core.results.data.TagCoverage;
import io.swagger.v3.oas.models.Operation;
import io.swagger.v3.oas.models.info.Info;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
public class Results {
private Map<OperationKey, OperationResult> operations = new TreeMap<>();
private Map<String, OperationResult> flatOperations = new TreeMap<>();
private Map<OperationKey, Operation> missed = new TreeMap<>();
private Map<OperationKey, Operation> deprecated = new TreeMap<>();
private Map<String, ConditionStatistics> conditionStatisticsMap = new HashMap<>();
private Set<OperationKey> zeroCall = new HashSet<>();
private GenerationStatistics generationStatistics;
private CoverageOperationMap coverageOperationMap = new CoverageOperationMap();
private ConditionCounter conditionCounter = new ConditionCounter();
/**
* TAG STATISTICS
**/
private Map<String, TagCoverage> tagCoverageMap = new TreeMap<>();
private CoverageCounter tagCounter;
/**
*
**/
private String prettyConfiguration;
private Info info;
public Results() {
}
public Map<OperationKey, OperationResult> getOperations() {
return operations;
}
public Results setOperations(Map<OperationKey, OperationResult> operations) {
this.operations = operations;
return this;
}
public Set<OperationKey> getZeroCall() {
return zeroCall;
}
public Results setZeroCall(Set<OperationKey> zeroCall) {
this.zeroCall = zeroCall;
return this;
}
public Map<OperationKey, Operation> getMissed() {
return missed;
}
public Results setMissed(Map<OperationKey, Operation> missed) {
this.missed = missed;
return this;
}
public Results setDeprecated(Map<OperationKey, Operation> deprecated) {
this.deprecated = deprecated;
return this;
}
public Map<OperationKey, Operation> getDeprecated() {
return deprecated;
}
public GenerationStatistics getGenerationStatistics() {
return generationStatistics;
}
public Results setGenerationStatistics(GenerationStatistics generationStatistics) {
this.generationStatistics = generationStatistics;
return this;
}
public ConditionCounter getConditionCounter() {
return conditionCounter;
}
public Results setConditionCounter(ConditionCounter conditionCounter) {
this.conditionCounter = conditionCounter;
return this;
}
public Map<String, ConditionStatistics> getConditionStatisticsMap() {
return conditionStatisticsMap;
}
public Results setConditionStatisticsMap(Map<String, ConditionStatistics> conditionStatisticsMap) {
this.conditionStatisticsMap = conditionStatisticsMap;
return this;
}
public CoverageOperationMap getCoverageOperationMap() {
return coverageOperationMap;
}
public Results setCoverageOperationMap(CoverageOperationMap coverageOperationMap) {
this.coverageOperationMap = coverageOperationMap;
return this;
}
public Map<String, TagCoverage> getTagCoverageMap() {
return tagCoverageMap;
}
public Results setTagCoverageMap(Map<String, TagCoverage> tagCoverageMap) {
this.tagCoverageMap = tagCoverageMap;
return this;
}
public CoverageCounter getTagCounter() {
return tagCounter;
}
public Results setTagCounter(CoverageCounter tagCounter) {
this.tagCounter = tagCounter;
return this;
}
public String getPrettyConfiguration() {
return prettyConfiguration;
}
public Results setPrettyConfiguration(String prettyConfiguration) {
this.prettyConfiguration = prettyConfiguration;
return this;
}
public Map<String, OperationResult> getFlatOperations() {
return flatOperations;
}
public Results setFlatOperations(Map<String, OperationResult> flatOperations) {
this.flatOperations = flatOperations;
return this;
}
public Info getInfo() {
return info;
}
public Results setInfo(Info info) {
this.info = info;
return this;
}
}
================================================
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/results/builder/core/StatisticsBuilder.java
================================================
package com.github.viclovsky.swagger.coverage.core.results.builder.core;
import com.github.viclovsky.swagger.coverage.configuration.Configuration;
import com.github.viclovsky.swagger.coverage.configuration.options.ConfigurationOptions;
import com.github.viclovsky.swagger.coverage.core.results.Results;
import com.github.viclovsky.swagger.coverage.core.rule.core.ConditionRule;
import io.swagger.v3.oas.models.OpenAPI;
import java.util.List;
public abstract class StatisticsBuilder {
protected ConfigurationOptions options;
public StatisticsBuilder add(String path) {
return this;
}
public StatisticsBuilder add(OpenAPI swagger) {
return this;
}
public StatisticsBuilder configure(ConfigurationOptions options) {
this.options = options;
return this;
}
public abstract StatisticsBuilder configure(OpenAPI swagger, List<ConditionRule> rules);
public abstract void build(Results results, Configuration configuration);
public abstract boolean isPreBuilder();
public abstract boolean isPostBuilder();
}
================================================
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/results/builder/core/StatisticsOperationPostBuilder.java
================================================
package com.github.viclovsky.swagger.coverage.core.results.builder.core;
import com.github.viclovsky.swagger.coverage.configuration.Configuration;
import com.github.viclovsky.swagger.coverage.core.model.OperationKey;
import com.github.viclovsky.swagger.coverage.core.results.Results;
import com.github.viclovsky.swagger.coverage.core.results.data.OperationResult;
import com.github.viclovsky.swagger.coverage.core.rule.core.ConditionRule;
import io.swagger.v3.oas.models.OpenAPI;
import java.util.List;
public abstract class StatisticsOperationPostBuilder extends StatisticsPostBuilder {
@Override
public StatisticsBuilder configure(OpenAPI swagger, List<ConditionRule> rules) {
return this;
}
@Override
public void build(Results results, Configuration configuration) {
results.getOperations().forEach(this::buildOperation);
buildResult(results);
}
public abstract void buildOperation(OperationKey operation, OperationResult operationResult);
public abstract void buildResult(Results results);
}
================================================
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/results/builder/core/StatisticsPostBuilder.java
================================================
package com.github.viclovsky.swagger.coverage.core.results.builder.core;
public abstract class StatisticsPostBuilder extends StatisticsBuilder {
public StatisticsPostBuilder() {
super();
}
@Override
public boolean isPreBuilder() {
return false;
}
@Override
public boolean isPostBuilder() {
return true;
}
}
================================================
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/results/builder/core/StatisticsPreBuilder.java
================================================
package com.github.viclovsky.swagger.coverage.core.results.builder.core;
public abstract class StatisticsPreBuilder extends StatisticsBuilder {
@Override
public boolean isPreBuilder() {
return true;
}
@Override
public boolean isPostBuilder() {
return false;
}
}
================================================
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/results/builder/postbuilder/ConditionStatisticsBuilder.java
================================================
package com.github.viclovsky.swagger.coverage.core.results.builder.postbuilder;
import com.github.viclovsky.swagger.coverage.core.model.OperationKey;
import com.github.viclovsky.swagger.coverage.core.results.Results;
import com.github.viclovsky.swagger.coverage.core.results.builder.core.StatisticsOperationPostBuilder;
import com.github.viclovsky.swagger.coverage.core.results.data.ConditionCounter;
import com.github.viclovsky.swagger.coverage.core.results.data.CoverageOperationMap;
import com.github.viclovsky.swagger.coverage.core.results.data.CoverageState;
import com.github.viclovsky.swagger.coverage.core.results.data.OperationResult;
public class ConditionStatisticsBuilder extends StatisticsOperationPostBuilder {
private CoverageOperationMap coverageOperationMap = new CoverageOperationMap();
private ConditionCounter conditionCounter = new ConditionCounter();
@Override
public void buildResult(Results results) {
results.setCoverageOperationMap(coverageOperationMap)
.setConditionCounter(conditionCounter);
}
@Override
public void buildOperation(OperationKey operation, OperationResult operationResult) {
conditionCounter.updateAll(operationResult.getAllConditionCount());
conditionCounter.updateCovered(operationResult.getCoveredConditionCount());
switch (operationResult.getState()) {
case PARTY:
coverageOperationMap.addParty(operation);
break;
case EMPTY:
coverageOperationMap.addEmpty(operation);
break;
case FULL:
coverageOperationMap.addFull(operation);
break;
}
if (operationResult.getDeprecated()) {
coverageOperationMap.addDeprecated(operation);
conditionCounter.incrementDeprecated();
if (operationResult.getState() == CoverageState.EMPTY) {
conditionCounter.incrementDeprecatedAndEmpty();
}
}
}
}
================================================
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/results/builder/postbuilder/ConfigurationStatisticsBuilder.java
================================================
package com.github.viclovsky.swagger.coverage.core.results.builder.postbuilder;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.github.viclovsky.swagger.coverage.configuration.Configuration;
import com.github.viclovsky.swagger.coverage.core.results.Results;
import com.github.viclovsky.swagger.coverage.core.results.builder.core.StatisticsBuilder;
import com.github.viclovsky.swagger.coverage.core.results.builder.core.StatisticsPostBuilder;
import com.github.viclovsky.swagger.coverage.core.rule.core.ConditionRule;
import io.swagger.v3.oas.models.OpenAPI;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.List;
public class ConfigurationStatisticsBuilder extends StatisticsPostBuilder {
private static final Logger LOGGER = LoggerFactory.getLogger(ConfigurationStatisticsBuilder.class);
@Override
public StatisticsBuilder configure(OpenAPI swagger, List<ConditionRule> rules) {
return this;
}
@Override
public void build(Results results, Configuration configuration) {
ObjectMapper mapper = new ObjectMapper();
String prettyConfiguration = "";
try {
prettyConfiguration = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(options);
} catch (JsonProcessingException e) {
LOGGER.error("can't write options", e);
}
results.setPrettyConfiguration(prettyConfiguration);
}
}
================================================
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/results/builder/postbuilder/FlatOperationBuilder.java
================================================
package com.github.viclovsky.swagger.coverage.core.results.builder.postbuilder;
import com.github.viclovsky.swagger.coverage.core.model.OperationKey;
import com.github.viclovsky.swagger.coverage.core.results.Results;
import com.github.viclovsky.swagger.coverage.core.results.builder.core.StatisticsOperationPostBuilder;
import com.github.viclovsky.swagger.coverage.core.results.data.OperationResult;
import java.util.Map;
import java.util.TreeMap;
public class FlatOperationBuilder extends StatisticsOperationPostBuilder {
@Override
public void buildOperation(OperationKey operation, OperationResult operationResult) {
}
@Override
public void buildResult(Results results) {
Map<String, OperationResult> flatOperations = new TreeMap<>();
results.getOperations().forEach((operationKey, operationResult) -> flatOperations.put(
operationKey.toString(), operationResult)
);
results.setFlatOperations(flatOperations);
}
}
================================================
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/results/builder/postbuilder/SwaggerInfoBuilder.java
================================================
package com.github.viclovsky.swagger.coverage.core.results.builder.postbuilder;
import com.github.viclovsky.swagger.coverage.core.model.OperationKey;
import com.github.viclovsky.swagger.coverage.core.results.Results;
import com.github.viclovsky.swagger.coverage.core.results.builder.core.StatisticsOperationPostBuilder;
import com.github.viclovsky.swagger.coverage.core.results.data.OperationResult;
import com.github.viclovsky.swagger.coverage.core.rule.core.ConditionRule;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Info;
import java.util.List;
public class SwaggerInfoBuilder extends StatisticsOperationPostBuilder {
private Info info;
@Override
public SwaggerInfoBuilder configure(OpenAPI swagger, List<ConditionRule> rules) {
info = swagger.getInfo();
return this;
}
@Override
public void buildOperation(OperationKey operation, OperationResult operationResult) {
}
@Override
public void buildResult(Results results) {
results.setInfo(info);
}
}
================================================
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/results/builder/postbuilder/TagStatisticsBuilder.java
================================================
package com.github.viclovsky.swagger.coverage.core.results.builder.postbuilder;
import com.github.viclovsky.swagger.coverage.core.generator.SwaggerSpecificationProcessor;
import com.github.viclovsky.swagger.coverage.core.model.OperationKey;
import com.github.viclovsky.swagger.coverage.core.model.OperationsHolder;
import com.github.viclovsky.swagger.coverage.core.results.Results;
import com.github.viclovsky.swagger.coverage.core.results.builder.core.StatisticsOperationPostBuilder;
import com.github.viclovsky.swagger.coverage.core.results.data.CoverageCounter;
import com.github.viclovsky.swagger.coverage.core.results.data.OperationResult;
import com.github.viclovsky.swagger.coverage.core.results.data.TagCoverage;
import com.github.viclovsky.swagger.coverage.core.rule.core.ConditionRule;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.tags.Tag;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.List;
import java.util.Map;
import static java.util.Collections.emptyList;
import static java.util.Optional.ofNullable;
import static java.util.stream.Collectors.toMap;
public class TagStatisticsBuilder extends StatisticsOperationPostBuilder {
private static final Logger LOGGER = LoggerFactory.getLogger(TagStatisticsBuilder.class);
private Map<OperationKey, List<String>> operationToTag;
private Map<String, TagCoverage> tagCoverageMap;
private CoverageCounter tagCounter = new CoverageCounter();
@Override
public TagStatisticsBuilder configure(OpenAPI swagger, List<ConditionRule> rules) {
OperationsHolder operations = SwaggerSpecificationProcessor.extractOperation(swagger);
tagCoverageMap = ofNullable(swagger.getTags())
.orElse(emptyList())
.stream()
.collect(toMap(Tag::getName, TagCoverage::new));
operationToTag = operations.getOperations()
.entrySet()
.stream()
.filter(entry -> entry.getValue().getTags() != null)
.collect(toMap(Map.Entry::getKey, entry -> entry.getValue().getTags()));
operationToTag.forEach((key, value) -> value.stream()
.filter(tag -> tagCoverageMap.containsKey(tag))
.forEach(tag -> tagCoverageMap.get(tag).addOperation(key)));
return this;
}
@Override
public void buildOperation(OperationKey operation, OperationResult operationResult) {
operationToTag.forEach((key, value) -> {
if (operation.toString().equals(key.toString())) {
value.stream()
.filter(tag -> tagCoverageMap.containsKey(tag))
.forEach(tag -> tagCoverageMap.get(tag)
.updateCallCount(operationResult.getProcessCount())
.incrementByState(operationResult.getState())
.updateAllConditionCount(operationResult.getAllConditionCount())
.updateCoveredConditionCount(operationResult.getCoveredConditionCount())
.updateState()
);
}
});
}
@Override
public void buildResult(Results results) {
LOGGER.info(tagCoverageMap.toString());
tagCoverageMap.forEach((key, value) -> tagCounter.incrementByState(value.getState()));
results.setTagCoverageMap(tagCoverageMap).setTagCounter(tagCounter);
}
}
================================================
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/results/builder/postbuilder/ZeroCallStatisticsBuilder.java
================================================
package com.github.viclovsky.swagger.coverage.core.results.builder.postbuilder;
import com.github.viclovsky.swagger.coverage.core.model.OperationKey;
import com.github.viclovsky.swagger.coverage.core.results.Results;
import com.github.viclovsky.swagger.coverage.core.results.builder.core.StatisticsOperationPostBuilder;
import com.github.viclovsky.swagger.coverage.core.results.data.OperationResult;
import java.util.HashSet;
import java.util.Set;
public class ZeroCallStatisticsBuilder extends StatisticsOperationPostBuilder {
private Set<OperationKey> zeroCall = new HashSet<>();
@Override
public void buildOperation(OperationKey operation, OperationResult operationResult) {
if (operationResult.getProcessCount() == 0) {
zeroCall.add(operation);
}
}
@Override
public void buildResult(Results results) {
results.setZeroCall(zeroCall);
}
}
================================================
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/results/builder/prebuilder/CoverageStatisticsBuilder.java
================================================
package com.github.viclovsky.swagger.coverage.core.results.builder.prebuilder;
import com.github.viclovsky.swagger.coverage.configuration.Configuration;
import com.github.viclovsky.swagger.coverage.core.generator.OperationConditionGenerator;
import com.github.viclovsky.swagger.coverage.core.generator.SwaggerSpecificationProcessor;
import com.github.viclovsky.swagger.coverage.core.model.Condition;
import com.github.viclovsky.swagger.coverage.core.model.ConditionOperationCoverage;
import com.github.viclovsky.swagger.coverage.core.model.OperationKey;
import com.github.viclovsky.swagger.coverage.core.model.OperationsHolder;
import com.github.viclovsky.swagger.coverage.core.results.Results;
import com.github.viclovsky.swagger.coverage.core.results.builder.core.StatisticsPreBuilder;
import com.github.viclovsky.swagger.coverage.core.results.data.ConditionStatistics;
import com.github.viclovsky.swagger.coverage.core.results.data.OperationResult;
import com.github.viclovsky.swagger.coverage.core.rule.core.ConditionRule;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.Operation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.util.AntPathMatcher;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.TreeMap;
import java.util.function.Predicate;
public class CoverageStatisticsBuilder extends StatisticsPreBuilder {
private static final Logger LOGGER = LoggerFactory.getLogger(CoverageStatisticsBuilder.class);
private Map<OperationKey, ConditionOperationCoverage> mainCoverageData;
private Map<OperationKey, Operation> missed = new TreeMap<>();
private Map<OperationKey, Operation> deprecated = new TreeMap<>();
@Override
public CoverageStatisticsBuilder configure(OpenAPI swagger, List<ConditionRule> rules) {
mainCoverageData = OperationConditionGenerator.getOperationMap(swagger, rules);
return this;
}
@Override
public CoverageStatisticsBuilder add(OpenAPI swagger) {
OperationsHolder operations = SwaggerSpecificationProcessor.extractOperation(swagger);
operations.getOperations().forEach((key, value) -> {
LOGGER.info(String.format("== process result [%s]", key));
Optional<OperationKey> keyOptional = mainCoverageData.keySet().stream()
.filter(equalsOperationKeys(key)).findFirst();
if (keyOptional.isPresent()) {
mainCoverageData.get(keyOptional.get())
.increaseProcessCount()
.getConditions()
.stream()
.filter(Condition::isNeedCheck)
.forEach(condition -> condition.check(value));
} else {
LOGGER.info(String.format("Missed request [%s]", key));
missed.put(key, value);
}
});
return this;
}
private static Predicate<OperationKey> equalsOperationKeys(OperationKey operationKey) {
return p -> (p.getHttpMethod() == operationKey.getHttpMethod())
&& new AntPathMatcher().match(p.getPath(), operationKey.getPath());
}
@Override
public void build(Results results, Configuration configuration) {
Map<OperationKey, OperationResult> operations = new TreeMap<>();
Map<String, ConditionStatistics> conditionStatisticsMap = new HashMap<>();
mainCoverageData.forEach((key, value) -> {
value.getConditions().stream().filter(Condition::isHasPostCheck).forEach(Condition::postCheck);
operations.put(key, new OperationResult(configuration, value.getConditions(), value.getOperation().getDeprecated())
.setProcessCount(value.getProcessCount())
.setDescription(value.getOperation().getDescription())
.setOperationKey(key)
);
if (value.getOperation().getDeprecated() != null && value.getOperation().getDeprecated()) {
deprecated.put(key, value.getOperation());
}
value.getConditions().forEach(condition -> {
if (!conditionStatisticsMap.containsKey(condition.getType())) {
conditionStatisticsMap.put(condition.getType(), new ConditionStatistics());
}
conditionStatisticsMap.get(condition.getType()).processCondition(key, condition);
}
);
});
results.setOperations(operations)
.setMissed(missed)
.setDeprecated(deprecated)
.setConditionStatisticsMap(conditionStatisticsMap);
}
}
================================================
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/results/builder/prebuilder/GenerationStatisticsBuilder.java
================================================
package com.github.viclovsky.swagger.coverage.core.results.builder.prebuilder;
import com.github.viclovsky.swagger.coverage.CommandLine;
import com.github.viclovsky.swagger.coverage.configuration.Configuration;
import com.github.viclovsky.swagger.coverage.core.results.Results;
import com.github.viclovsky.swagger.coverage.core.results.builder.core.StatisticsPreBuilder;
import com.github.viclovsky.swagger.coverage.core.results.data.GenerationStatistics;
import com.github.viclovsky.swagger.coverage.core.results.util.DateTimeUtil;
import com.github.viclovsky.swagger.coverage.core.rule.core.ConditionRule;
import io.swagger.v3.oas.models.OpenAPI;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.attribute.BasicFileAttributes;
import java.nio.file.attribute.FileTime;
import java.time.Instant;
import java.util.List;
public class GenerationStatisticsBuilder extends StatisticsPreBuilder {
private static final Logger LOGGER = LoggerFactory.getLogger(CommandLine.class);
private long fileCounter = 0;
private FileTime minResultTime = null;
private FileTime maxResultTime = null;
private long startTime;
@Override
public GenerationStatisticsBuilder configure(OpenAPI swagger, List<ConditionRule> rules) {
startTime = System.currentTimeMillis();
return this;
}
@Override
public GenerationStatisticsBuilder add(String path) {
Path file = Paths.get(path);
this.fileCounter++;
try {
BasicFileAttributes attr = Files.readAttributes(file, BasicFileAttributes.class);
if (minResultTime == null || minResultTime.toMillis() > attr.lastModifiedTime().toMillis()) {
minResultTime = attr.lastModifiedTime();
}
if (maxResultTime == null || maxResultTime.toMillis() < attr.lastModifiedTime().toMillis()) {
maxResultTime = attr.lastModifiedTime();
}
} catch (IOException e) {
LOGGER.error("can't read file attributes", e);
}
return this;
}
@Override
public void build(Results results, Configuration configuration) {
final long duration = System.currentTimeMillis() - startTime;
final String resultDateDuration = DateTimeUtil.formatDate(minResultTime.toInstant())
+ " - "
+ DateTimeUtil.formatDate(maxResultTime.toInstant());
results.setGenerationStatistics(
new GenerationStatistics()
.setResultFileCount(fileCounter)
.setGenerationTime(duration)
.setFileResultDateInterval(resultDateDuration)
.setGenerateDate(DateTimeUtil.formatDate(Instant.now()))
);
}
}
================================================
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/results/data/ConditionCounter.java
================================================
package com.github.viclovsky.swagger.coverage.core.results.data;
public class ConditionCounter {
private long all = 0;
private long covered = 0;
private long deprecated = 0;
private long deprecatedAndEmpty = 0;
public ConditionCounter updateAll(long count) {
this.all = this.all + count;
return this;
}
public ConditionCounter updateCovered(long count) {
this.covered = this.covered + count;
return this;
}
public ConditionCounter incrementDeprecated() {
this.deprecated = this.deprecated + 1;
return this;
}
public ConditionCounter incrementDeprecatedAndEmpty() {
this.deprecatedAndEmpty = this.deprecatedAndEmpty + 1;
return this;
}
public long getAll() {
return all;
}
public ConditionCounter setAll(long all) {
this.all = all;
return this;
}
public long getCovered() {
return covered;
}
public ConditionCounter setCovered(long covered) {
this.covered = covered;
return this;
}
public long getDeprecated() {
return deprecated;
}
public void setDeprecated(long deprecated) {
this.deprecated = deprecated;
}
public long getDeprecatedAndEmpty() {
return deprecatedAndEmpty;
}
public void setDeprecatedAndEmpty(long deprecatedAndEmpty) {
this.deprecatedAndEmpty = deprecatedAndEmpty;
}
@Override
public String toString() {
return "ConditionCounter{" +
"all=" + all +
", covered=" + covered +
'}';
}
}
================================================
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/results/data/ConditionStatistics.java
================================================
package com.github.viclovsky.swagger.coverage.core.results.data;
import com.github.viclovsky.swagger.coverage.core.model.Condition;
import com.github.viclovsky.swagger.coverage.core.model.OperationKey;
import java.util.ArrayList;
import java.util.List;
public class ConditionStatistics {
private long allCount = 0;
private long coveredCount = 0;
private long uncoveredCount = 0;
private List<ConditionStatisticsItem> coveredOperation = new ArrayList<>();
private List<ConditionStatisticsItem> uncoveredOperation = new ArrayList<>();
public long getAllCount() {
return allCount;
}
public ConditionStatistics setAllCount(long allCount) {
this.allCount = allCount;
return this;
}
public long getCoveredCount() {
return coveredCount;
}
public ConditionStatistics setCoveredCount(long coveredCount) {
this.coveredCount = coveredCount;
return this;
}
public long getUncoveredCount() {
return uncoveredCount;
}
public ConditionStatistics setUncoveredCount(long uncoveredCount) {
this.uncoveredCount = uncoveredCount;
return this;
}
public List<ConditionStatisticsItem> getCoveredOperation() {
return coveredOperation;
}
public ConditionStatistics setCoveredOperation(List<ConditionStatisticsItem> coveredOperation) {
this.coveredOperation = coveredOperation;
return this;
}
public List<ConditionStatisticsItem> getUncoveredOperation() {
return uncoveredOperation;
}
public ConditionStatistics setUncoveredOperation(List<ConditionStatisticsItem> uncoveredOperation) {
this.uncoveredOperation = uncoveredOperation;
return this;
}
public ConditionStatistics processCondition(OperationKey operation, Condition condition) {
this.allCount++;
if (condition.isCovered()) {
this.coveredCount++;
this.coveredOperation.add(new ConditionStatisticsItem(operation, condition));
} else {
this.uncoveredCount++;
this.uncoveredOperation.add(new ConditionStatisticsItem(operation, condition));
;
}
return this;
}
}
================================================
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/results/data/ConditionStatisticsItem.java
================================================
package com.github.viclovsky.swagger.coverage.core.results.data;
import com.github.viclovsky.swagger.coverage.core.model.Condition;
import com.github.viclovsky.swagger.coverage.core.model.OperationKey;
public class ConditionStatisticsItem {
private OperationKey operation;
private Condition condition;
public ConditionStatisticsItem(OperationKey operation, Condition condition) {
this.operation = operation;
this.condition = condition;
}
public OperationKey getOperation() {
return operation;
}
public ConditionStatisticsItem setOperation(OperationKey operation) {
this.operation = operation;
return this;
}
public Condition getCondition() {
return condition;
}
public ConditionStatisticsItem setCondition(Condition condition) {
this.condition = condition;
return this;
}
}
================================================
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/results/data/CoverageCounter.java
================================================
package com.github.viclovsky.swagger.coverage.core.results.data;
public class CoverageCounter {
private long all = 0;
private long full = 0;
private long party = 0;
private long empty = 0;
private long deprecated = 0;
public CoverageCounter incrementByState(CoverageState state) {
switch (state) {
case FULL:
return incrementFull();
case EMPTY:
return incrementEmpty();
case PARTY:
return incrementParty();
}
return this;
}
public CoverageCounter incrementFull() {
this.all++;
this.full++;
return this;
}
public CoverageCounter incrementParty() {
this.all++;
this.party++;
return this;
}
public CoverageCounter incrementEmpty() {
this.all++;
this.empty++;
return this;
}
public CoverageCounter incrementDeprecated() {
this.deprecated++;
return this;
}
public long getAll() {
return all;
}
public CoverageCounter setAll(long all) {
this.all = all;
return this;
}
public long getFull() {
return full;
}
public CoverageCounter setFull(long full) {
this.full = full;
return this;
}
public long getParty() {
return party;
}
public CoverageCounter setParty(long party) {
this.party = party;
return this;
}
public long getEmpty() {
return empty;
}
public CoverageCounter setEmpty(long empty) {
this.empty = empty;
return this;
}
public long getDeprecated() {
return deprecated;
}
public CoverageCounter setDeprecated(long deprecated) {
this.deprecated = deprecated;
return this;
}
@Override
public String toString() {
return "CoverageCounter{" +
"all=" + all +
", full=" + full +
", party=" + party +
", empty=" + empty +
", deprecated=" + deprecated +
'}';
}
}
================================================
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/results/data/CoverageOperationMap.java
================================================
package com.github.viclovsky.swagger.coverage.core.results.data;
import com.github.viclovsky.swagger.coverage.core.model.OperationKey;
import java.util.HashSet;
import java.util.Set;
public class CoverageOperationMap {
private Set<OperationKey> full = new HashSet<>();
private Set<OperationKey> party = new HashSet<>();
private Set<OperationKey> empty = new HashSet<>();
private Set<OperationKey> deprecated = new HashSet<>();
protected CoverageCounter counter = new CoverageCounter();
public CoverageOperationMap addFull(OperationKey operation) {
this.full.add(operation);
this.counter.incrementFull();
return this;
}
public CoverageOperationMap addParty(OperationKey operation) {
this.party.add(operation);
this.counter.incrementParty();
return this;
}
public CoverageOperationMap addEmpty(OperationKey operation) {
this.empty.add(operation);
this.counter.incrementEmpty();
return this;
}
public CoverageOperationMap addDeprecated(OperationKey operation) {
this.deprecated.add(operation);
this.counter.incrementDeprecated();
return this;
}
public Set<OperationKey> getFull() {
return full;
}
public CoverageOperationMap setFull(Set<OperationKey> full) {
this.full = full;
return this;
}
public Set<OperationKey> getParty() {
return party;
}
public CoverageOperationMap setParty(Set<OperationKey> party) {
this.party = party;
return this;
}
public Set<OperationKey> getEmpty() {
return empty;
}
public CoverageOperationMap setEmpty(Set<OperationKey> empty) {
this.empty = empty;
return this;
}
public Set<OperationKey> getDeprecated() {
return deprecated;
}
public CoverageOperationMap setDeprecated(Set<OperationKey> deprecated) {
this.deprecated = deprecated;
return this;
}
public CoverageCounter getCounter() {
return counter;
}
public CoverageOperationMap setCounter(CoverageCounter counter) {
this.counter = counter;
return this;
}
}
================================================
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/results/data/CoverageState.java
================================================
package com.github.viclovsky.swagger.coverage.core.results.data;
public enum CoverageState {
FULL,
PARTY,
EMPTY,
DEPRECATED,
}
================================================
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/results/data/GenerationStatistics.java
================================================
package com.github.viclovsky.swagger.coverage.core.results.data;
public class GenerationStatistics {
private long resultFileCount = 0;
private long generationTime;
private String fileResultDateInterval;
private String generateDate;
public GenerationStatistics() {
}
public long getResultFileCount() {
return resultFileCount;
}
public GenerationStatistics setResultFileCount(long resultFileCount) {
this.resultFileCount = resultFileCount;
return this;
}
public long getGenerationTime() {
return generationTime;
}
public GenerationStatistics setGenerationTime(long generationTime) {
this.generationTime = generationTime;
return this;
}
public String getFileResultDateInterval() {
return fileResultDateInterval;
}
public GenerationStatistics setFileResultDateInterval(String fileResultDateInterval) {
this.fileResultDateInterval = fileResultDateInterval;
return this;
}
public String getGenerateDate() {
return generateDate;
}
public GenerationStatistics setGenerateDate(String generateDate) {
this.generateDate = generateDate;
return this;
}
}
================================================
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/results/data/OperationResult.java
================================================
package com.github.viclovsky.swagger.coverage.core.results.data;
import com.github.viclovsky.swagger.coverage.configuration.Configuration;
import com.github.viclovsky.swagger.coverage.core.model.Condition;
import com.github.viclovsky.swagger.coverage.core.model.OperationKey;
import java.util.List;
public class OperationResult {
private boolean excludeDeprecated;
private OperationKey operationKey;
private List<Condition> conditions;
private long allConditionCount;
private long coveredConditionCount;
private long processCount;
private String description;
private CoverageState state;
private boolean deprecated;
public OperationResult(Configuration configuration, List<Condition> conditions, Boolean isDeprecated) {
this.conditions = conditions;
this.deprecated = (isDeprecated != null) ? isDeprecated : false;
allConditionCount = conditions.size();
coveredConditionCount = conditions.stream().filter(Condition::isCovered).count();
try {
excludeDeprecated = configuration.getOption("exclude-deprecated").isEnable();
} catch (NullPointerException e) {
excludeDeprecated = false;
}
if (this.deprecated && excludeDeprecated) {
state = CoverageState.DEPRECATED;
} else if (coveredConditionCount == 0) {
state = CoverageState.EMPTY;
} else {
if (allConditionCount == coveredConditionCount) {
state = CoverageState.FULL;
} else {
state = CoverageState.PARTY;
}
}
}
public long getAllConditionCount() {
return allConditionCount;
}
public OperationResult setAllConditionCount(long allConditionCount) {
this.allConditionCount = allConditionCount;
return this;
}
public long getCoveredConditionCount() {
return coveredConditionCount;
}
public OperationResult setCoveredConditionCount(long coveredConditionCount) {
this.coveredConditionCount = coveredConditionCount;
return this;
}
public long getProcessCount() {
return processCount;
}
public OperationResult setProcessCount(long processCount) {
this.processCount = processCount;
return this;
}
public String getDescription() {
if (description == null) {
return "";
}
return description;
}
public OperationResult setDescription(String description) {
this.description = description;
return this;
}
public CoverageState getState() {
return state;
}
public OperationResult setState(CoverageState state) {
this.state = state;
return this;
}
public OperationKey getOperationKey() {
return operationKey;
}
public OperationResult setOperationKey(OperationKey operationKey) {
this.operationKey = operationKey;
return this;
}
public List<Condition> getConditions() {
return conditions;
}
public void setConditions(List<Condition> conditions) {
this.conditions = conditions;
}
public boolean getDeprecated() {
return deprecated;
}
public void setDeprecated(boolean isDeprecated) {
this.deprecated = isDeprecated;
}
}
================================================
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/results/data/TagCoverage.java
================================================
package com.github.viclovsky.swagger.coverage.core.results.data;
import com.github.viclovsky.swagger.coverage.core.model.OperationKey;
import io.swagger.v3.oas.models.tags.Tag;
import java.util.HashSet;
import java.util.Set;
public class TagCoverage {
private Tag tag;
private Set<OperationKey> operations = new HashSet<>();
private CoverageCounter coverageCounter = new CoverageCounter();
private ConditionCounter conditionCounter = new ConditionCounter();
private long callCounts = 0;
private CoverageState state = CoverageState.EMPTY;
public TagCoverage(Tag tag) {
this.tag = tag;
}
public TagCoverage updateState() {
if (conditionCounter.getCovered() == 0) {
state = CoverageState.EMPTY;
} else {
if (conditionCounter.getAll() == conditionCounter.getCovered()) {
state = CoverageState.FULL;
} else {
state = CoverageState.PARTY;
}
}
return this;
}
public TagCoverage addOperation(OperationKey operation) {
this.operations.add(operation);
return this;
}
public TagCoverage updateCallCount(long callCounts) {
this.callCounts += callCounts;
return this;
}
public TagCoverage incrementByState(CoverageState state) {
this.coverageCounter.incrementByState(state);
return this;
}
public TagCoverage updateAllConditionCount(long count) {
conditionCounter.updateAll(count);
return this;
}
public TagCoverage updateCoveredConditionCount(long count) {
conditionCounter.updateCovered(count);
return this;
}
public Tag getTag() {
return tag;
}
public TagCoverage setTag(Tag tag) {
this.tag = tag;
return this;
}
public CoverageCounter getCoverageCounter() {
return coverageCounter;
}
public TagCoverage setCoverageCounter(CoverageCounter coverageCounter) {
this.coverageCounter = coverageCounter;
return this;
}
public Set<OperationKey> getOperations() {
return operations;
}
public TagCoverage setOperations(Set<OperationKey> operations) {
this.operations = operations;
return this;
}
public ConditionCounter getConditionCounter() {
return conditionCounter;
}
public TagCoverage setConditionCounter(ConditionCounter conditionCounter) {
this.conditionCounter = conditionCounter;
return this;
}
public long getCallCounts() {
return callCounts;
}
public TagCoverage setCallCounts(long callCounts) {
this.callCounts = callCounts;
return this;
}
public CoverageState getState() {
return state;
}
public TagCoverage setState(CoverageState state) {
this.state = state;
return this;
}
@Override
public String toString() {
return "TagCoverage{" +
"tag='" + tag.getName() + '\'' +
", operations=" + operations.toString() +
", coverageCounter=" + coverageCounter.toString() +
", conditionCounter=" + conditionCounter.toString() +
'}';
}
}
================================================
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/results/util/DateTimeUtil.java
================================================
package com.github.viclovsky.swagger.coverage.core.results.util;
import java.time.Instant;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
public class DateTimeUtil {
private static DateTimeFormatter dateTimeFormatter = DateTimeFormatter
.ofPattern("yyyy-MM-dd HH:mm:ss")
.withZone(ZoneId.systemDefault());
public static String formatDate(Instant instant) {
return dateTimeFormatter.format(instant);
}
}
================================================
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/rule/body/NotEmptyBodyRule.java
================================================
package com.github.viclovsky.swagger.coverage.core.rule.body;
import com.github.viclovsky.swagger.coverage.core.model.Condition;
import com.github.viclovsky.swagger.coverage.core.model.SinglePredicateCondition;
import com.github.viclovsky.swagger.coverage.core.predicate.DefaultBodyConditionPredicate;
import com.github.viclovsky.swagger.coverage.core.rule.core.ConditionRule;
import io.swagger.v3.oas.models.Operation;
import java.util.ArrayList;
import java.util.List;
public class NotEmptyBodyRule extends ConditionRule {
@Override
public List<Condition> createCondition(Operation operation) {
if (operation.getRequestBody() != null && operation.getRequestBody().getContent() != null) {
List<Condition> conditions = new ArrayList<>();
conditions.add(new SinglePredicateCondition(
"not empty body request",
"",
new DefaultBodyConditionPredicate()
));
return conditions;
} else {
return null;
}
}
@Override
public String getId() {
return "not-empty-body";
}
}
================================================
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/rule/body/PropertyConditionRule.java
================================================
package com.github.viclovsky.swagger.coverage.core.rule.body;
import com.github.viclovsky.swagger.coverage.core.model.Condition;
import com.github.viclovsky.swagger.coverage.core.rule.core.ConditionRule;
import io.swagger.v3.oas.models.Operation;
import io.swagger.v3.oas.models.media.MediaType;
import io.swagger.v3.oas.models.media.Schema;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;
//request body properties are the v3 version of form data params
public abstract class PropertyConditionRule extends ConditionRule {
public List<Condition> createCondition(Operation operation) {
if (operation.getRequestBody() != null && operation.getRequestBody().getContent() != null) {
return operation.getRequestBody().getContent().entrySet().stream()
.flatMap(m -> processMediaType(m.getKey(), m.getValue()))
.filter(Objects::nonNull)
.collect(Collectors.toList());
} else {
return null;
}
}
private Stream<Condition> processMediaType(String mediaTypeName, MediaType mediaType) {
if (mediaType.getSchema() != null && mediaType.getSchema().getProperties() != null) {
return ((Set<Map.Entry<String, Schema>>) mediaType.getSchema().getProperties().entrySet())
.stream()
.map(s -> processProperty(mediaTypeName, s.getKey(), s.getValue()))
.filter(Objects::nonNull);
} else {
return null;
}
}
protected abstract Condition processProperty(String mediaTypeName, String name, Schema schema);
}
================================================
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/rule/body/PropertyEnumAllValuesRule.java
================================================
package com.github.viclovsky.swagger.coverage.core.rule.body;
import com.github.viclovsky.swagger.coverage.core.generator.SwaggerSpecificationProcessor;
import com.github.viclovsky.swagger.coverage.core.model.Condition;
import com.github.viclovsky.swagger.coverage.core.model.SinglePredicateCondition;
import com.github.viclovsky.swagger.coverage.core.predicate.PropertyValueConditionPredicate;
import io.swagger.v3.oas.models.media.Schema;
import java.util.List;
public class PropertyEnumAllValuesRule extends PropertyConditionRule {
@Override
protected Condition processProperty(String mediaTypeName, String name, Schema schema) {
List<String> enums = SwaggerSpecificationProcessor.extractEnum(schema);
if (schema != null && name != null && mediaTypeName != null
&& enums != null && !enums.isEmpty()) {
return new SinglePredicateCondition(
String.format("«%s» contains all values from enum %s", name, enums),
"",
new PropertyValueConditionPredicate(mediaTypeName, name, enums)
);
}
return null;
}
@Override
public String getId() {
return "property-enum-all-value";
}
}
================================================
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/rule/body/PropertyNotEmptyRule.java
================================================
package com.github.viclovsky.swagger.coverage.core.rule.body;
import com.github.viclovsky.swagger.coverage.core.model.Condition;
import com.github.viclovsky.swagger.coverage.core.model.SinglePredicateCondition;
import com.github.viclovsky.swagger.coverage.core.predicate.DefaultPropertyConditionPredicate;
import io.swagger.v3.oas.models.media.Schema;
public class PropertyNotEmptyRule extends PropertyConditionRule {
@Override
protected Condition processProperty(String mediaTypeName, String name, Schema schema) {
if (schema != null && name != null && mediaTypeName != null) {
return new SinglePredicateCondition(
String.format("«%s» is not empty", name),
"",
new DefaultPropertyConditionPredicate(mediaTypeName, name, false)
);
}
return null;
}
@Override
public String getId() {
return "property-not-empty";
}
}
================================================
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/rule/body/PropertyNotOnlyEnumValuesRule.java
================================================
package com.github.viclovsky.swagger.coverage.core.rule.body;
import com.github.viclovsky.swagger.coverage.core.generator.SwaggerSpecificationProcessor;
import com.github.viclovsky.swagger.coverage.core.model.Condition;
import com.github.viclovsky.swagger.coverage.core.model.SinglePredicateCondition;
import com.github.viclovsky.swagger.coverage.core.predicate.PropertyValueNotOnlyConditionPredicate;
import io.swagger.v3.oas.models.media.Schema;
import java.util.List;
public class PropertyNotOnlyEnumValuesRule extends PropertyConditionRule {
@Override
protected Condition processProperty(String mediaTypeName, String name, Schema schema) {
List<String> enums = SwaggerSpecificationProcessor.extractEnum(schema);
if (schema != null && name != null && mediaTypeName != null
&& enums != null && !enums.isEmpty()) {
return new SinglePredicateCondition(
String.format("«%s» contains all values from enum %s", name, enums),
"",
new PropertyValueNotOnlyConditionPredicate(mediaTypeName, name, enums)
);
}
return null;
}
@Override
public String getId() {
return "property-enum-another-value";
}
}
================================================
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/rule/core/ConditionRule.java
================================================
package com.github.viclovsky.swagger.coverage.core.rule.core;
import com.github.viclovsky.swagger.coverage.configuration.options.RuleConfigurationOptions;
import com.github.viclovsky.swagger.coverage.core.model.Condition;
import io.swagger.v3.oas.models.Operation;
import java.util.List;
public abstract class ConditionRule {
protected RuleConfigurationOptions options;
public abstract String getId();
public abstract List<Condition> createCondition(Operation operation);
public ConditionRule configure(RuleConfigurationOptions options) {
this.options = options;
return this;
}
}
================================================
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/rule/parameter/EmptyHeaderRule.java
================================================
package com.github.viclovsky.swagger.coverage.core.rule.parameter;
import com.github.viclovsky.swagger.coverage.core.model.Condition;
import com.github.viclovsky.swagger.coverage.core.model.SinglePredicateCondition;
import com.github.viclovsky.swagger.coverage.core.predicate.ConditionPredicate;
import com.github.viclovsky.swagger.coverage.core.predicate.DefaultParameterConditionPredicate;
import io.swagger.v3.oas.models.parameters.HeaderParameter;
import io.swagger.v3.oas.models.parameters.Parameter;
public class EmptyHeaderRule extends ParameterConditionRule {
@Override
public Condition processParameter(Parameter parameter) {
if (parameter instanceof HeaderParameter) {
ConditionPredicate predicate = new DefaultParameterConditionPredicate(true, parameter.getName(), parameter.getIn());
return new SinglePredicateCondition(
String.format("header «%s» is empty", parameter.getName()),
"",
predicate
);
}
return null;
}
@Override
public String getId() {
return "empty-required-header";
}
}
================================================
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/rule/parameter/EnumAllValuesRule.java
================================================
package com.github.viclovsky.swagger.coverage.core.rule.parameter;
import com.github.viclovsky.swagger.coverage.core.generator.SwaggerSpecificationProcessor;
import com.github.viclovsky.swagger.coverage.core.model.Condition;
import com.github.viclovsky.swagger.coverage.core.model.SinglePredicateCondition;
import com.github.viclovsky.swagger.coverage.core.predicate.ConditionPredicate;
import com.github.viclovsky.swagger.coverage.core.predicate.ParameterValueConditionPredicate;
import io.swagger.v3.oas.models.parameters.Parameter;
import java.util.List;
public class EnumAllValuesRule extends ParameterConditionRule {
@Override
public Condition processParameter(Parameter parameter) {
List<String> enumValues = SwaggerSpecificationProcessor.extractEnum(parameter);
if (enumValues != null && !enumValues.isEmpty()) {
ConditionPredicate predicate = new ParameterValueConditionPredicate(parameter.getName(), parameter.getIn(), enumValues);
return new SinglePredicateCondition(
String.format("%s «%s» contains all values from enum %s", parameter.getIn(), parameter.getName(), enumValues),
"",
predicate
);
}
return null;
}
@Override
public String getId() {
return "enum-all-value";
}
}
================================================
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/rule/parameter/NotEmptyParameterRule.java
================================================
package com.github.viclovsky.swagger.coverage.core.rule.parameter;
import com.github.viclovsky.swagger.coverage.core.model.Condition;
import com.github.viclovsky.swagger.coverage.core.model.SinglePredicateCondition;
import com.github.viclovsky.swagger.coverage.core.predicate.ConditionPredicate;
import com.github.viclovsky.swagger.coverage.core.predicate.DefaultParameterConditionPredicate;
import io.swagger.v3.oas.models.parameters.Parameter;
public class NotEmptyParameterRule extends ParameterConditionRule {
@Override
public Condition processParameter(Parameter parameter) {
ConditionPredicate predicate = new DefaultParameterConditionPredicate(false, parameter.getName(), parameter.getIn());
return new SinglePredicateCondition(
String.format("%s «%s» is not empty", parameter.getIn(), parameter.getName()),
"",
predicate
);
}
@Override
public String getId() {
return "parameter-not-empty";
}
}
================================================
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/rule/parameter/NotOnlyEnumValuesRule.java
================================================
package com.github.viclovsky.swagger.coverage.core.rule.parameter;
import com.github.viclovsky.swagger.coverage.core.generator.SwaggerSpecificationProcessor;
import com.github.viclovsky.swagger.coverage.core.model.Condition;
import com.github.viclovsky.swagger.coverage.core.model.SinglePredicateCondition;
import com.github.viclovsky.swagger.coverage.core.predicate.ConditionPredicate;
import com.github.viclovsky.swagger.coverage.core.predicate.NotOnlyParameterListValueConditionPredicate;
import io.swagger.v3.oas.models.parameters.Parameter;
import java.util.List;
public class NotOnlyEnumValuesRule extends ParameterConditionRule {
@Override
public Condition processParameter(Parameter parameter) {
List<String> enumValues = SwaggerSpecificationProcessor.extractEnum(parameter);
if (enumValues != null && !enumValues.isEmpty()) {
ConditionPredicate predicate = new NotOnlyParameterListValueConditionPredicate(
parameter.getName(), parameter.getIn(), enumValues
);
return new SinglePredicateCondition(
String.format("%s «%s» contains values not only from enum", parameter.getIn(), parameter.getName()),
"",
predicate
);
}
return null;
}
@Override
public String getId() {
return "enum-another-value";
}
}
================================================
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/rule/parameter/ParameterConditionRule.java
================================================
package com.github.viclovsky.swagger.coverage.core.rule.parameter;
import com.github.viclovsky.swagger.coverage.core.model.Condition;
import com.github.viclovsky.swagger.coverage.core.rule.core.ConditionRule;
import io.swagger.v3.oas.models.Operation;
import io.swagger.v3.oas.models.parameters.Parameter;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
public abstract class ParameterConditionRule extends ConditionRule {
public abstract Condition processParameter(Parameter parameter);
public List<Condition> createCondition(Operation operation) {
if(operation.getParameters() != null) {
return operation
.getParameters()
.stream()
.map(this::processParameter)
.filter(Objects::nonNull)
.collect(Collectors.toList());
} else {
return null;
}
}
}
================================================
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/rule/status/HTTPStatusRule.java
================================================
package com.github.viclovsky.swagger.coverage.core.rule.status;
import com.github.viclovsky.swagger.coverage.core.model.Condition;
import com.github.viclovsky.swagger.coverage.core.model.SinglePredicateCondition;
import com.github.viclovsky.swagger.coverage.core.predicate.ConditionPredicate;
import com.github.viclovsky.swagger.coverage.core.predicate.DefaultStatusConditionPredicate;
public class HTTPStatusRule extends StatusConditionRule {
@Override
public String getId() {
return "status";
}
@Override
public Condition processStatus(String status) {
if (skip(status)) {
return null;
}
ConditionPredicate predicate = new DefaultStatusConditionPredicate(status);
return new SinglePredicateCondition(
"HTTP status " + status,
"",
predicate
);
}
protected boolean skip(String status) {
if (this.options == null) {
return false;
}
if (this.options.getFilter() != null
&& !this.options.getFilter().isEmpty()
&& !this.options.getFilter().contains(status)
) {
return true;
}
return this.options.getIgnore() != null
&& !this.options.getIgnore().isEmpty()
&& this.options.getIgnore().contains(status);
}
}
================================================
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/rule/status/OnlyDeclaredHTTPStatusesRule.java
================================================
package com.github.viclovsky.swagger.coverage.core.rule.status;
import com.github.viclovsky.swagger.coverage.core.model.Condition;
import com.github.viclovsky.swagger.coverage.core.model.SinglePredicateCondition;
import com.github.viclovsky.swagger.coverage.core.predicate.ConditionPredicate;
import com.github.viclovsky.swagger.coverage.core.predicate.FullStatusConditionPredicate;
import com.github.viclovsky.swagger.coverage.core.rule.core.ConditionRule;
import io.swagger.v3.oas.models.Operation;
import java.util.Collections;
import java.util.List;
public class OnlyDeclaredHTTPStatusesRule extends ConditionRule {
@Override
public String getId() {
return "only-declared-status";
}
@Override
public List<Condition> createCondition(Operation operation) {
ConditionPredicate predicate = new FullStatusConditionPredicate(operation.getResponses().keySet());
Condition condition = new SinglePredicateCondition(
"only declared status",
"",
predicate
);
return Collections.singletonList(condition);
}
}
================================================
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/rule/status/StatusConditionRule.java
================================================
package com.github.viclovsky.swagger.coverage.core.rule.status;
import com.github.viclovsky.swagger.coverage.core.model.Condition;
import com.github.viclovsky.swagger.coverage.core.rule.core.ConditionRule;
import io.swagger.v3.oas.models.Operation;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
/**
* Base rule for status
*/
public abstract class StatusConditionRule extends ConditionRule {
public abstract Condition processStatus(String statusCode);
public List<Condition> createCondition(Operation operation) {
return operation.getResponses()
.keySet()
.stream()
.map(this::processStatus)
.filter(Objects::nonNull)
.collect(Collectors.toList());
}
}
================================================
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/writer/CoverageResultsWriter.java
================================================
package com.github.viclovsky.swagger.coverage.core.writer;
import com.github.viclovsky.swagger.coverage.core.results.Results;
public interface CoverageResultsWriter {
void write(Results results);
}
================================================
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/writer/FileSystemResultsWriter.java
================================================
package com.github.viclovsky.swagger.coverage.core.writer;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.github.viclovsky.swagger.coverage.SwaggerCoverageWriteException;
import com.github.viclovsky.swagger.coverage.core.results.Results;
import com.github.viclovsky.swagger.coverage.model.SwaggerCoverage2ModelJackson;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.io.OutputStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import static com.github.viclovsky.swagger.coverage.SwaggerCoverageConstants.COVERAGE_RESULTS_NAME;
public class FileSystemResultsWriter implements CoverageResultsWriter {
private final static Logger LOGGER = LoggerFactory.getLogger(FileSystemResultsWriter.class);
private final ObjectMapper mapper;
private final String fileName;
public FileSystemResultsWriter() {
this(COVERAGE_RESULTS_NAME);
}
public FileSystemResultsWriter(String fileName) {
this.fileName = fileName;
this.mapper = SwaggerCoverage2ModelJackson.createJsonMapper();
}
@Override
public void write(Results results) {
final String swaggerResultName = fileName;
Path path = Paths.get(swaggerResultName);
LOGGER.info(String.format("Write results in file '%s'", path.toAbsolutePath()));
try (OutputStream os = Files.newOutputStream(Paths.get(swaggerResultName))) {
mapper.writeValue(os, results);
} catch (IOException e) {
throw new SwaggerCoverageWriteException("Could not write results", e);
}
}
}
================================================
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/writer/HtmlReportResultsWriter.java
================================================
package com.github.viclovsky.swagger.coverage.core.writer;
import com.github.viclovsky.swagger.coverage.SwaggerCoverageWriteException;
import com.github.viclovsky.swagger.coverage.configuration.options.ResultsWriterOptions;
import com.github.viclovsky.swagger.coverage.core.results.Results;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import static com.github.viclovsky.swagger.coverage.utils.FreemarkerUtils.processCustomTemplate;
import static com.github.viclovsky.swagger.coverage.utils.FreemarkerUtils.processTemplate;
public class HtmlReportResultsWriter implements CoverageResultsWriter {
private static final Logger LOGGER = LoggerFactory.getLogger(HtmlReportResultsWriter.class);
private ResultsWriterOptions options;
private String filename = "swagger-coverage-report.html";
private String localeCode = "en";
private String numberFormat = "0.###";
public HtmlReportResultsWriter() {
options = new ResultsWriterOptions()
.setFilename(filename)
.setLocale(localeCode)
.setNumberFormat(numberFormat);
}
public HtmlReportResultsWriter(ResultsWriterOptions options){
if (options.getLocale() == null){
options.setLocale(localeCode);
}
if (options.getFilename() == null){
options.setFilename(filename);
}
if (options.getNumberFormat() == null){
options.setNumberFormat(numberFormat);
}
this.options = options;
}
@Override
public void write(Results results) {
Path path = Paths.get(options.getFilename());
LOGGER.info(String.format("Write html report in file '%s'", path.toAbsolutePath()));
try {
final String htmlReport = (options.getCustomTemplatePath() == null ) ?
processTemplate("report.ftl", options.getLocale(), options.getNumberFormat(), results) :
processCustomTemplate(options.getCustomTemplatePath(), options.getLocale(), options.getNumberFormat(), results);
Files.write(Paths.get(options.getFilename()), htmlReport.getBytes(StandardCharsets.UTF_8));
} catch (IOException e) {
throw new SwaggerCoverageWriteException("Could not write results", e);
}
}
}
================================================
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/writer/LogResultsWriter.java
================================================
package com.github.viclovsky.swagger.coverage.core.writer;
import com.github.viclovsky.swagger.coverage.core.model.OperationKey;
import com.github.viclovsky.swagger.coverage.core.results.Results;
import com.github.viclovsky.swagger.coverage.core.results.data.OperationResult;
import io.swagger.v3.oas.models.Operation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.text.DecimalFormat;
import java.util.Map;
import java.util.Set;
public class LogResultsWriter implements CoverageResultsWriter {
private final static Logger LOGGER = LoggerFactory.getLogger(LogResultsWriter.class);
public LogResultsWriter() {
}
@Override
public void write(Results results) {
LOGGER.info("Deprecated coverage: ");
logOperationCoverage(results.getOperations(), results.getCoverageOperationMap().getDeprecated());
LOGGER.info("Empty coverage: ");
logOperationCoverage(results.getOperations(), results.getCoverageOperationMap().getEmpty());
LOGGER.info("Partial coverage: ");
logOperationCoverage(results.getOperations(), results.getCoverageOperationMap().getParty());
LOGGER.info("Full coverage: ");
logOperationCoverage(results.getOperations(), results.getCoverageOperationMap().getFull());
logMissedCoverage(results.getMissed());
DecimalFormat df = new DecimalFormat("###.###");
float deprecatedPercentage = (float) (results.getCoverageOperationMap().getDeprecated().size() * 100) / results.getOperations().size();
float emptyPercentage = (float) (results.getCoverageOperationMap().getEmpty().size() * 100) / results.getOperations().size();
float partialPercentage = (float) (results.getCoverageOperationMap().getParty().size() * 100) / results.getOperations().size();
float fullPercentage = (float) (results.getCoverageOperationMap().getFull().size() * 100) / results.getOperations().size();
LOGGER.info(String.format("Conditions: %s/%s", results.getConditionCounter().getCovered(), results.getConditionCounter().getAll()));
LOGGER.info("Deprecated coverage " + df.format(deprecatedPercentage) + " %");
LOGGER.info("Empty coverage " + df.format(emptyPercentage) + " %");
LOGGER.info("Partial coverage " + df.format(partialPercentage) + " %");
LOGGER.info("Full coverage " + df.format(fullPercentage) + " %");
}
private void logMissedCoverage(Map<OperationKey, Operation> missed) {
if (!missed.isEmpty()) {
LOGGER.info("Missed coverage: ");
missed.keySet().forEach(
m -> LOGGER.info(m.getHttpMethod() + " " + m.getPath()));
}
}
private void logOperationCoverage(Map<OperationKey, OperationResult> operationResults, Set<OperationKey> keys) {
keys.forEach(operationKey -> {
if (operationResults.containsKey(operationKey)) {
printOperationCoverage(operationResults.get(operationKey));
}
});
}
private void printOperationCoverage(OperationResult result) {
LOGGER.info(String.format("%s %s (%s/%s)", result.getOperationKey().getHttpMethod(), result.getOperationKey().getPath(),
result.getCoveredConditionCount(), result.getAllConditionCount()));
result.getConditions().forEach(c -> {
if (c.isCovered()) {
LOGGER.info(String.format("✅ %s", c.getName()));
} else {
LOGGER.info(String.format("❌ %s", c.getName()));
}
});
}
}
================================================
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/option/MainOptions.java
================================================
package com.github.viclovsky.swagger.coverage.option;
import com.beust.jcommander.Parameter;
import java.net.URI;
import java.nio.file.Path;
public class MainOptions {
@Parameter(
names = {"-s", "--spec"},
description = "Path to local or URL to remote swagger specification.",
required = true,
order = 0
)
private URI specPath;
@Parameter(
names = {"-i", "--input"},
description = "Path to folder with generated files with coverage.",
required = true,
order = 1
)
private Path inputPath;
@Parameter(
names = {"-c", "--configuration"},
description = "Path to file with report configuration.",
order = 1
)
private Path configuration;
@Parameter(
names = "--help",
description = "Print commandline help.",
help = true,
order = 5
)
private boolean help;
public boolean isHelp() {
return help;
}
public URI getSpecPath() {
return specPath;
}
public Path getInputPath() {
return inputPath;
}
public Path getConfiguration() {
return configuration;
}
}
================================================
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/option/VerboseOptions.java
================================================
package com.github.viclovsky.swagger.coverage.option;
import com.beust.jcommander.Parameter;
public class VerboseOptions {
@Parameter(
names = {"-v", "--verbose"},
description = "Switch on the verbose mode."
)
private boolean verbose;
@Parameter(
names = {"-q", "--quiet"},
description = "Switch on the quiet mode."
)
private boolean quiet;
/**
* Returns true if silent mode is enabled, false otherwise.
*/
public boolean isQuiet() {
return quiet;
}
/**
* Returns true if verbose mode is enabled, false otherwise.
*/
public boolean isVerbose() {
return verbose;
}
}
================================================
FILE: swagger-coverage-commandline/src/main/resources/logback.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<appender name="stdout" class="ch.qos.logback.core.ConsoleAppender">
<Target>System.out</Target>
<encoder>
<pattern>%d{HH:mm:ss} %-5p %c{1} - %m%n</pattern>
</encoder>
</appender>
<root level="ALL">
<appender-ref ref="stdout"/>
</root>
</configuration>
================================================
FILE: swagger-coverage-commandline/src/test/java/com/github/viclovsky/swagger/coverage/Config.java
================================================
package com.github.viclovsky.swagger.coverage;
import java.io.File;
import java.net.URI;
import java.nio.file.Path;
import static java.util.Optional.ofNullable;
public class Config {
private final String path;
private final String outputPath;
private final String specPath;
public Config(String path, String outputPath, String specPath) {
this.path = path;
this.outputPath = outputPath;
this.specPath = specPath;
}
public Path getPath() {
return getFile(path).toPath();
}
public Path getOutput() {
return getFile(outputPath).toPath();
}
public URI getSpec() {
return URI.create(specPath);
}
private File getFile(String name) {
return ofNullable(getClass().getClassLoader().getResource(name))
.map(spec -> new File(spec.getFile()))
.orElseThrow(() -> new IllegalArgumentException("Unable to read file: " + name));
}
}
================================================
FILE: swagger-coverage-commandline/src/test/java/com/github/viclovsky/swagger/coverage/CustomReportTemplateTest.java
================================================
package com.github.viclovsky.swagger.coverage;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.github.viclovsky.swagger.coverage.configuration.options.ConfigurationOptions;
import com.github.viclovsky.swagger.coverage.configuration.options.ResultsWriterOptions;
import com.github.viclovsky.swagger.coverage.core.generator.Generator;
import io.swagger.v3.parser.core.models.ParseOptions;
import org.apache.commons.io.FileUtils;
import org.hamcrest.io.FileMatchers;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.io.IOException;
import java.net.URISyntaxException;
import java.net.URL;
import java.nio.file.Paths;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import static java.nio.file.Paths.get;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.text.StringContainsInOrder.stringContainsInOrder;
@RunWith(Parameterized.class)
public class CustomReportTemplateTest {
private static final Logger LOGGER = LoggerFactory.getLogger(CustomReportTemplateTest.class);
private final String outputPath, specPath;
public CustomReportTemplateTest(String outputPath, String specPath ) {
this.outputPath = outputPath;
this.specPath = specPath;
}
private File generateConfigurationFile() throws URISyntaxException, IOException {
HashMap<String, ResultsWriterOptions> customReportOptions = new HashMap<>();
URL res = getClass().getClassLoader().getResource("report_custom.ftl");
customReportOptions.put("html", new ResultsWriterOptions()
.setFilename("custom-template-report.html")
.setLocale("en")
.setNumberFormat("0.###")
.setCustomTemplatePath(Paths.get(res.toURI()).toFile().getAbsolutePath()));
ParseOptions parseOptions = new ParseOptions();
parseOptions.setResolve(true);
ConfigurationOptions configurationOptions = new ConfigurationOptions()
.setWriters(customReportOptions);
File testConfigurationFile = File.createTempFile("customTemplate", ".json");
FileUtils.writeStringToFile(testConfigurationFile, new ObjectMapper().writeValueAsString(configurationOptions));
return testConfigurationFile;
}
@Test
public void testWithCustomTemplate() throws IOException, URISyntaxException {
File testConfigurationFile = generateConfigurationFile();
Config testConfig = new Config(testConfigurationFile.getAbsolutePath(),
outputPath, specPath);
LOGGER.info("Generate report for {}:", testConfigurationFile.getAbsolutePath());
LOGGER.info("{}", FileUtils.readFileToString(testConfigurationFile));
new Generator()
.setInputPath(testConfig.getOutput())
.setSpecPath(testConfig.getSpec())
.setConfigurationPath(testConfigurationFile.toPath())
.run();
File reportFile = get("custom-template-report.html").toFile();
assertThat(reportFile, FileMatchers.anExistingFile());
assertThat(FileUtils.readFileToString(reportFile), stringContainsInOrder("CUSTOM_TEST_REPORT"));
}
@Parameterized.Parameters()
public static Collection<Object[]> testData() {
return Arrays.asList(new Object[][]{
//Swagger v2
{"v2/swagger-coverage-output", "v2/petstory.json"},
//Swagger v3
{"v3/swagger-coverage-output", "v3/petstory.yaml"},
});
}
}
================================================
FILE: swagger-coverage-commandline/src/test/java/com/github/viclovsky/swagger/coverage/ParseOptionsTest.java
================================================
package com.github.viclovsky.swagger.coverage;
import com.github.viclovsky.swagger.coverage.core.generator.Generator;
import org.junit.Test;
import static com.jayway.jsonpath.matchers.JsonPathMatchers.hasJsonPath;
import static java.nio.file.Paths.get;
import static org.hamcrest.MatcherAssert.assertThat;
public class ParseOptionsTest {
private static final String V3_OUTPUT_SWAGGER_COVERAGE_DIR = "v3/swagger-coverage-output";
private static final String CONFIGURATION_FILE = "full_configuration.json";
@Test
public void resolveOptionTest() {
Config config = new Config(CONFIGURATION_FILE, V3_OUTPUT_SWAGGER_COVERAGE_DIR, "v3/petstory_ref_operations.yaml");
new Generator()
.setInputPath(config.getOutput())
.setSpecPath(config.getSpec())
.setConfigurationPath(config.getPath())
.run();
assertThat(get("json-report.json").toFile(), hasJsonPath("$.operations.[\"/pet/{petId} GET\"]"));
}
}
================================================
FILE: swagger-coverage-commandline/src/test/java/com/github/viclovsky/swagger/coverage/SimpleTest.java
================================================
package com.github.viclovsky.swagger.coverage;
import com.github.viclovsky.swagger.coverage.core.generator.Generator;
import org.hamcrest.io.FileMatchers;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import java.util.Arrays;
import java.util.Collection;
import static com.github.viclovsky.swagger.coverage.SwaggerCoverageConstants.COVERAGE_HTML_REPORT_NAME;
import static com.github.viclovsky.swagger.coverage.SwaggerCoverageConstants.COVERAGE_RESULTS_NAME;
import static java.nio.file.Paths.get;
import static org.hamcrest.MatcherAssert.assertThat;
@RunWith(Parameterized.class)
public class SimpleTest {
private static final String V2_OUTPUT_SWAGGER_COVERAGE_DIR = "v2/swagger-coverage-output";
private static final String V3_OUTPUT_SWAGGER_COVERAGE_DIR = "v3/swagger-coverage-output";
private static final String CONFIGURATION_FILE = "full_configuration.json";
private final Config config;
public SimpleTest(Config config) {
this.config = config;
}
@Parameterized.Parameters()
public static Collection<Object[]> testData() {
return Arrays.asList(new Object[][]{
//Swagger v2
{new Config(CONFIGURATION_FILE, V2_OUTPUT_SWAGGER_COVERAGE_DIR, "v2/petstory.json")},
{new Config(CONFIGURATION_FILE, V2_OUTPUT_SWAGGER_COVERAGE_DIR, "v2/petstory_no_tags.json")},
{new Config(CONFIGURATION_FILE, V2_OUTPUT_SWAGGER_COVERAGE_DIR, "v2/petstory_operation_wo_tags.json")},
{new Config(CONFIGURATION_FILE, V2_OUTPUT_SWAGGER_COVERAGE_DIR, "v2/petstory_with_x_example.json")},
{new Config(CONFIGURATION_FILE, V2_OUTPUT_SWAGGER_COVERAGE_DIR, "v2/petstory_without_parameters.json")},
{new Config(CONFIGURATION_FILE, V2_OUTPUT_SWAGGER_COVERAGE_DIR, "https://petstore.swagger.io/v2/swagger.json")},
//Swagger v3
{new Config(CONFIGURATION_FILE, V3_OUTPUT_SWAGGER_COVERAGE_DIR, "v3/petstory.yaml")},
{new Config(CONFIGURATION_FILE, V3_OUTPUT_SWAGGER_COVERAGE_DIR, "v3/petstory_no_tags.yaml")},
{new Config(CONFIGURATION_FILE, V3_OUTPUT_SWAGGER_COVERAGE_DIR, "v3/petstory_operation_wo_tags.yaml")},
{new Config(CONFIGURATION_FILE, V3_OUTPUT_SWAGGER_COVERAGE_DIR, "v3/petstory_with_x_example.yaml")},
{new Config(CONFIGURATION_FILE, V3_OUTPUT_SWAGGER_COVERAGE_DIR, "v3/petstory_without_parameters.yaml")},
{new Config(CONFIGURATION_FILE, V3_OUTPUT_SWAGGER_COVERAGE_DIR, "https://petstore3.swagger.io/api/v3/openapi.yaml")}
});
}
@Test
public void simpleTest() {
new Generator()
.setInputPath(config.getOutput())
.setSpecPath(config.getSpec())
.run();
assertThat(get(COVERAGE_HTML_REPORT_NAME).toFile(), FileMatchers.anExistingFile());
assertThat(get(COVERAGE_RESULTS_NAME).toFile(), FileMatchers.anExistingFile());
}
@Test
public void simpleTestWithConfiguration() {
new Generator()
.setInputPath(config.getOutput())
.setSpecPath(config.getSpec())
.setConfigurationPath(config.getPath())
.run();
assertThat(get("custom-report.html").toFile(), FileMatchers.anExistingFile());
assertThat(get("json-report.json").toFile(), FileMatchers.anExistingFile());
}
}
================================================
FILE: swagger-coverage-commandline/src/test/resources/configuration.json
================================================
{
"rules" : {
"status": {
"filter": ["200"]
},
"only-declared-status" : {
"enable" : false
},
"empty-required-header" : {
"enable" : false
},
"enum-another-value" : {
"enable" : false
}
},
"writers": {
"html": {
"filename": "custom-report.html",
"locale": "en"
}
}
}
================================================
FILE: swagger-coverage-commandline/src/test/resources/full_configuration.json
================================================
{
"rules": {
"status": {
"filter": [
"200"
],
"ignore": [
"500",
"400",
"404"
]
},
"only-declared-status": {
"enable": true
},
"empty-required-header": {
"enable": true
},
"enum-another-value": {
"enable": true
},
"exclude-deprecated" : {
"enable" : true
}
},
"writers": {
"html": {
"filename": "custom-report.html",
"locale": "en"
},
"json": {
"filename": "json-report.json"
}
}
}
================================================
FILE: swagger-coverage-commandline/src/test/resources/report_custom.ftl
================================================
<#ftl output_format="HTML">
<#global i18=messages>
<#global operationMap=data.flatOperations>
<#-- @ftlvariable ftlvariable name="data" type="com.github.viclovsky.swagger.coverage.model.SwaggerCoverageResults" -->
<head>
<meta charset="utf-8">
<title>Swagger Coverage: CUSTOM_TEST_REPORT</title>
<script src="https://code.jquery.com/jquery-3.4.1.slim.min.js"
integrity="sha384-J6qa4849blE2+poT4WnyKhv5vZF5SrPo0iEjwBvKU7imGFAV0wwj1yYfoRSJoZ+n"
crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js"
integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo"
crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js"
integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6"
crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css"
integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
<script src="https://kit.fontawesome.com/0b83173bdb.js" crossorigin="anonymous"></script>
<style>
.title {
margin-top: 60px;
}
.progress {
position: relative;
}
.progress span {
position: absolute;
display: block;
width: 100%;
color: black;
}
</style>
</head>
<body>
<nav class="navbar navbar-expand-md navbar-dark fixed-top bg-dark">
<div class="container">
<div class="collapse navbar-collapse" id="navbarCollapse">
<a class="navbar-brand" href="#">${data.info.getTitle()!} ${data.info.getVersion()!}</a>
<ul class="navbar-nav mr-auto">
<li class="nav-item">
<a class="nav-link" href="#tag-section">${i18["menu.tags"]}</a>
</li>
</ul>
</div>
</div>
</nav>
<main role="main" class="container">
<div class="container">
<section id="condition-section">
<div class="row">
<div class="accordion col-12" id="conditions-by-type-accordion">
<#list data.conditionStatisticsMap as key, value>
<div class="card">
<div class="card-header">
<div class="row"
data-toggle="collapse"
data-target="#conditions-by-type-${key?index}"
aria-expanded="true"
aria-controls="collapseOne">
<div class="col-8">
<#assign nameKey = "predicate.${key}.name">
<#assign descriptionKey = "predicate.${key}.description">
<p><strong>${i18[nameKey]!nameKey}</strong></p>
<small>${i18[descriptionKey]!descriptionKey}</small>
</div>
</div>
</div>
<div id="conditions-by-type-${key?index}" class="collapse" aria-labelledby="headingOne">
<div class="card-body">
<div class="row">
<div class="col-12">
<div class="tab-content" id="details-content-${key?index}">
<div class="tab-pane fade show active" id="condition-covered-${key?index}" role="tabpanel" aria-labelledby="tab-condition-covered-${key?index}">
<table class="table table-sm">
<thead>
<tr>
<th scope="col">${i18
gitextract_lgq7gab1/
├── .github/
│ ├── CODEOWNERS
│ ├── ISSUE_TEMPLATE.md
│ ├── dependabot.yml
│ ├── release-drafter.yml
│ └── workflows/
│ ├── build.yml
│ ├── gradle-wrapper-validation.yml
│ ├── label-verify.yml
│ ├── release-draft.yml
│ └── release.yml
├── .gitignore
├── LICENSE
├── README.md
├── build.gradle.kts
├── gradle/
│ ├── maven-publish.gradle
│ └── wrapper/
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradle.properties
├── gradlew
├── gradlew.bat
├── jitpack.yml
├── run.sh
├── settings.gradle.kts
├── swagger-coverage-commandline/
│ ├── build.gradle.kts
│ └── src/
│ ├── main/
│ │ ├── java/
│ │ │ └── com/
│ │ │ └── github/
│ │ │ └── viclovsky/
│ │ │ └── swagger/
│ │ │ └── coverage/
│ │ │ ├── CommandLine.java
│ │ │ ├── ExitCode.java
│ │ │ ├── configuration/
│ │ │ │ ├── Configuration.java
│ │ │ │ ├── ConfigurationBuilder.java
│ │ │ │ └── options/
│ │ │ │ ├── ConfigurationOptions.java
│ │ │ │ ├── MainOptions.java
│ │ │ │ ├── ResultsWriterOptions.java
│ │ │ │ └── RuleConfigurationOptions.java
│ │ │ ├── core/
│ │ │ │ ├── generator/
│ │ │ │ │ ├── Generator.java
│ │ │ │ │ ├── OperationConditionGenerator.java
│ │ │ │ │ └── SwaggerSpecificationProcessor.java
│ │ │ │ ├── model/
│ │ │ │ │ ├── Condition.java
│ │ │ │ │ ├── ConditionOperationCoverage.java
│ │ │ │ │ ├── OperationKey.java
│ │ │ │ │ ├── OperationsHolder.java
│ │ │ │ │ └── SinglePredicateCondition.java
│ │ │ │ ├── predicate/
│ │ │ │ │ ├── ConditionPredicate.java
│ │ │ │ │ ├── DefaultBodyConditionPredicate.java
│ │ │ │ │ ├── DefaultParameterConditionPredicate.java
│ │ │ │ │ ├── DefaultParameterValueConditionPredicate.java
│ │ │ │ │ ├── DefaultPropertyConditionPredicate.java
│ │ │ │ │ ├── DefaultStatusConditionPredicate.java
│ │ │ │ │ ├── FullStatusConditionPredicate.java
│ │ │ │ │ ├── NotOnlyParameterListValueConditionPredicate.java
│ │ │ │ │ ├── ParameterConditionPredicate.java
│ │ │ │ │ ├── ParameterUtils.java
│ │ │ │ │ ├── ParameterValueConditionPredicate.java
│ │ │ │ │ ├── PropertyConditionPredicate.java
│ │ │ │ │ ├── PropertyValueConditionPredicate.java
│ │ │ │ │ └── PropertyValueNotOnlyConditionPredicate.java
│ │ │ │ ├── results/
│ │ │ │ │ ├── Results.java
│ │ │ │ │ ├── builder/
│ │ │ │ │ │ ├── core/
│ │ │ │ │ │ │ ├── StatisticsBuilder.java
│ │ │ │ │ │ │ ├── StatisticsOperationPostBuilder.java
│ │ │ │ │ │ │ ├── StatisticsPostBuilder.java
│ │ │ │ │ │ │ └── StatisticsPreBuilder.java
│ │ │ │ │ │ ├── postbuilder/
│ │ │ │ │ │ │ ├── ConditionStatisticsBuilder.java
│ │ │ │ │ │ │ ├── ConfigurationStatisticsBuilder.java
│ │ │ │ │ │ │ ├── FlatOperationBuilder.java
│ │ │ │ │ │ │ ├── SwaggerInfoBuilder.java
│ │ │ │ │ │ │ ├── TagStatisticsBuilder.java
│ │ │ │ │ │ │ └── ZeroCallStatisticsBuilder.java
│ │ │ │ │ │ └── prebuilder/
│ │ │ │ │ │ ├── CoverageStatisticsBuilder.java
│ │ │ │ │ │ └── GenerationStatisticsBuilder.java
│ │ │ │ │ ├── data/
│ │ │ │ │ │ ├── ConditionCounter.java
│ │ │ │ │ │ ├── ConditionStatistics.java
│ │ │ │ │ │ ├── ConditionStatisticsItem.java
│ │ │ │ │ │ ├── CoverageCounter.java
│ │ │ │ │ │ ├── CoverageOperationMap.java
│ │ │ │ │ │ ├── CoverageState.java
│ │ │ │ │ │ ├── GenerationStatistics.java
│ │ │ │ │ │ ├── OperationResult.java
│ │ │ │ │ │ └── TagCoverage.java
│ │ │ │ │ └── util/
│ │ │ │ │ └── DateTimeUtil.java
│ │ │ │ ├── rule/
│ │ │ │ │ ├── body/
│ │ │ │ │ │ ├── NotEmptyBodyRule.java
│ │ │ │ │ │ ├── PropertyConditionRule.java
│ │ │ │ │ │ ├── PropertyEnumAllValuesRule.java
│ │ │ │ │ │ ├── PropertyNotEmptyRule.java
│ │ │ │ │ │ └── PropertyNotOnlyEnumValuesRule.java
│ │ │ │ │ ├── core/
│ │ │ │ │ │ └── ConditionRule.java
│ │ │ │ │ ├── parameter/
│ │ │ │ │ │ ├── EmptyHeaderRule.java
│ │ │ │ │ │ ├── EnumAllValuesRule.java
│ │ │ │ │ │ ├── NotEmptyParameterRule.java
│ │ │ │ │ │ ├── NotOnlyEnumValuesRule.java
│ │ │ │ │ │ └── ParameterConditionRule.java
│ │ │ │ │ └── status/
│ │ │ │ │ ├── HTTPStatusRule.java
│ │ │ │ │ ├── OnlyDeclaredHTTPStatusesRule.java
│ │ │ │ │ └── StatusConditionRule.java
│ │ │ │ └── writer/
│ │ │ │ ├── CoverageResultsWriter.java
│ │ │ │ ├── FileSystemResultsWriter.java
│ │ │ │ ├── HtmlReportResultsWriter.java
│ │ │ │ └── LogResultsWriter.java
│ │ │ └── option/
│ │ │ ├── MainOptions.java
│ │ │ └── VerboseOptions.java
│ │ └── resources/
│ │ └── logback.xml
│ └── test/
│ ├── java/
│ │ └── com/
│ │ └── github/
│ │ └── viclovsky/
│ │ └── swagger/
│ │ └── coverage/
│ │ ├── Config.java
│ │ ├── CustomReportTemplateTest.java
│ │ ├── ParseOptionsTest.java
│ │ └── SimpleTest.java
│ └── resources/
│ ├── configuration.json
│ ├── full_configuration.json
│ ├── report_custom.ftl
│ ├── v2/
│ │ ├── petstory.json
│ │ ├── petstory_no_tags.json
│ │ ├── petstory_operation_wo_tags.json
│ │ ├── petstory_with_x_example.json
│ │ ├── petstory_without_parameters.json
│ │ └── swagger-coverage-output/
│ │ ├── empty_parameters.json
│ │ ├── enum_param_1.json
│ │ ├── enum_param_2.json
│ │ ├── ignore_header.json
│ │ ├── match_pattern.json
│ │ ├── missed_in_swagger.json
│ │ ├── missed_in_swagger_without_x_example.json
│ │ ├── not_200.json
│ │ ├── one_coverage.json
│ │ ├── one_parameter.json
│ │ ├── one_partial_coverage.json
│ │ ├── test_empty_operation.json
│ │ └── two_coverage.json
│ └── v3/
│ ├── operations/
│ │ └── pet_petId.yaml
│ ├── petstory.yaml
│ ├── petstory_no_tags.yaml
│ ├── petstory_operation_wo_tags.yaml
│ ├── petstory_ref_operations.yaml
│ ├── petstory_with_x_example.yaml
│ ├── petstory_without_parameters.yaml
│ └── swagger-coverage-output/
│ ├── empty_parameters.yaml
│ ├── enum_param_1.yaml
│ ├── enum_param_2.yaml
│ ├── ignore_header.yaml
│ ├── match_pattern.yaml
│ ├── missed_in_swagger.yaml
│ ├── missed_in_swagger_without_x_example.yaml
│ ├── not_200.yaml
│ ├── one_coverage.yaml
│ ├── one_parameter.yaml
│ ├── one_partial_coverage.yaml
│ ├── test_empty_operation.yaml
│ └── two_coverage.yaml
├── swagger-coverage-commons/
│ ├── build.gradle.kts
│ └── src/
│ └── main/
│ ├── java/
│ │ └── com/
│ │ └── github/
│ │ └── viclovsky/
│ │ └── swagger/
│ │ └── coverage/
│ │ ├── CoverageOutputReader.java
│ │ ├── CoverageOutputWriter.java
│ │ ├── FileSystemOutputReader.java
│ │ ├── FileSystemOutputWriter.java
│ │ ├── SwaggerCoverageConstants.java
│ │ ├── SwaggerCoverageReadException.java
│ │ ├── SwaggerCoverageUtils.java
│ │ ├── SwaggerCoverageWriteException.java
│ │ ├── model/
│ │ │ └── SwaggerCoverage2ModelJackson.java
│ │ └── utils/
│ │ └── FreemarkerUtils.java
│ └── resources/
│ ├── details/
│ │ ├── condition.ftl
│ │ ├── operation.ftl
│ │ └── tag.ftl
│ ├── message.en
│ ├── message.ru
│ ├── report.ftl
│ ├── sections/
│ │ ├── generation.ftl
│ │ └── summary.ftl
│ └── ui.ftl
├── swagger-coverage-karate/
│ ├── README.md
│ ├── build.gradle.kts
│ └── src/
│ ├── main/
│ │ ├── java/
│ │ │ └── com/
│ │ │ └── github/
│ │ │ └── viclovsky/
│ │ │ └── swagger/
│ │ │ └── coverage/
│ │ │ └── karate/
│ │ │ ├── Request.java
│ │ │ ├── RequestWriter.java
│ │ │ ├── SwaggerCoverageOptions.java
│ │ │ └── SwaggerCoverageRunner.java
│ │ └── resources/
│ │ ├── httpProxy.feature
│ │ └── karate-base.js
│ └── test/
│ ├── java/
│ │ └── com/
│ │ └── github/
│ │ └── viclovsky/
│ │ └── swagger/
│ │ └── coverage/
│ │ └── karate/
│ │ ├── RequestWriterTest.java
│ │ └── SwaggerCoverageRunnerTest.java
│ └── resources/
│ ├── api-test-coverage-v2/
│ │ ├── swagger-coverage-config.json
│ │ └── swagger-specification.json
│ ├── api-test-coverage-v3/
│ │ ├── swagger-coverage-config.json
│ │ └── swagger-specification.yaml
│ ├── petv2.feature
│ ├── petv3.feature
│ ├── request.json
│ └── wiremock/
│ └── __files/
│ ├── openapi.yaml
│ └── swagger.json
└── swagger-coverage-rest-assured/
├── build.gradle.kts
└── src/
├── main/
│ └── java/
│ └── com/
│ └── github/
│ └── viclovsky/
│ └── swagger/
│ └── coverage/
│ ├── SwaggerCoverageRestAssured.java
│ └── SwaggerCoverageV3RestAssured.java
└── test/
└── java/
└── com/
└── github/
└── viclovsky/
└── swagger/
└── coverage/
├── RequestLoggerFilterTest.java
└── RequestLoggerV3FilterTest.java
SYMBOL INDEX (639 symbols across 98 files)
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/CommandLine.java
class CommandLine (line 17) | @Parameters(commandNames = "swagger-coverage", commandDescription = "Swa...
method main (line 29) | public static void main(final String[] argv) {
method parse (line 38) | @SuppressWarnings({"PMD.AvoidLiteralsInIfCondition", "ReturnCount"})
method run (line 56) | private ExitCode run() {
method printUsage (line 83) | private void printUsage(final JCommander commander) {
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/ExitCode.java
type ExitCode (line 3) | public enum ExitCode {
method ExitCode (line 11) | ExitCode(final int code) {
method getCode (line 15) | public int getCode() {
method isSuccess (line 19) | public boolean isSuccess() {
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/configuration/Configuration.java
class Configuration (line 13) | public class Configuration {
method Configuration (line 25) | public Configuration() {
method getRulesList (line 28) | public List<ConditionRule> getRulesList() {
method getStatisticsBuilders (line 39) | public List<StatisticsBuilder> getStatisticsBuilders(OpenAPI specifica...
method enableByRuleOptions (line 52) | protected boolean enableByRuleOptions(String id) {
method setOptions (line 61) | public Configuration setOptions(ConfigurationOptions options) {
method getOption (line 66) | public RuleConfigurationOptions getOption(String optionKey) {
method setDefaultRules (line 70) | public Configuration setDefaultRules(List<ConditionRule> defaultRules) {
method setRegisteredBuilders (line 75) | public Configuration setRegisteredBuilders(List<StatisticsBuilder> reg...
method getConfiguredBuilders (line 80) | public List<StatisticsBuilder> getConfiguredBuilders() {
method setConfiguredBuilders (line 84) | public Configuration setConfiguredBuilders(List<StatisticsBuilder> con...
method getConfiguredResultsWriters (line 89) | public List<CoverageResultsWriter> getConfiguredResultsWriters() {
method setConfiguredResultsWriters (line 93) | public Configuration setConfiguredResultsWriters(List<CoverageResultsW...
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/configuration/ConfigurationBuilder.java
class ConfigurationBuilder (line 37) | public class ConfigurationBuilder {
method build (line 41) | public static Configuration build(Path path) {
method getResultsWriters (line 60) | private static List<CoverageResultsWriter> getResultsWriters(Configura...
method getDefaultList (line 93) | private static List<ConditionRule> getDefaultList() {
method getDefaultBuilderList (line 110) | private static List<StatisticsBuilder> getDefaultBuilderList() {
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/configuration/options/ConfigurationOptions.java
class ConfigurationOptions (line 8) | public class ConfigurationOptions {
method getRules (line 13) | public Map<String, RuleConfigurationOptions> getRules() {
method setRules (line 17) | public ConfigurationOptions setRules(Map<String, RuleConfigurationOpti...
method getWriters (line 22) | public Map<String, ResultsWriterOptions> getWriters() {
method setWriters (line 26) | public ConfigurationOptions setWriters(Map<String, ResultsWriterOption...
method toString (line 31) | @Override
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/configuration/options/MainOptions.java
class MainOptions (line 3) | public class MainOptions {
method toString (line 7) | @Override
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/configuration/options/ResultsWriterOptions.java
class ResultsWriterOptions (line 3) | public class ResultsWriterOptions {
method getFilename (line 9) | public String getFilename() {
method setFilename (line 13) | public ResultsWriterOptions setFilename(String filename) {
method getLocale (line 18) | public String getLocale() {
method setLocale (line 22) | public ResultsWriterOptions setLocale(String locale) {
method toString (line 27) | @Override
method setCustomTemplatePath (line 37) | public ResultsWriterOptions setCustomTemplatePath(String customTemplat...
method getCustomTemplatePath (line 42) | public String getCustomTemplatePath() {
method getNumberFormat (line 46) | public String getNumberFormat() {return numberFormat;}
method setNumberFormat (line 48) | public ResultsWriterOptions setNumberFormat(String numberFormat){
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/configuration/options/RuleConfigurationOptions.java
class RuleConfigurationOptions (line 5) | public class RuleConfigurationOptions {
method isEnable (line 10) | public boolean isEnable() {
method setEnable (line 14) | public RuleConfigurationOptions setEnable(boolean enable) {
method getFilter (line 19) | public List<String> getFilter() {
method setFilter (line 23) | public RuleConfigurationOptions setFilter(List<String> filter) {
method getIgnore (line 28) | public List<String> getIgnore() {
method setIgnore (line 32) | public RuleConfigurationOptions setIgnore(List<String> ignore) {
method toString (line 37) | @Override
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/generator/Generator.java
class Generator (line 22) | public class Generator {
method run (line 37) | public void run() {
method processFile (line 62) | public void processFile(Path path) {
method getSpecPath (line 70) | public URI getSpecPath() {
method setSpecPath (line 74) | public Generator setSpecPath(URI specPath) {
method getSpecAuths (line 79) | public List<AuthorizationValue> getSpecAuths() {
method setSpecAuths (line 83) | public Generator setSpecAuths(List<AuthorizationValue> specAuths) {
method getInputPath (line 88) | public Path getInputPath() {
method setInputPath (line 92) | public Generator setInputPath(Path inputPath) {
method getConfigurationPath (line 97) | public Path getConfigurationPath() {
method setConfigurationPath (line 101) | public Generator setConfigurationPath(Path configurationPath) {
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/generator/OperationConditionGenerator.java
class OperationConditionGenerator (line 19) | public class OperationConditionGenerator {
method getOperationMap (line 23) | public static Map<OperationKey, ConditionOperationCoverage> getOperati...
method buildConditionOperationCoverage (line 36) | private static ConditionOperationCoverage buildConditionOperationCover...
method generateConditionList (line 44) | private static List<Condition> generateConditionList(Operation operati...
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/generator/SwaggerSpecificationProcessor.java
class SwaggerSpecificationProcessor (line 14) | public class SwaggerSpecificationProcessor {
method extractOperation (line 18) | public static OperationsHolder extractOperation(OpenAPI swagger) {
method extractValue (line 28) | public static String extractValue(Parameter p) {
method extractValue (line 38) | public static String extractValue(Schema schema) {
method extractEnum (line 49) | public static List<String> extractEnum(Parameter p) {
method extractEnum (line 53) | public static List<String> extractEnum(Schema schema) {
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/model/Condition.java
class Condition (line 5) | public abstract class Condition {
method Condition (line 11) | public Condition(String name, String description) {
method postCheck (line 16) | public abstract void postCheck();
method isHasPostCheck (line 18) | public abstract boolean isHasPostCheck();
method isNeedCheck (line 20) | public abstract boolean isNeedCheck();
method check (line 22) | public abstract boolean check(Operation operation);
method getReason (line 24) | public abstract String getReason();
method getType (line 26) | public abstract String getType();
method getName (line 28) | public String getName() {
method setName (line 32) | public void setName(String name) {
method getDescription (line 36) | public String getDescription() {
method setDescription (line 40) | public void setDescription(String description) {
method isCovered (line 44) | public boolean isCovered() {
method setCovered (line 48) | public void setCovered(boolean covered) {
method toString (line 52) | @Override
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/model/ConditionOperationCoverage.java
class ConditionOperationCoverage (line 7) | public class ConditionOperationCoverage {
method getOperation (line 13) | public Operation getOperation() {
method setOperation (line 17) | public ConditionOperationCoverage setOperation(Operation operation) {
method getConditions (line 22) | public List<Condition> getConditions() {
method setConditions (line 26) | public ConditionOperationCoverage setConditions(List<Condition> condit...
method getProcessCount (line 31) | public long getProcessCount() {
method setProcessCount (line 35) | public ConditionOperationCoverage setProcessCount(long processCount) {
method increaseProcessCount (line 40) | public ConditionOperationCoverage increaseProcessCount() {
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/model/OperationKey.java
class OperationKey (line 5) | public class OperationKey implements Comparable {
method toString (line 10) | @Override
method getPath (line 15) | public String getPath() {
method setPath (line 19) | public OperationKey setPath(String path) {
method getHttpMethod (line 24) | public PathItem.HttpMethod getHttpMethod() {
method setHttpMethod (line 28) | public OperationKey setHttpMethod(PathItem.HttpMethod httpMethod) {
method compareTo (line 33) | @Override
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/model/OperationsHolder.java
class OperationsHolder (line 8) | public class OperationsHolder {
method getOperations (line 12) | public Map<OperationKey, Operation> getOperations() {
method setOperations (line 16) | public OperationsHolder setOperations(Map<OperationKey, Operation> ope...
method addOperation (line 21) | public OperationsHolder addOperation(OperationKey operationKey, Operat...
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/model/SinglePredicateCondition.java
class SinglePredicateCondition (line 8) | public class SinglePredicateCondition extends Condition {
method SinglePredicateCondition (line 14) | public SinglePredicateCondition(String name, String description) {
method SinglePredicateCondition (line 18) | public SinglePredicateCondition(String name, String description, Condi...
method postCheck (line 23) | @Override
method isHasPostCheck (line 28) | @Override
method isNeedCheck (line 33) | @Override
method check (line 38) | @Override
method getReason (line 44) | @Override
method getType (line 53) | @Override
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/predicate/ConditionPredicate.java
class ConditionPredicate (line 5) | public abstract class ConditionPredicate {
method check (line 7) | public abstract boolean check(Operation operation);
method postCheck (line 9) | public abstract boolean postCheck();
method hasPostCheck (line 11) | public abstract boolean hasPostCheck();
method getReason (line 13) | public abstract String getReason();
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/predicate/DefaultBodyConditionPredicate.java
class DefaultBodyConditionPredicate (line 5) | public class DefaultBodyConditionPredicate extends ConditionPredicate {
method check (line 7) | @Override
method postCheck (line 16) | @Override
method hasPostCheck (line 21) | @Override
method getReason (line 26) | @Override
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/predicate/DefaultParameterConditionPredicate.java
class DefaultParameterConditionPredicate (line 10) | public class DefaultParameterConditionPredicate extends ParameterConditi...
method DefaultParameterConditionPredicate (line 16) | public DefaultParameterConditionPredicate(boolean isEmpty, String name...
method check (line 22) | @Override
method postCheck (line 31) | @Override
method hasPostCheck (line 36) | @Override
method getReason (line 41) | @Override
method isEmpty (line 46) | public boolean isEmpty() {
method setEmpty (line 50) | public void setEmpty(boolean empty) {
method getName (line 54) | public String getName() {
method setParamName (line 58) | public void setParamName(String paramName) {
method toString (line 62) | @Override
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/predicate/DefaultParameterValueConditionPredicate.java
class DefaultParameterValueConditionPredicate (line 12) | public class DefaultParameterValueConditionPredicate extends ParameterCo...
method DefaultParameterValueConditionPredicate (line 21) | public DefaultParameterValueConditionPredicate(String name, String in,...
method check (line 27) | @Override
method postCheck (line 41) | @Override
method hasPostCheck (line 46) | @Override
method getReason (line 51) | @Override
method getName (line 56) | public String getName() {
method setName (line 60) | public DefaultParameterValueConditionPredicate setName(String name) {
method getValue (line 65) | public String getValue() {
method setValue (line 69) | public DefaultParameterValueConditionPredicate setValue(String value) {
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/predicate/DefaultPropertyConditionPredicate.java
class DefaultPropertyConditionPredicate (line 7) | public class DefaultPropertyConditionPredicate extends PropertyCondition...
method DefaultPropertyConditionPredicate (line 11) | public DefaultPropertyConditionPredicate(String mediaTypeName, String ...
method postCheck (line 16) | @Override
method hasPostCheck (line 21) | @Override
method getReason (line 26) | @Override
method isEmpty (line 31) | public boolean isEmpty() {
method check (line 35) | @Override
method setPropertyName (line 40) | @Override
method setMediaTypeName (line 45) | @Override
method setEmpty (line 50) | DefaultPropertyConditionPredicate setEmpty(boolean isEmpty) {
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/predicate/DefaultStatusConditionPredicate.java
class DefaultStatusConditionPredicate (line 9) | public class DefaultStatusConditionPredicate extends ParameterConditionP...
method DefaultStatusConditionPredicate (line 13) | public DefaultStatusConditionPredicate(String statusCode) {
method check (line 17) | @Override
method postCheck (line 22) | @Override
method hasPostCheck (line 27) | @Override
method getReason (line 32) | @Override
method getStatusCode (line 37) | public String getStatusCode() {
method setStatusCode (line 41) | public void setStatusCode(String statusCode) {
method toString (line 45) | @Override
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/predicate/FullStatusConditionPredicate.java
class FullStatusConditionPredicate (line 11) | public class FullStatusConditionPredicate extends ParameterConditionPred...
method FullStatusConditionPredicate (line 17) | public FullStatusConditionPredicate(Set<String> expectedStatuses) {
method check (line 21) | @Override
method postCheck (line 27) | @Override
method hasPostCheck (line 43) | @Override
method getReason (line 48) | @Override
method getExpectedStatuses (line 53) | public Set<String> getExpectedStatuses() {
method setExpectedStatuses (line 57) | public FullStatusConditionPredicate setExpectedStatuses(Set<String> ex...
method getCurrentStatuses (line 62) | public Set<String> getCurrentStatuses() {
method setCurrentStatuses (line 66) | public FullStatusConditionPredicate setCurrentStatuses(Set<String> cur...
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/predicate/NotOnlyParameterListValueConditionPredicate.java
class NotOnlyParameterListValueConditionPredicate (line 13) | public class NotOnlyParameterListValueConditionPredicate extends Paramet...
method NotOnlyParameterListValueConditionPredicate (line 21) | public NotOnlyParameterListValueConditionPredicate(String name, String...
method check (line 28) | @Override
method postCheck (line 41) | @Override
method hasPostCheck (line 48) | @Override
method getReason (line 53) | @Override
method getName (line 58) | public String getName() {
method setName (line 62) | public NotOnlyParameterListValueConditionPredicate setName(String name) {
method getValue (line 67) | public Set<String> getValue() {
method setValue (line 71) | public NotOnlyParameterListValueConditionPredicate setValue(Set<String...
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/predicate/ParameterConditionPredicate.java
class ParameterConditionPredicate (line 10) | public abstract class ParameterConditionPredicate extends ConditionPredi...
method check (line 12) | @Override
method check (line 17) | public abstract boolean check(List<Parameter> params, Map<String, ApiR...
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/predicate/ParameterUtils.java
class ParameterUtils (line 7) | class ParameterUtils {
method ParameterUtils (line 9) | private ParameterUtils() {
method equalsParam (line 12) | static Predicate<Parameter> equalsParam(String name, String in) {
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/predicate/ParameterValueConditionPredicate.java
class ParameterValueConditionPredicate (line 12) | public class ParameterValueConditionPredicate extends ParameterCondition...
method ParameterValueConditionPredicate (line 20) | public ParameterValueConditionPredicate(String name, String in, List<S...
method check (line 26) | @Override
method postCheck (line 39) | @Override
method hasPostCheck (line 51) | @Override
method getReason (line 56) | @Override
method getName (line 61) | public String getName() {
method setName (line 65) | public ParameterValueConditionPredicate setName(String name) {
method getValue (line 70) | public List<String> getValue() {
method setValue (line 74) | public ParameterValueConditionPredicate setValue(List<String> value) {
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/predicate/PropertyConditionPredicate.java
class PropertyConditionPredicate (line 11) | public abstract class PropertyConditionPredicate extends ConditionPredic...
method PropertyConditionPredicate (line 15) | public PropertyConditionPredicate(String mediaTypeName, String propert...
method check (line 20) | @Override
method getPropertyName (line 39) | public String getPropertyName() {
method getMediaTypeName (line 43) | public String getMediaTypeName() {
method setPropertyName (line 47) | public PropertyConditionPredicate setPropertyName(String propertyName) {
method setMediaTypeName (line 52) | public PropertyConditionPredicate setMediaTypeName(String mediaTypeNam...
method check (line 57) | protected abstract boolean check(Optional<Schema> schema);
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/predicate/PropertyValueConditionPredicate.java
class PropertyValueConditionPredicate (line 10) | public class PropertyValueConditionPredicate extends PropertyConditionPr...
method PropertyValueConditionPredicate (line 16) | public PropertyValueConditionPredicate(String mediaTypeName, String pr...
method postCheck (line 21) | @Override
method hasPostCheck (line 28) | @Override
method getReason (line 33) | @Override
method check (line 38) | @Override
method getValue (line 46) | public List<String> getValue() {
method setPropertyName (line 50) | @Override
method setMediaTypeName (line 55) | @Override
method setValue (line 60) | public PropertyValueConditionPredicate setValue(List<String> value) {
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/predicate/PropertyValueNotOnlyConditionPredicate.java
class PropertyValueNotOnlyConditionPredicate (line 10) | public class PropertyValueNotOnlyConditionPredicate extends PropertyCond...
method PropertyValueNotOnlyConditionPredicate (line 16) | public PropertyValueNotOnlyConditionPredicate(String mediaTypeName, St...
method postCheck (line 21) | @Override
method hasPostCheck (line 33) | @Override
method getReason (line 38) | @Override
method check (line 43) | @Override
method getValue (line 51) | public List<String> getValue() {
method setPropertyName (line 55) | @Override
method setMediaTypeName (line 60) | @Override
method setValue (line 65) | public PropertyValueNotOnlyConditionPredicate setValue(List<String> va...
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/results/Results.java
class Results (line 20) | public class Results {
method Results (line 45) | public Results() {
method getOperations (line 49) | public Map<OperationKey, OperationResult> getOperations() {
method setOperations (line 53) | public Results setOperations(Map<OperationKey, OperationResult> operat...
method getZeroCall (line 58) | public Set<OperationKey> getZeroCall() {
method setZeroCall (line 62) | public Results setZeroCall(Set<OperationKey> zeroCall) {
method getMissed (line 67) | public Map<OperationKey, Operation> getMissed() {
method setMissed (line 71) | public Results setMissed(Map<OperationKey, Operation> missed) {
method setDeprecated (line 76) | public Results setDeprecated(Map<OperationKey, Operation> deprecated) {
method getDeprecated (line 81) | public Map<OperationKey, Operation> getDeprecated() {
method getGenerationStatistics (line 85) | public GenerationStatistics getGenerationStatistics() {
method setGenerationStatistics (line 89) | public Results setGenerationStatistics(GenerationStatistics generation...
method getConditionCounter (line 94) | public ConditionCounter getConditionCounter() {
method setConditionCounter (line 98) | public Results setConditionCounter(ConditionCounter conditionCounter) {
method getConditionStatisticsMap (line 103) | public Map<String, ConditionStatistics> getConditionStatisticsMap() {
method setConditionStatisticsMap (line 107) | public Results setConditionStatisticsMap(Map<String, ConditionStatisti...
method getCoverageOperationMap (line 112) | public CoverageOperationMap getCoverageOperationMap() {
method setCoverageOperationMap (line 116) | public Results setCoverageOperationMap(CoverageOperationMap coverageOp...
method getTagCoverageMap (line 121) | public Map<String, TagCoverage> getTagCoverageMap() {
method setTagCoverageMap (line 125) | public Results setTagCoverageMap(Map<String, TagCoverage> tagCoverageM...
method getTagCounter (line 130) | public CoverageCounter getTagCounter() {
method setTagCounter (line 134) | public Results setTagCounter(CoverageCounter tagCounter) {
method getPrettyConfiguration (line 139) | public String getPrettyConfiguration() {
method setPrettyConfiguration (line 143) | public Results setPrettyConfiguration(String prettyConfiguration) {
method getFlatOperations (line 148) | public Map<String, OperationResult> getFlatOperations() {
method setFlatOperations (line 152) | public Results setFlatOperations(Map<String, OperationResult> flatOper...
method getInfo (line 157) | public Info getInfo() {
method setInfo (line 161) | public Results setInfo(Info info) {
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/results/builder/core/StatisticsBuilder.java
class StatisticsBuilder (line 11) | public abstract class StatisticsBuilder {
method add (line 15) | public StatisticsBuilder add(String path) {
method add (line 19) | public StatisticsBuilder add(OpenAPI swagger) {
method configure (line 23) | public StatisticsBuilder configure(ConfigurationOptions options) {
method configure (line 28) | public abstract StatisticsBuilder configure(OpenAPI swagger, List<Cond...
method build (line 30) | public abstract void build(Results results, Configuration configuration);
method isPreBuilder (line 32) | public abstract boolean isPreBuilder();
method isPostBuilder (line 34) | public abstract boolean isPostBuilder();
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/results/builder/core/StatisticsOperationPostBuilder.java
class StatisticsOperationPostBuilder (line 12) | public abstract class StatisticsOperationPostBuilder extends StatisticsP...
method configure (line 14) | @Override
method build (line 19) | @Override
method buildOperation (line 25) | public abstract void buildOperation(OperationKey operation, OperationR...
method buildResult (line 27) | public abstract void buildResult(Results results);
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/results/builder/core/StatisticsPostBuilder.java
class StatisticsPostBuilder (line 3) | public abstract class StatisticsPostBuilder extends StatisticsBuilder {
method StatisticsPostBuilder (line 5) | public StatisticsPostBuilder() {
method isPreBuilder (line 9) | @Override
method isPostBuilder (line 14) | @Override
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/results/builder/core/StatisticsPreBuilder.java
class StatisticsPreBuilder (line 3) | public abstract class StatisticsPreBuilder extends StatisticsBuilder {
method isPreBuilder (line 5) | @Override
method isPostBuilder (line 10) | @Override
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/results/builder/postbuilder/ConditionStatisticsBuilder.java
class ConditionStatisticsBuilder (line 11) | public class ConditionStatisticsBuilder extends StatisticsOperationPostB...
method buildResult (line 16) | @Override
method buildOperation (line 22) | @Override
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/results/builder/postbuilder/ConfigurationStatisticsBuilder.java
class ConfigurationStatisticsBuilder (line 16) | public class ConfigurationStatisticsBuilder extends StatisticsPostBuilder {
method configure (line 20) | @Override
method build (line 25) | @Override
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/results/builder/postbuilder/FlatOperationBuilder.java
class FlatOperationBuilder (line 11) | public class FlatOperationBuilder extends StatisticsOperationPostBuilder {
method buildOperation (line 12) | @Override
method buildResult (line 17) | @Override
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/results/builder/postbuilder/SwaggerInfoBuilder.java
class SwaggerInfoBuilder (line 13) | public class SwaggerInfoBuilder extends StatisticsOperationPostBuilder {
method configure (line 17) | @Override
method buildOperation (line 23) | @Override
method buildResult (line 28) | @Override
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/results/builder/postbuilder/TagStatisticsBuilder.java
class TagStatisticsBuilder (line 24) | public class TagStatisticsBuilder extends StatisticsOperationPostBuilder {
method configure (line 33) | @Override
method buildOperation (line 55) | @Override
method buildResult (line 72) | @Override
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/results/builder/postbuilder/ZeroCallStatisticsBuilder.java
class ZeroCallStatisticsBuilder (line 11) | public class ZeroCallStatisticsBuilder extends StatisticsOperationPostBu...
method buildOperation (line 15) | @Override
method buildResult (line 22) | @Override
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/results/builder/prebuilder/CoverageStatisticsBuilder.java
class CoverageStatisticsBuilder (line 28) | public class CoverageStatisticsBuilder extends StatisticsPreBuilder {
method configure (line 35) | @Override
method add (line 41) | @Override
method equalsOperationKeys (line 66) | private static Predicate<OperationKey> equalsOperationKeys(OperationKe...
method build (line 71) | @Override
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/results/builder/prebuilder/GenerationStatisticsBuilder.java
class GenerationStatisticsBuilder (line 23) | public class GenerationStatisticsBuilder extends StatisticsPreBuilder {
method configure (line 31) | @Override
method add (line 37) | @Override
method build (line 57) | @Override
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/results/data/ConditionCounter.java
class ConditionCounter (line 3) | public class ConditionCounter {
method updateAll (line 10) | public ConditionCounter updateAll(long count) {
method updateCovered (line 15) | public ConditionCounter updateCovered(long count) {
method incrementDeprecated (line 20) | public ConditionCounter incrementDeprecated() {
method incrementDeprecatedAndEmpty (line 25) | public ConditionCounter incrementDeprecatedAndEmpty() {
method getAll (line 30) | public long getAll() {
method setAll (line 34) | public ConditionCounter setAll(long all) {
method getCovered (line 39) | public long getCovered() {
method setCovered (line 43) | public ConditionCounter setCovered(long covered) {
method getDeprecated (line 48) | public long getDeprecated() {
method setDeprecated (line 52) | public void setDeprecated(long deprecated) {
method getDeprecatedAndEmpty (line 56) | public long getDeprecatedAndEmpty() {
method setDeprecatedAndEmpty (line 60) | public void setDeprecatedAndEmpty(long deprecatedAndEmpty) {
method toString (line 64) | @Override
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/results/data/ConditionStatistics.java
class ConditionStatistics (line 9) | public class ConditionStatistics {
method getAllCount (line 18) | public long getAllCount() {
method setAllCount (line 22) | public ConditionStatistics setAllCount(long allCount) {
method getCoveredCount (line 27) | public long getCoveredCount() {
method setCoveredCount (line 31) | public ConditionStatistics setCoveredCount(long coveredCount) {
method getUncoveredCount (line 36) | public long getUncoveredCount() {
method setUncoveredCount (line 40) | public ConditionStatistics setUncoveredCount(long uncoveredCount) {
method getCoveredOperation (line 45) | public List<ConditionStatisticsItem> getCoveredOperation() {
method setCoveredOperation (line 49) | public ConditionStatistics setCoveredOperation(List<ConditionStatistic...
method getUncoveredOperation (line 54) | public List<ConditionStatisticsItem> getUncoveredOperation() {
method setUncoveredOperation (line 58) | public ConditionStatistics setUncoveredOperation(List<ConditionStatist...
method processCondition (line 63) | public ConditionStatistics processCondition(OperationKey operation, Co...
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/results/data/ConditionStatisticsItem.java
class ConditionStatisticsItem (line 6) | public class ConditionStatisticsItem {
method ConditionStatisticsItem (line 11) | public ConditionStatisticsItem(OperationKey operation, Condition condi...
method getOperation (line 16) | public OperationKey getOperation() {
method setOperation (line 20) | public ConditionStatisticsItem setOperation(OperationKey operation) {
method getCondition (line 25) | public Condition getCondition() {
method setCondition (line 29) | public ConditionStatisticsItem setCondition(Condition condition) {
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/results/data/CoverageCounter.java
class CoverageCounter (line 3) | public class CoverageCounter {
method incrementByState (line 10) | public CoverageCounter incrementByState(CoverageState state) {
method incrementFull (line 22) | public CoverageCounter incrementFull() {
method incrementParty (line 29) | public CoverageCounter incrementParty() {
method incrementEmpty (line 36) | public CoverageCounter incrementEmpty() {
method incrementDeprecated (line 43) | public CoverageCounter incrementDeprecated() {
method getAll (line 49) | public long getAll() {
method setAll (line 53) | public CoverageCounter setAll(long all) {
method getFull (line 58) | public long getFull() {
method setFull (line 62) | public CoverageCounter setFull(long full) {
method getParty (line 67) | public long getParty() {
method setParty (line 71) | public CoverageCounter setParty(long party) {
method getEmpty (line 76) | public long getEmpty() {
method setEmpty (line 80) | public CoverageCounter setEmpty(long empty) {
method getDeprecated (line 85) | public long getDeprecated() {
method setDeprecated (line 89) | public CoverageCounter setDeprecated(long deprecated) {
method toString (line 94) | @Override
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/results/data/CoverageOperationMap.java
class CoverageOperationMap (line 8) | public class CoverageOperationMap {
method addFull (line 16) | public CoverageOperationMap addFull(OperationKey operation) {
method addParty (line 22) | public CoverageOperationMap addParty(OperationKey operation) {
method addEmpty (line 28) | public CoverageOperationMap addEmpty(OperationKey operation) {
method addDeprecated (line 34) | public CoverageOperationMap addDeprecated(OperationKey operation) {
method getFull (line 40) | public Set<OperationKey> getFull() {
method setFull (line 44) | public CoverageOperationMap setFull(Set<OperationKey> full) {
method getParty (line 49) | public Set<OperationKey> getParty() {
method setParty (line 53) | public CoverageOperationMap setParty(Set<OperationKey> party) {
method getEmpty (line 58) | public Set<OperationKey> getEmpty() {
method setEmpty (line 62) | public CoverageOperationMap setEmpty(Set<OperationKey> empty) {
method getDeprecated (line 67) | public Set<OperationKey> getDeprecated() {
method setDeprecated (line 71) | public CoverageOperationMap setDeprecated(Set<OperationKey> deprecated) {
method getCounter (line 76) | public CoverageCounter getCounter() {
method setCounter (line 80) | public CoverageOperationMap setCounter(CoverageCounter counter) {
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/results/data/CoverageState.java
type CoverageState (line 3) | public enum CoverageState {
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/results/data/GenerationStatistics.java
class GenerationStatistics (line 3) | public class GenerationStatistics {
method GenerationStatistics (line 10) | public GenerationStatistics() {
method getResultFileCount (line 13) | public long getResultFileCount() {
method setResultFileCount (line 17) | public GenerationStatistics setResultFileCount(long resultFileCount) {
method getGenerationTime (line 22) | public long getGenerationTime() {
method setGenerationTime (line 26) | public GenerationStatistics setGenerationTime(long generationTime) {
method getFileResultDateInterval (line 31) | public String getFileResultDateInterval() {
method setFileResultDateInterval (line 35) | public GenerationStatistics setFileResultDateInterval(String fileResul...
method getGenerateDate (line 40) | public String getGenerateDate() {
method setGenerateDate (line 44) | public GenerationStatistics setGenerateDate(String generateDate) {
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/results/data/OperationResult.java
class OperationResult (line 9) | public class OperationResult {
method OperationResult (line 21) | public OperationResult(Configuration configuration, List<Condition> co...
method getAllConditionCount (line 46) | public long getAllConditionCount() {
method setAllConditionCount (line 50) | public OperationResult setAllConditionCount(long allConditionCount) {
method getCoveredConditionCount (line 55) | public long getCoveredConditionCount() {
method setCoveredConditionCount (line 59) | public OperationResult setCoveredConditionCount(long coveredConditionC...
method getProcessCount (line 64) | public long getProcessCount() {
method setProcessCount (line 68) | public OperationResult setProcessCount(long processCount) {
method getDescription (line 73) | public String getDescription() {
method setDescription (line 80) | public OperationResult setDescription(String description) {
method getState (line 85) | public CoverageState getState() {
method setState (line 89) | public OperationResult setState(CoverageState state) {
method getOperationKey (line 94) | public OperationKey getOperationKey() {
method setOperationKey (line 98) | public OperationResult setOperationKey(OperationKey operationKey) {
method getConditions (line 103) | public List<Condition> getConditions() {
method setConditions (line 107) | public void setConditions(List<Condition> conditions) {
method getDeprecated (line 111) | public boolean getDeprecated() {
method setDeprecated (line 115) | public void setDeprecated(boolean isDeprecated) {
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/results/data/TagCoverage.java
class TagCoverage (line 9) | public class TagCoverage {
method TagCoverage (line 18) | public TagCoverage(Tag tag) {
method updateState (line 22) | public TagCoverage updateState() {
method addOperation (line 36) | public TagCoverage addOperation(OperationKey operation) {
method updateCallCount (line 41) | public TagCoverage updateCallCount(long callCounts) {
method incrementByState (line 46) | public TagCoverage incrementByState(CoverageState state) {
method updateAllConditionCount (line 51) | public TagCoverage updateAllConditionCount(long count) {
method updateCoveredConditionCount (line 56) | public TagCoverage updateCoveredConditionCount(long count) {
method getTag (line 61) | public Tag getTag() {
method setTag (line 65) | public TagCoverage setTag(Tag tag) {
method getCoverageCounter (line 70) | public CoverageCounter getCoverageCounter() {
method setCoverageCounter (line 74) | public TagCoverage setCoverageCounter(CoverageCounter coverageCounter) {
method getOperations (line 79) | public Set<OperationKey> getOperations() {
method setOperations (line 83) | public TagCoverage setOperations(Set<OperationKey> operations) {
method getConditionCounter (line 88) | public ConditionCounter getConditionCounter() {
method setConditionCounter (line 92) | public TagCoverage setConditionCounter(ConditionCounter conditionCount...
method getCallCounts (line 97) | public long getCallCounts() {
method setCallCounts (line 101) | public TagCoverage setCallCounts(long callCounts) {
method getState (line 106) | public CoverageState getState() {
method setState (line 110) | public TagCoverage setState(CoverageState state) {
method toString (line 115) | @Override
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/results/util/DateTimeUtil.java
class DateTimeUtil (line 8) | public class DateTimeUtil {
method formatDate (line 14) | public static String formatDate(Instant instant) {
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/rule/body/NotEmptyBodyRule.java
class NotEmptyBodyRule (line 12) | public class NotEmptyBodyRule extends ConditionRule {
method createCondition (line 14) | @Override
method getId (line 29) | @Override
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/rule/body/PropertyConditionRule.java
class PropertyConditionRule (line 18) | public abstract class PropertyConditionRule extends ConditionRule {
method createCondition (line 20) | public List<Condition> createCondition(Operation operation) {
method processMediaType (line 31) | private Stream<Condition> processMediaType(String mediaTypeName, Media...
method processProperty (line 42) | protected abstract Condition processProperty(String mediaTypeName, Str...
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/rule/body/PropertyEnumAllValuesRule.java
class PropertyEnumAllValuesRule (line 11) | public class PropertyEnumAllValuesRule extends PropertyConditionRule {
method processProperty (line 13) | @Override
method getId (line 27) | @Override
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/rule/body/PropertyNotEmptyRule.java
class PropertyNotEmptyRule (line 8) | public class PropertyNotEmptyRule extends PropertyConditionRule {
method processProperty (line 10) | @Override
method getId (line 22) | @Override
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/rule/body/PropertyNotOnlyEnumValuesRule.java
class PropertyNotOnlyEnumValuesRule (line 11) | public class PropertyNotOnlyEnumValuesRule extends PropertyConditionRule {
method processProperty (line 13) | @Override
method getId (line 27) | @Override
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/rule/core/ConditionRule.java
class ConditionRule (line 9) | public abstract class ConditionRule {
method getId (line 12) | public abstract String getId();
method createCondition (line 14) | public abstract List<Condition> createCondition(Operation operation);
method configure (line 16) | public ConditionRule configure(RuleConfigurationOptions options) {
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/rule/parameter/EmptyHeaderRule.java
class EmptyHeaderRule (line 10) | public class EmptyHeaderRule extends ParameterConditionRule {
method processParameter (line 12) | @Override
method getId (line 26) | @Override
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/rule/parameter/EnumAllValuesRule.java
class EnumAllValuesRule (line 12) | public class EnumAllValuesRule extends ParameterConditionRule {
method processParameter (line 14) | @Override
method getId (line 30) | @Override
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/rule/parameter/NotEmptyParameterRule.java
class NotEmptyParameterRule (line 9) | public class NotEmptyParameterRule extends ParameterConditionRule {
method processParameter (line 11) | @Override
method getId (line 21) | @Override
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/rule/parameter/NotOnlyEnumValuesRule.java
class NotOnlyEnumValuesRule (line 12) | public class NotOnlyEnumValuesRule extends ParameterConditionRule {
method processParameter (line 14) | @Override
method getId (line 33) | @Override
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/rule/parameter/ParameterConditionRule.java
class ParameterConditionRule (line 12) | public abstract class ParameterConditionRule extends ConditionRule {
method processParameter (line 14) | public abstract Condition processParameter(Parameter parameter);
method createCondition (line 16) | public List<Condition> createCondition(Operation operation) {
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/rule/status/HTTPStatusRule.java
class HTTPStatusRule (line 8) | public class HTTPStatusRule extends StatusConditionRule {
method getId (line 10) | @Override
method processStatus (line 15) | @Override
method skip (line 29) | protected boolean skip(String status) {
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/rule/status/OnlyDeclaredHTTPStatusesRule.java
class OnlyDeclaredHTTPStatusesRule (line 13) | public class OnlyDeclaredHTTPStatusesRule extends ConditionRule {
method getId (line 14) | @Override
method createCondition (line 19) | @Override
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/rule/status/StatusConditionRule.java
class StatusConditionRule (line 15) | public abstract class StatusConditionRule extends ConditionRule {
method processStatus (line 17) | public abstract Condition processStatus(String statusCode);
method createCondition (line 19) | public List<Condition> createCondition(Operation operation) {
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/writer/CoverageResultsWriter.java
type CoverageResultsWriter (line 5) | public interface CoverageResultsWriter {
method write (line 6) | void write(Results results);
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/writer/FileSystemResultsWriter.java
class FileSystemResultsWriter (line 18) | public class FileSystemResultsWriter implements CoverageResultsWriter {
method FileSystemResultsWriter (line 24) | public FileSystemResultsWriter() {
method FileSystemResultsWriter (line 28) | public FileSystemResultsWriter(String fileName) {
method write (line 33) | @Override
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/writer/HtmlReportResultsWriter.java
class HtmlReportResultsWriter (line 18) | public class HtmlReportResultsWriter implements CoverageResultsWriter {
method HtmlReportResultsWriter (line 28) | public HtmlReportResultsWriter() {
method HtmlReportResultsWriter (line 35) | public HtmlReportResultsWriter(ResultsWriterOptions options){
method write (line 51) | @Override
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/writer/LogResultsWriter.java
class LogResultsWriter (line 14) | public class LogResultsWriter implements CoverageResultsWriter {
method LogResultsWriter (line 18) | public LogResultsWriter() {
method write (line 21) | @Override
method logMissedCoverage (line 46) | private void logMissedCoverage(Map<OperationKey, Operation> missed) {
method logOperationCoverage (line 54) | private void logOperationCoverage(Map<OperationKey, OperationResult> o...
method printOperationCoverage (line 62) | private void printOperationCoverage(OperationResult result) {
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/option/MainOptions.java
class MainOptions (line 8) | public class MainOptions {
method isHelp (line 41) | public boolean isHelp() {
method getSpecPath (line 45) | public URI getSpecPath() {
method getInputPath (line 49) | public Path getInputPath() {
method getConfiguration (line 53) | public Path getConfiguration() {
FILE: swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/option/VerboseOptions.java
class VerboseOptions (line 5) | public class VerboseOptions {
method isQuiet (line 22) | public boolean isQuiet() {
method isVerbose (line 29) | public boolean isVerbose() {
FILE: swagger-coverage-commandline/src/test/java/com/github/viclovsky/swagger/coverage/Config.java
class Config (line 9) | public class Config {
method Config (line 14) | public Config(String path, String outputPath, String specPath) {
method getPath (line 20) | public Path getPath() {
method getOutput (line 24) | public Path getOutput() {
method getSpec (line 28) | public URI getSpec() {
method getFile (line 32) | private File getFile(String name) {
FILE: swagger-coverage-commandline/src/test/java/com/github/viclovsky/swagger/coverage/CustomReportTemplateTest.java
class CustomReportTemplateTest (line 29) | @RunWith(Parameterized.class)
method CustomReportTemplateTest (line 34) | public CustomReportTemplateTest(String outputPath, String specPath ) {
method generateConfigurationFile (line 39) | private File generateConfigurationFile() throws URISyntaxException, IO...
method testWithCustomTemplate (line 56) | @Test
method testData (line 74) | @Parameterized.Parameters()
FILE: swagger-coverage-commandline/src/test/java/com/github/viclovsky/swagger/coverage/ParseOptionsTest.java
class ParseOptionsTest (line 10) | public class ParseOptionsTest {
method resolveOptionTest (line 14) | @Test
FILE: swagger-coverage-commandline/src/test/java/com/github/viclovsky/swagger/coverage/SimpleTest.java
class SimpleTest (line 17) | @RunWith(Parameterized.class)
method SimpleTest (line 25) | public SimpleTest(Config config) {
method testData (line 29) | @Parameterized.Parameters()
method simpleTest (line 49) | @Test
method simpleTestWithConfiguration (line 60) | @Test
FILE: swagger-coverage-commons/src/main/java/com/github/viclovsky/swagger/coverage/CoverageOutputReader.java
type CoverageOutputReader (line 6) | public interface CoverageOutputReader {
method getOutputs (line 8) | Set<Path> getOutputs();
FILE: swagger-coverage-commons/src/main/java/com/github/viclovsky/swagger/coverage/CoverageOutputWriter.java
type CoverageOutputWriter (line 6) | public interface CoverageOutputWriter {
method write (line 8) | void write(Swagger swagger);
method write (line 10) | void write(OpenAPI openAPI);
FILE: swagger-coverage-commons/src/main/java/com/github/viclovsky/swagger/coverage/FileSystemOutputReader.java
class FileSystemOutputReader (line 10) | public class FileSystemOutputReader implements CoverageOutputReader {
method FileSystemOutputReader (line 14) | public FileSystemOutputReader(final Path outputDirectory) {
method getOutputs (line 18) | @Override
FILE: swagger-coverage-commons/src/main/java/com/github/viclovsky/swagger/coverage/FileSystemOutputWriter.java
class FileSystemOutputWriter (line 17) | public class FileSystemOutputWriter implements CoverageOutputWriter {
method FileSystemOutputWriter (line 24) | public FileSystemOutputWriter(final Path outputDirectory) {
method createDirectories (line 30) | private void createDirectories(final Path directory) {
method write (line 38) | @Override
method write (line 50) | @Override
FILE: swagger-coverage-commons/src/main/java/com/github/viclovsky/swagger/coverage/SwaggerCoverageConstants.java
class SwaggerCoverageConstants (line 3) | public final class SwaggerCoverageConstants {
method SwaggerCoverageConstants (line 13) | private SwaggerCoverageConstants() {
FILE: swagger-coverage-commons/src/main/java/com/github/viclovsky/swagger/coverage/SwaggerCoverageReadException.java
class SwaggerCoverageReadException (line 3) | class SwaggerCoverageReadException extends RuntimeException {
method SwaggerCoverageReadException (line 4) | SwaggerCoverageReadException(String message, Throwable cause) {
FILE: swagger-coverage-commons/src/main/java/com/github/viclovsky/swagger/coverage/SwaggerCoverageUtils.java
class SwaggerCoverageUtils (line 8) | public final class SwaggerCoverageUtils {
method SwaggerCoverageUtils (line 10) | SwaggerCoverageUtils() {
method generateJsonCoverageOutputName (line 14) | public static String generateJsonCoverageOutputName() {
method generateYamlCoverageOutputName (line 18) | public static String generateYamlCoverageOutputName() {
method generateCoverageOutputName (line 22) | private static String generateCoverageOutputName(String uuid, String s...
FILE: swagger-coverage-commons/src/main/java/com/github/viclovsky/swagger/coverage/SwaggerCoverageWriteException.java
class SwaggerCoverageWriteException (line 3) | public class SwaggerCoverageWriteException extends RuntimeException {
method SwaggerCoverageWriteException (line 4) | public SwaggerCoverageWriteException(String message, Throwable cause) {
FILE: swagger-coverage-commons/src/main/java/com/github/viclovsky/swagger/coverage/model/SwaggerCoverage2ModelJackson.java
class SwaggerCoverage2ModelJackson (line 10) | @SuppressWarnings("PMD.ClassNamingConventions")
method SwaggerCoverage2ModelJackson (line 13) | private SwaggerCoverage2ModelJackson() {
method createJsonMapper (line 17) | public static ObjectMapper createJsonMapper() {
method createYamlMapper (line 23) | public static ObjectMapper createYamlMapper() {
FILE: swagger-coverage-commons/src/main/java/com/github/viclovsky/swagger/coverage/utils/FreemarkerUtils.java
class FreemarkerUtils (line 20) | public final class FreemarkerUtils {
method FreemarkerUtils (line 26) | private FreemarkerUtils() {
method processTemplate (line 29) | public static String processTemplate(final String path, final Object o...
method proccessTemplate (line 33) | private static String proccessTemplate(Configuration configuration, St...
method processTemplate (line 51) | public static String processTemplate(final String path, String locale,...
method processCustomTemplate (line 61) | public static String processCustomTemplate(final String customTemplate...
method readMessages (line 72) | public static Map<String, String> readMessages(String localeCode){
FILE: swagger-coverage-karate/src/main/java/com/github/viclovsky/swagger/coverage/karate/Request.java
class Request (line 6) | public class Request {
method getBaseUrl (line 19) | public String getBaseUrl() {
method setBaseUrl (line 23) | public void setBaseUrl(String uri) {
method getPath (line 27) | public String getPath() {
method setPath (line 31) | public void setPath(String path) {
method getRequestParams (line 35) | public Map<String, List<String>> getRequestParams() {
method setRequestParams (line 39) | public void setRequestParams(Map<String, List<String>> requestParams) {
method getRequestParts (line 43) | public Map<String, List<Map<String, String>>> getRequestParts() {
method setRequestParts (line 47) | public void setRequestParts(Map<String, List<Map<String, String>>> req...
method getPathParams (line 51) | public Map<String, String> getPathParams() {
method setPathParams (line 55) | public void setPathParams(Map<String, String> pathParams) {
method getHeaderParams (line 59) | public Map<String, List<String>> getHeaderParams() {
method setHeaderParams (line 63) | public void setHeaderParams(Map<String, List<String>> headerParams) {
method getResponseHeaders (line 67) | public Map<String, List<String>> getResponseHeaders() {
method setResponseHeaders (line 71) | public void setResponseHeaders(Map<String, List<String>> responseHeade...
method getMethod (line 75) | public String getMethod() {
method setMethod (line 79) | public void setMethod(String method) {
method getStatusCode (line 83) | public int getStatusCode() {
method setStatusCode (line 87) | public void setStatusCode(int statusCode) {
method hasBody (line 91) | public Boolean hasBody() {
method setHasBody (line 95) | public void setHasBody(Boolean hasBody) {
FILE: swagger-coverage-karate/src/main/java/com/github/viclovsky/swagger/coverage/karate/RequestWriter.java
class RequestWriter (line 26) | public class RequestWriter {
method RequestWriter (line 30) | public RequestWriter(String workingDir){
method write (line 35) | public void write(Request request, Boolean oas3){
method writeSwagger (line 44) | public void writeSwagger(Request request) {
method writeOAS3 (line 85) | public void writeOAS3(Request request){
method getContentType (line 134) | private String getContentType(Map<String, List<String>> headerList) {
method trimAfterChar (line 143) | private String trimAfterChar(String s, String character) {
FILE: swagger-coverage-karate/src/main/java/com/github/viclovsky/swagger/coverage/karate/SwaggerCoverageOptions.java
class SwaggerCoverageOptions (line 3) | public class SwaggerCoverageOptions {
method setDestinationURL (line 8) | public static void setDestinationURL(String url){
method getDestinationURL (line 12) | public static String getDestinationURL(){
method reset (line 16) | public static void reset(){
method setPathPattern (line 21) | public static void setPathPattern(String pattern){
method getPathPattern (line 25) | public static String getPathPattern(){
method setIgnoreCall (line 29) | public static void setIgnoreCall(boolean ignore){
method getIgnoreCall (line 33) | public static boolean getIgnoreCall(){
FILE: swagger-coverage-karate/src/main/java/com/github/viclovsky/swagger/coverage/karate/SwaggerCoverageRunner.java
class SwaggerCoverageRunner (line 24) | public class SwaggerCoverageRunner extends Runner {
method startProxy (line 29) | private static int startProxy(Map<String, Object> args){
method stopProxy (line 38) | private static void stopProxy(){
class SwaggerCoverageBuilder (line 44) | public static class SwaggerCoverageBuilder extends Builder<SwaggerCove...
method prepareTests (line 55) | private void prepareTests(){
method backupCoverageOutput (line 71) | private void backupCoverageOutput(){
method generateReport (line 83) | private void generateReport() {
method swagger (line 129) | public SwaggerCoverageBuilder swagger(){
method oas3 (line 134) | public SwaggerCoverageBuilder oas3(){
method swaggerSpec (line 139) | public SwaggerCoverageBuilder swaggerSpec(URI path){
method swaggerCoverageConfig (line 144) | public SwaggerCoverageBuilder swaggerCoverageConfig(String configPath){
method coverageDir (line 149) | public SwaggerCoverageBuilder coverageDir(String coverageDir){
method backupCoverageOutput (line 154) | public SwaggerCoverageBuilder backupCoverageOutput(boolean value){
method parallel (line 159) | @Override
method jobManager (line 168) | @Override
method path (line 179) | public static SwaggerCoverageBuilder path(String... paths) {
method path (line 184) | public static SwaggerCoverageBuilder path(List<String> paths) {
method builder (line 189) | public static SwaggerCoverageBuilder builder() {
FILE: swagger-coverage-karate/src/main/resources/karate-base.js
function fn (line 1) | function fn(){
FILE: swagger-coverage-karate/src/test/java/com/github/viclovsky/swagger/coverage/karate/RequestWriterTest.java
class RequestWriterTest (line 25) | public class RequestWriterTest {
method setUp (line 32) | @Before
method shouldWriteSwaggerJson (line 45) | @Test
method shouldWriteOas3Yaml (line 56) | @Test
method getPaths (line 66) | private List<Path> getPaths(Path path) {
FILE: swagger-coverage-karate/src/test/java/com/github/viclovsky/swagger/coverage/karate/SwaggerCoverageRunnerTest.java
class SwaggerCoverageRunnerTest (line 35) | public class SwaggerCoverageRunnerTest {
method setUp (line 45) | @Before
method shouldGetSpecFromUrlV2 (line 56) | @Test
method shouldGetSpecFromUrlV3 (line 71) | @Test
method shouldGetFilesFromSpecifiedFilesV2 (line 86) | @Test
method shouldGetFilesFromSpecifiedFilesV3 (line 102) | @Test
method shouldGetFilesFromSpecifiedDirV2 (line 119) | @Test
method shouldGetFilesFromSpecifiedDirV3 (line 133) | @Test
method shouldBackupCoverageOutput (line 147) | @Test
method getDirFromResources (line 173) | private Path getDirFromResources(String name) {
method deleteOutputDirs (line 181) | private void deleteOutputDirs(Path coverageDir){
FILE: swagger-coverage-rest-assured/src/main/java/com/github/viclovsky/swagger/coverage/SwaggerCoverageRestAssured.java
class SwaggerCoverageRestAssured (line 25) | public class SwaggerCoverageRestAssured implements OrderedFilter {
method SwaggerCoverageRestAssured (line 29) | public SwaggerCoverageRestAssured(CoverageOutputWriter writer) {
method SwaggerCoverageRestAssured (line 33) | public SwaggerCoverageRestAssured() {
method getOrder (line 37) | @Override
method filter (line 42) | @Override
FILE: swagger-coverage-rest-assured/src/main/java/com/github/viclovsky/swagger/coverage/SwaggerCoverageV3RestAssured.java
class SwaggerCoverageV3RestAssured (line 29) | public class SwaggerCoverageV3RestAssured implements OrderedFilter {
method SwaggerCoverageV3RestAssured (line 33) | public SwaggerCoverageV3RestAssured(CoverageOutputWriter writer) {
method SwaggerCoverageV3RestAssured (line 37) | public SwaggerCoverageV3RestAssured() {
method getOrder (line 41) | @Override
method filter (line 46) | @Override
FILE: swagger-coverage-rest-assured/src/test/java/com/github/viclovsky/swagger/coverage/RequestLoggerFilterTest.java
class RequestLoggerFilterTest (line 31) | public class RequestLoggerFilterTest {
method getPaths (line 41) | private List<Path> getPaths(Path path) {
method setUp (line 49) | @Before
method shouldCreateDefaultOutputFolder (line 57) | @Test
method shouldDumpSwaggerFile (line 64) | @Test
method shouldCatchExceptionRestAssuredIssue1232 (line 80) | @Test
FILE: swagger-coverage-rest-assured/src/test/java/com/github/viclovsky/swagger/coverage/RequestLoggerV3FilterTest.java
class RequestLoggerV3FilterTest (line 31) | public class RequestLoggerV3FilterTest {
method getPaths (line 41) | private List<Path> getPaths(Path path) {
method setUp (line 49) | @Before
method shouldCreateDefaultOutputFolder (line 57) | @Test
method shouldDumpSwaggerFile (line 64) | @Test
method shouldCatchExceptionRestAssuredIssue1232 (line 79) | @Test
Condensed preview — 186 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (706K chars).
[
{
"path": ".github/CODEOWNERS",
"chars": 19,
"preview": "* @viclovsky\n"
},
{
"path": ".github/ISSUE_TEMPLATE.md",
"chars": 843,
"preview": "[//]: # (\n. This repository's issues are reserved for feature requests and bug reports.\n.\n. Make sure you have a clear n"
},
{
"path": ".github/dependabot.yml",
"chars": 180,
"preview": "version: 2\nupdates:\n- package-ecosystem: gradle\n directory: /\n schedule:\n interval: weekly\n- package-ecosystem: git"
},
{
"path": ".github/release-drafter.yml",
"chars": 450,
"preview": "name-template: '$NEXT_MINOR_VERSION'\ntag-template: '$NEXT_MINOR_VERSION'\ncategories:\n - title: '🚀 New Features'\n lab"
},
{
"path": ".github/workflows/build.yml",
"chars": 637,
"preview": "name: CI\n\non:\n pull_request:\n branches:\n - '*'\n push:\n branches:\n - 'master'\n\njobs:\n build:\n runs-"
},
{
"path": ".github/workflows/gradle-wrapper-validation.yml",
"chars": 555,
"preview": "name: \"Validate Gradle Wrapper\"\n\non:\n push:\n branches:\n - master\n paths:\n - 'gradlew'\n - 'gradlew.ba"
},
{
"path": ".github/workflows/label-verify.yml",
"chars": 283,
"preview": "\nname: \"Verify type labels\"\n\non:\n pull_request:\n types: [opened, labeled, unlabeled, synchronize]\n\njobs:\n triage:\n "
},
{
"path": ".github/workflows/release-draft.yml",
"chars": 243,
"preview": "name: Release Draft\n\non:\n push:\n branches:\n - master\n\njobs:\n update_draft_release:\n runs-on: ubuntu-latest\n"
},
{
"path": ".github/workflows/release.yml",
"chars": 2243,
"preview": "name: Release\n\non:\n release:\n types: [published]\n\njobs:\n build:\n runs-on: ubuntu-latest\n steps:\n - uses:"
},
{
"path": ".gitignore",
"chars": 99,
"preview": "# IDEA files\n.idea\n*.iml\n\n# Gradle\n.gradle\nbuild\n\n# Mac OS\n.DS_Store\n\n# Allure\nallure-results\nbin/\n"
},
{
"path": "LICENSE",
"chars": 11343,
"preview": " Apache License\n Version 2.0, January 2004\n "
},
{
"path": "README.md",
"chars": 9070,
"preview": "[license]: http://www.apache.org/licenses/LICENSE-2.0 \"Apache License 2.0\"\n[release]: https://github.com/viclovsky/swagg"
},
{
"path": "build.gradle.kts",
"chars": 3301,
"preview": "import io.spring.gradle.dependencymanagement.dsl.DependencyManagementExtension\n\nbuildscript {\n repositories {\n "
},
{
"path": "gradle/maven-publish.gradle",
"chars": 2120,
"preview": "apply plugin: 'maven-publish'\napply plugin: 'signing'\n\npublishing {\n publications {\n gpr(MavenPublication) {\n "
},
{
"path": "gradle/wrapper/gradle-wrapper.properties",
"chars": 223,
"preview": "distributionBase=GRADLE_USER_HOME\ndistributionPath=wrapper/dists\ndistributionUrl=https\\://services.gradle.org/distributi"
},
{
"path": "gradle.properties",
"chars": 20,
"preview": "version=1.0-SNAPSHOT"
},
{
"path": "gradlew",
"chars": 8474,
"preview": "#!/bin/sh\n\n#\n# Copyright © 2015-2021 the original authors.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lice"
},
{
"path": "gradlew.bat",
"chars": 2868,
"preview": "@rem\r\n@rem Copyright 2015 the original author or authors.\r\n@rem\r\n@rem Licensed under the Apache License, Version 2.0 (th"
},
{
"path": "jitpack.yml",
"chars": 96,
"preview": "jdk:\n - openjdk8\ninstall:\n - ./gradlew clean build publishToMavenLocal -x signGprPublication\n"
},
{
"path": "run.sh",
"chars": 474,
"preview": "./gradlew clean build -x test\nrm -r -f swagger-coverage-commandline-1.0-SNAPSHOT\nunzip swagger-coverage-commandline/buil"
},
{
"path": "settings.gradle.kts",
"chars": 191,
"preview": "rootProject.name = \"swagger-coverage\"\n\ninclude(\"swagger-coverage-commandline\")\ninclude(\"swagger-coverage-rest-assured\")\n"
},
{
"path": "swagger-coverage-commandline/build.gradle.kts",
"chars": 929,
"preview": "plugins {\n java\n `java-library`\n application\n}\n\ndescription = \"Swagger-coverage Commandline\"\n\napplication {\n "
},
{
"path": "swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/CommandLine.java",
"chars": 2794,
"preview": "package com.github.viclovsky.swagger.coverage;\n\nimport ch.qos.logback.classic.Level;\nimport com.beust.jcommander.JComman"
},
{
"path": "swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/ExitCode.java",
"chars": 360,
"preview": "package com.github.viclovsky.swagger.coverage;\n\npublic enum ExitCode {\n\n NO_ERROR(0),\n GENERIC_ERROR(1),\n ARGUM"
},
{
"path": "swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/configuration/Configuration.java",
"chars": 3415,
"preview": "package com.github.viclovsky.swagger.coverage.configuration;\n\nimport com.github.viclovsky.swagger.coverage.configuration"
},
{
"path": "swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/configuration/ConfigurationBuilder.java",
"chars": 6310,
"preview": "package com.github.viclovsky.swagger.coverage.configuration;\n\nimport com.fasterxml.jackson.databind.ObjectMapper;\nimport"
},
{
"path": "swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/configuration/options/ConfigurationOptions.java",
"chars": 1047,
"preview": "package com.github.viclovsky.swagger.coverage.configuration.options;\n\nimport io.swagger.v3.parser.core.models.ParseOptio"
},
{
"path": "swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/configuration/options/MainOptions.java",
"chars": 235,
"preview": "package com.github.viclovsky.swagger.coverage.configuration.options;\n\npublic class MainOptions {\n\n //todo: add more o"
},
{
"path": "swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/configuration/options/ResultsWriterOptions.java",
"chars": 1416,
"preview": "package com.github.viclovsky.swagger.coverage.configuration.options;\n\npublic class ResultsWriterOptions {\n private St"
},
{
"path": "swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/configuration/options/RuleConfigurationOptions.java",
"chars": 1005,
"preview": "package com.github.viclovsky.swagger.coverage.configuration.options;\n\nimport java.util.List;\n\npublic class RuleConfigura"
},
{
"path": "swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/generator/Generator.java",
"chars": 3657,
"preview": "package com.github.viclovsky.swagger.coverage.core.generator;\n\nimport com.github.viclovsky.swagger.coverage.CoverageOutp"
},
{
"path": "swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/generator/OperationConditionGenerator.java",
"chars": 2322,
"preview": "package com.github.viclovsky.swagger.coverage.core.generator;\n\nimport com.github.viclovsky.swagger.coverage.core.model.C"
},
{
"path": "swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/generator/SwaggerSpecificationProcessor.java",
"chars": 2492,
"preview": "package com.github.viclovsky.swagger.coverage.core.generator;\n\nimport com.github.viclovsky.swagger.coverage.core.model.O"
},
{
"path": "swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/model/Condition.java",
"chars": 1315,
"preview": "package com.github.viclovsky.swagger.coverage.core.model;\n\nimport io.swagger.v3.oas.models.Operation;\n\npublic abstract c"
},
{
"path": "swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/model/ConditionOperationCoverage.java",
"chars": 1053,
"preview": "package com.github.viclovsky.swagger.coverage.core.model;\n\nimport io.swagger.v3.oas.models.Operation;\n\nimport java.util."
},
{
"path": "swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/model/OperationKey.java",
"chars": 810,
"preview": "package com.github.viclovsky.swagger.coverage.core.model;\n\nimport io.swagger.v3.oas.models.PathItem;\n\npublic class Opera"
},
{
"path": "swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/model/OperationsHolder.java",
"chars": 674,
"preview": "package com.github.viclovsky.swagger.coverage.core.model;\n\nimport io.swagger.v3.oas.models.Operation;\n\nimport java.util."
},
{
"path": "swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/model/SinglePredicateCondition.java",
"chars": 1469,
"preview": "package com.github.viclovsky.swagger.coverage.core.model;\n\nimport com.github.viclovsky.swagger.coverage.core.predicate.C"
},
{
"path": "swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/predicate/ConditionPredicate.java",
"chars": 337,
"preview": "package com.github.viclovsky.swagger.coverage.core.predicate;\n\nimport io.swagger.v3.oas.models.Operation;\n\npublic abstra"
},
{
"path": "swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/predicate/DefaultBodyConditionPredicate.java",
"chars": 713,
"preview": "package com.github.viclovsky.swagger.coverage.core.predicate;\n\nimport io.swagger.v3.oas.models.Operation;\n\npublic class "
},
{
"path": "swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/predicate/DefaultParameterConditionPredicate.java",
"chars": 1625,
"preview": "package com.github.viclovsky.swagger.coverage.core.predicate;\n\nimport io.swagger.v3.oas.models.parameters.Parameter;\nimp"
},
{
"path": "swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/predicate/DefaultParameterValueConditionPredicate.java",
"chars": 1916,
"preview": "package com.github.viclovsky.swagger.coverage.core.predicate;\n\nimport com.github.viclovsky.swagger.coverage.core.generat"
},
{
"path": "swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/predicate/DefaultPropertyConditionPredicate.java",
"chars": 1379,
"preview": "package com.github.viclovsky.swagger.coverage.core.predicate;\n\nimport io.swagger.v3.oas.models.media.Schema;\n\nimport jav"
},
{
"path": "swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/predicate/DefaultStatusConditionPredicate.java",
"chars": 1166,
"preview": "package com.github.viclovsky.swagger.coverage.core.predicate;\n\nimport io.swagger.v3.oas.models.parameters.Parameter;\nimp"
},
{
"path": "swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/predicate/FullStatusConditionPredicate.java",
"chars": 1945,
"preview": "package com.github.viclovsky.swagger.coverage.core.predicate;\n\nimport io.swagger.v3.oas.models.parameters.Parameter;\nimp"
},
{
"path": "swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/predicate/NotOnlyParameterListValueConditionPredicate.java",
"chars": 2125,
"preview": "package com.github.viclovsky.swagger.coverage.core.predicate;\n\nimport com.github.viclovsky.swagger.coverage.core.generat"
},
{
"path": "swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/predicate/ParameterConditionPredicate.java",
"chars": 584,
"preview": "package com.github.viclovsky.swagger.coverage.core.predicate;\n\nimport io.swagger.v3.oas.models.Operation;\nimport io.swag"
},
{
"path": "swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/predicate/ParameterUtils.java",
"chars": 368,
"preview": "package com.github.viclovsky.swagger.coverage.core.predicate;\n\nimport io.swagger.v3.oas.models.parameters.Parameter;\n\nim"
},
{
"path": "swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/predicate/ParameterValueConditionPredicate.java",
"chars": 2125,
"preview": "package com.github.viclovsky.swagger.coverage.core.predicate;\n\nimport com.github.viclovsky.swagger.coverage.core.generat"
},
{
"path": "swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/predicate/PropertyConditionPredicate.java",
"chars": 1927,
"preview": "package com.github.viclovsky.swagger.coverage.core.predicate;\n\nimport io.swagger.v3.oas.models.Operation;\nimport io.swag"
},
{
"path": "swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/predicate/PropertyValueConditionPredicate.java",
"chars": 1891,
"preview": "package com.github.viclovsky.swagger.coverage.core.predicate;\n\nimport com.github.viclovsky.swagger.coverage.core.generat"
},
{
"path": "swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/predicate/PropertyValueNotOnlyConditionPredicate.java",
"chars": 2034,
"preview": "package com.github.viclovsky.swagger.coverage.core.predicate;\n\nimport com.github.viclovsky.swagger.coverage.core.generat"
},
{
"path": "swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/results/Results.java",
"chars": 4971,
"preview": "package com.github.viclovsky.swagger.coverage.core.results;\n\nimport com.github.viclovsky.swagger.coverage.core.model.Ope"
},
{
"path": "swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/results/builder/core/StatisticsBuilder.java",
"chars": 1085,
"preview": "package com.github.viclovsky.swagger.coverage.core.results.builder.core;\n\nimport com.github.viclovsky.swagger.coverage.c"
},
{
"path": "swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/results/builder/core/StatisticsOperationPostBuilder.java",
"chars": 1059,
"preview": "package com.github.viclovsky.swagger.coverage.core.results.builder.core;\n\nimport com.github.viclovsky.swagger.coverage.c"
},
{
"path": "swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/results/builder/core/StatisticsPostBuilder.java",
"chars": 367,
"preview": "package com.github.viclovsky.swagger.coverage.core.results.builder.core;\n\npublic abstract class StatisticsPostBuilder ex"
},
{
"path": "swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/results/builder/core/StatisticsPreBuilder.java",
"chars": 305,
"preview": "package com.github.viclovsky.swagger.coverage.core.results.builder.core;\n\npublic abstract class StatisticsPreBuilder ext"
},
{
"path": "swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/results/builder/postbuilder/ConditionStatisticsBuilder.java",
"chars": 2030,
"preview": "package com.github.viclovsky.swagger.coverage.core.results.builder.postbuilder;\n\nimport com.github.viclovsky.swagger.cov"
},
{
"path": "swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/results/builder/postbuilder/ConfigurationStatisticsBuilder.java",
"chars": 1494,
"preview": "package com.github.viclovsky.swagger.coverage.core.results.builder.postbuilder;\n\nimport com.fasterxml.jackson.core.JsonP"
},
{
"path": "swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/results/builder/postbuilder/FlatOperationBuilder.java",
"chars": 995,
"preview": "package com.github.viclovsky.swagger.coverage.core.results.builder.postbuilder;\n\nimport com.github.viclovsky.swagger.cov"
},
{
"path": "swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/results/builder/postbuilder/SwaggerInfoBuilder.java",
"chars": 1057,
"preview": "package com.github.viclovsky.swagger.coverage.core.results.builder.postbuilder;\n\nimport com.github.viclovsky.swagger.cov"
},
{
"path": "swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/results/builder/postbuilder/TagStatisticsBuilder.java",
"chars": 3450,
"preview": "package com.github.viclovsky.swagger.coverage.core.results.builder.postbuilder;\n\nimport com.github.viclovsky.swagger.cov"
},
{
"path": "swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/results/builder/postbuilder/ZeroCallStatisticsBuilder.java",
"chars": 911,
"preview": "package com.github.viclovsky.swagger.coverage.core.results.builder.postbuilder;\n\nimport com.github.viclovsky.swagger.cov"
},
{
"path": "swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/results/builder/prebuilder/CoverageStatisticsBuilder.java",
"chars": 4764,
"preview": "package com.github.viclovsky.swagger.coverage.core.results.builder.prebuilder;\n\nimport com.github.viclovsky.swagger.cove"
},
{
"path": "swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/results/builder/prebuilder/GenerationStatisticsBuilder.java",
"chars": 2894,
"preview": "package com.github.viclovsky.swagger.coverage.core.results.builder.prebuilder;\n\nimport com.github.viclovsky.swagger.cove"
},
{
"path": "swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/results/data/ConditionCounter.java",
"chars": 1639,
"preview": "package com.github.viclovsky.swagger.coverage.core.results.data;\n\npublic class ConditionCounter {\n\n private long all "
},
{
"path": "swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/results/data/ConditionStatistics.java",
"chars": 2236,
"preview": "package com.github.viclovsky.swagger.coverage.core.results.data;\n\nimport com.github.viclovsky.swagger.coverage.core.mode"
},
{
"path": "swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/results/data/ConditionStatisticsItem.java",
"chars": 894,
"preview": "package com.github.viclovsky.swagger.coverage.core.results.data;\n\nimport com.github.viclovsky.swagger.coverage.core.mode"
},
{
"path": "swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/results/data/CoverageCounter.java",
"chars": 2148,
"preview": "package com.github.viclovsky.swagger.coverage.core.results.data;\n\npublic class CoverageCounter {\n private long all = "
},
{
"path": "swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/results/data/CoverageOperationMap.java",
"chars": 2207,
"preview": "package com.github.viclovsky.swagger.coverage.core.results.data;\n\nimport com.github.viclovsky.swagger.coverage.core.mode"
},
{
"path": "swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/results/data/CoverageState.java",
"chars": 144,
"preview": "package com.github.viclovsky.swagger.coverage.core.results.data;\n\npublic enum CoverageState {\n FULL,\n PARTY,\n E"
},
{
"path": "swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/results/data/GenerationStatistics.java",
"chars": 1237,
"preview": "package com.github.viclovsky.swagger.coverage.core.results.data;\n\npublic class GenerationStatistics {\n\n private long "
},
{
"path": "swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/results/data/OperationResult.java",
"chars": 3354,
"preview": "package com.github.viclovsky.swagger.coverage.core.results.data;\n\nimport com.github.viclovsky.swagger.coverage.configura"
},
{
"path": "swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/results/data/TagCoverage.java",
"chars": 3265,
"preview": "package com.github.viclovsky.swagger.coverage.core.results.data;\n\nimport com.github.viclovsky.swagger.coverage.core.mode"
},
{
"path": "swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/results/util/DateTimeUtil.java",
"chars": 473,
"preview": "package com.github.viclovsky.swagger.coverage.core.results.util;\n\nimport java.time.Instant;\nimport java.time.ZoneId;\nimp"
},
{
"path": "swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/rule/body/NotEmptyBodyRule.java",
"chars": 1143,
"preview": "package com.github.viclovsky.swagger.coverage.core.rule.body;\n\nimport com.github.viclovsky.swagger.coverage.core.model.C"
},
{
"path": "swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/rule/body/PropertyConditionRule.java",
"chars": 1765,
"preview": "package com.github.viclovsky.swagger.coverage.core.rule.body;\n\nimport com.github.viclovsky.swagger.coverage.core.model.C"
},
{
"path": "swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/rule/body/PropertyEnumAllValuesRule.java",
"chars": 1241,
"preview": "package com.github.viclovsky.swagger.coverage.core.rule.body;\n\nimport com.github.viclovsky.swagger.coverage.core.generat"
},
{
"path": "swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/rule/body/PropertyNotEmptyRule.java",
"chars": 960,
"preview": "package com.github.viclovsky.swagger.coverage.core.rule.body;\n\nimport com.github.viclovsky.swagger.coverage.core.model.C"
},
{
"path": "swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/rule/body/PropertyNotOnlyEnumValuesRule.java",
"chars": 1263,
"preview": "package com.github.viclovsky.swagger.coverage.core.rule.body;\n\nimport com.github.viclovsky.swagger.coverage.core.generat"
},
{
"path": "swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/rule/core/ConditionRule.java",
"chars": 622,
"preview": "package com.github.viclovsky.swagger.coverage.core.rule.core;\n\nimport com.github.viclovsky.swagger.coverage.configuratio"
},
{
"path": "swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/rule/parameter/EmptyHeaderRule.java",
"chars": 1154,
"preview": "package com.github.viclovsky.swagger.coverage.core.rule.parameter;\n\nimport com.github.viclovsky.swagger.coverage.core.mo"
},
{
"path": "swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/rule/parameter/EnumAllValuesRule.java",
"chars": 1353,
"preview": "package com.github.viclovsky.swagger.coverage.core.rule.parameter;\n\nimport com.github.viclovsky.swagger.coverage.core.ge"
},
{
"path": "swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/rule/parameter/NotEmptyParameterRule.java",
"chars": 1010,
"preview": "package com.github.viclovsky.swagger.coverage.core.rule.parameter;\n\nimport com.github.viclovsky.swagger.coverage.core.mo"
},
{
"path": "swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/rule/parameter/NotOnlyEnumValuesRule.java",
"chars": 1409,
"preview": "package com.github.viclovsky.swagger.coverage.core.rule.parameter;\n\nimport com.github.viclovsky.swagger.coverage.core.ge"
},
{
"path": "swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/rule/parameter/ParameterConditionRule.java",
"chars": 951,
"preview": "package com.github.viclovsky.swagger.coverage.core.rule.parameter;\n\nimport com.github.viclovsky.swagger.coverage.core.mo"
},
{
"path": "swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/rule/status/HTTPStatusRule.java",
"chars": 1384,
"preview": "package com.github.viclovsky.swagger.coverage.core.rule.status;\n\nimport com.github.viclovsky.swagger.coverage.core.model"
},
{
"path": "swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/rule/status/OnlyDeclaredHTTPStatusesRule.java",
"chars": 1118,
"preview": "package com.github.viclovsky.swagger.coverage.core.rule.status;\n\nimport com.github.viclovsky.swagger.coverage.core.model"
},
{
"path": "swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/rule/status/StatusConditionRule.java",
"chars": 800,
"preview": "package com.github.viclovsky.swagger.coverage.core.rule.status;\n\nimport com.github.viclovsky.swagger.coverage.core.model"
},
{
"path": "swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/writer/CoverageResultsWriter.java",
"chars": 204,
"preview": "package com.github.viclovsky.swagger.coverage.core.writer;\n\nimport com.github.viclovsky.swagger.coverage.core.results.Re"
},
{
"path": "swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/writer/FileSystemResultsWriter.java",
"chars": 1640,
"preview": "package com.github.viclovsky.swagger.coverage.core.writer;\n\nimport com.fasterxml.jackson.databind.ObjectMapper;\nimport c"
},
{
"path": "swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/writer/HtmlReportResultsWriter.java",
"chars": 2458,
"preview": "package com.github.viclovsky.swagger.coverage.core.writer;\n\nimport com.github.viclovsky.swagger.coverage.SwaggerCoverage"
},
{
"path": "swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/writer/LogResultsWriter.java",
"chars": 3559,
"preview": "package com.github.viclovsky.swagger.coverage.core.writer;\n\nimport com.github.viclovsky.swagger.coverage.core.model.Oper"
},
{
"path": "swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/option/MainOptions.java",
"chars": 1248,
"preview": "package com.github.viclovsky.swagger.coverage.option;\n\nimport com.beust.jcommander.Parameter;\n\nimport java.net.URI;\nimpo"
},
{
"path": "swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/option/VerboseOptions.java",
"chars": 704,
"preview": "package com.github.viclovsky.swagger.coverage.option;\n\nimport com.beust.jcommander.Parameter;\n\npublic class VerboseOptio"
},
{
"path": "swagger-coverage-commandline/src/main/resources/logback.xml",
"chars": 367,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<configuration>\n <appender name=\"stdout\" class=\"ch.qos.logback.core.ConsoleApp"
},
{
"path": "swagger-coverage-commandline/src/test/java/com/github/viclovsky/swagger/coverage/Config.java",
"chars": 965,
"preview": "package com.github.viclovsky.swagger.coverage;\n\nimport java.io.File;\nimport java.net.URI;\nimport java.nio.file.Path;\n\nim"
},
{
"path": "swagger-coverage-commandline/src/test/java/com/github/viclovsky/swagger/coverage/CustomReportTemplateTest.java",
"chars": 3667,
"preview": "package com.github.viclovsky.swagger.coverage;\n\nimport com.fasterxml.jackson.databind.ObjectMapper;\nimport com.github.vi"
},
{
"path": "swagger-coverage-commandline/src/test/java/com/github/viclovsky/swagger/coverage/ParseOptionsTest.java",
"chars": 1005,
"preview": "package com.github.viclovsky.swagger.coverage;\n\nimport com.github.viclovsky.swagger.coverage.core.generator.Generator;\ni"
},
{
"path": "swagger-coverage-commandline/src/test/java/com/github/viclovsky/swagger/coverage/SimpleTest.java",
"chars": 3464,
"preview": "package com.github.viclovsky.swagger.coverage;\n\nimport com.github.viclovsky.swagger.coverage.core.generator.Generator;\ni"
},
{
"path": "swagger-coverage-commandline/src/test/resources/configuration.json",
"chars": 358,
"preview": "{\n \"rules\" : {\n \"status\": {\n \"filter\": [\"200\"]\n },\n \"only-declared-status\" : {\n \"enable\" : false\n "
},
{
"path": "swagger-coverage-commandline/src/test/resources/full_configuration.json",
"chars": 544,
"preview": "{\n \"rules\": {\n \"status\": {\n \"filter\": [\n \"200\"\n ],\n \"ignore\": [\n \"500\",\n \"400\",\n"
},
{
"path": "swagger-coverage-commandline/src/test/resources/report_custom.ftl",
"chars": 8871,
"preview": "<#ftl output_format=\"HTML\">\n\n<#global i18=messages>\n<#global operationMap=data.flatOperations>\n\n<#-- @ftlvariable ftlvar"
},
{
"path": "swagger-coverage-commandline/src/test/resources/v2/petstory.json",
"chars": 25273,
"preview": "{\n \"swagger\": \"2.0\",\n \"info\": {\n \"description\": \"This is a sample server Petstore server. You can find out more ab"
},
{
"path": "swagger-coverage-commandline/src/test/resources/v2/petstory_no_tags.json",
"chars": 24776,
"preview": "{\n \"swagger\": \"2.0\",\n \"info\": {\n \"description\": \"This is a sample server Petstore server. You can find out more ab"
},
{
"path": "swagger-coverage-commandline/src/test/resources/v2/petstory_operation_wo_tags.json",
"chars": 24731,
"preview": "{\n \"swagger\": \"2.0\",\n \"info\": {\n \"description\": \"This is a sample server Petstore server. You can find out more ab"
},
{
"path": "swagger-coverage-commandline/src/test/resources/v2/petstory_with_x_example.json",
"chars": 26696,
"preview": "{\n \"swagger\": \"2.0\",\n \"info\": {\n \"description\": \"This is a sample server Petstore server. You can find out more ab"
},
{
"path": "swagger-coverage-commandline/src/test/resources/v2/petstory_without_parameters.json",
"chars": 24420,
"preview": "{\n \"swagger\": \"2.0\",\n \"info\": {\n \"description\": \"This is a sample server Petstore server. You can find out more ab"
},
{
"path": "swagger-coverage-commandline/src/test/resources/v2/swagger-coverage-output/empty_parameters.json",
"chars": 297,
"preview": "{\n \"swagger\" : \"2.0\",\n \"host\" : \"localhost\",\n \"schemes\" : [ \"http\" ],\n \"consumes\" : [ \"application/json\" ],\n \"produ"
},
{
"path": "swagger-coverage-commandline/src/test/resources/v2/swagger-coverage-output/enum_param_1.json",
"chars": 875,
"preview": "{\n \"swagger\" : \"2.0\",\n \"host\" : \"localhost\",\n \"schemes\" : [ \"http\" ],\n \"consumes\" : [ \"application/json\" ],\n \"produ"
},
{
"path": "swagger-coverage-commandline/src/test/resources/v2/swagger-coverage-output/enum_param_2.json",
"chars": 873,
"preview": "{\n \"swagger\" : \"2.0\",\n \"host\" : \"localhost\",\n \"schemes\" : [ \"http\" ],\n \"consumes\" : [ \"application/json\" ],\n \"produ"
},
{
"path": "swagger-coverage-commandline/src/test/resources/v2/swagger-coverage-output/ignore_header.json",
"chars": 862,
"preview": "{\n \"swagger\" : \"2.0\",\n \"host\" : \"localhost\",\n \"schemes\" : [ \"http\" ],\n \"consumes\" : [ \"application/json\" ],\n \"produ"
},
{
"path": "swagger-coverage-commandline/src/test/resources/v2/swagger-coverage-output/match_pattern.json",
"chars": 862,
"preview": "{\n \"swagger\" : \"2.0\",\n \"host\" : \"localhost\",\n \"schemes\" : [ \"http\" ],\n \"consumes\" : [ \"application/json\" ],\n \"produ"
},
{
"path": "swagger-coverage-commandline/src/test/resources/v2/swagger-coverage-output/missed_in_swagger.json",
"chars": 927,
"preview": "{\n \"swagger\" : \"2.0\",\n \"host\" : \"localhost\",\n \"schemes\" : [ \"http\" ],\n \"consumes\" : [ \"application/json\" ],\n \"produ"
},
{
"path": "swagger-coverage-commandline/src/test/resources/v2/swagger-coverage-output/missed_in_swagger_without_x_example.json",
"chars": 1086,
"preview": "{\n \"swagger\": \"2.0\",\n \"host\": \"localhost\",\n \"schemes\": [\n \"http\"\n ],\n \"consumes\": [\n \"application/json\"\n ],\n"
},
{
"path": "swagger-coverage-commandline/src/test/resources/v2/swagger-coverage-output/not_200.json",
"chars": 872,
"preview": "{\n \"swagger\" : \"2.0\",\n \"host\" : \"localhost\",\n \"schemes\" : [ \"http\" ],\n \"consumes\" : [ \"application/json\" ],\n \"produ"
},
{
"path": "swagger-coverage-commandline/src/test/resources/v2/swagger-coverage-output/one_coverage.json",
"chars": 906,
"preview": "{\n \"swagger\" : \"2.0\",\n \"host\" : \"localhost\",\n \"schemes\" : [ \"http\" ],\n \"consumes\" : [ \"application/json\" ],\n \"produ"
},
{
"path": "swagger-coverage-commandline/src/test/resources/v2/swagger-coverage-output/one_parameter.json",
"chars": 866,
"preview": "{\n \"swagger\" : \"2.0\",\n \"host\" : \"localhost\",\n \"schemes\" : [ \"http\" ],\n \"consumes\" : [ \"application/json\" ],\n \"produ"
},
{
"path": "swagger-coverage-commandline/src/test/resources/v2/swagger-coverage-output/one_partial_coverage.json",
"chars": 860,
"preview": "{\n \"swagger\" : \"2.0\",\n \"host\" : \"localhost\",\n \"schemes\" : [ \"http\" ],\n \"consumes\" : [ \"application/json\" ],\n \"produ"
},
{
"path": "swagger-coverage-commandline/src/test/resources/v2/swagger-coverage-output/test_empty_operation.json",
"chars": 267,
"preview": "{\n \"swagger\" : \"2.0\",\n \"host\" : \"localhost\",\n \"schemes\" : [ \"http\" ],\n \"consumes\" : [ \"application/json\" ],\n \"produ"
},
{
"path": "swagger-coverage-commandline/src/test/resources/v2/swagger-coverage-output/two_coverage.json",
"chars": 864,
"preview": "{\n \"swagger\" : \"2.0\",\n \"host\" : \"localhost\",\n \"schemes\" : [ \"http\" ],\n \"consumes\" : [ \"application/json\" ],\n \"produ"
},
{
"path": "swagger-coverage-commandline/src/test/resources/v3/operations/pet_petId.yaml",
"chars": 2014,
"preview": "get:\n tags:\n - pet\n summary: Find pet by ID\n description: Returns a single pet\n operationId: getPetById\n paramet"
},
{
"path": "swagger-coverage-commandline/src/test/resources/v3/petstory.yaml",
"chars": 18001,
"preview": "openapi: 3.0.0\ninfo:\n description: \"This is a sample server Petstore server. You can find out more about\n Swagger a"
},
{
"path": "swagger-coverage-commandline/src/test/resources/v3/petstory_no_tags.yaml",
"chars": 17648,
"preview": "openapi: 3.0.0\ninfo:\n description: \"This is a sample server Petstore server. You can find out more about\n Swagger a"
},
{
"path": "swagger-coverage-commandline/src/test/resources/v3/petstory_operation_wo_tags.yaml",
"chars": 17622,
"preview": "openapi: 3.0.0\ninfo:\n description: \"This is a sample server Petstore server. You can find out more about\n Swagger a"
},
{
"path": "swagger-coverage-commandline/src/test/resources/v3/petstory_ref_operations.yaml",
"chars": 15722,
"preview": "openapi: 3.0.0\ninfo:\n description: \"This is a sample server Petstore server. You can find out more about\n Swagger a"
},
{
"path": "swagger-coverage-commandline/src/test/resources/v3/petstory_with_x_example.yaml",
"chars": 19179,
"preview": "openapi: 3.0.0\ninfo:\n description: \"This is a sample server Petstore server. You can find out more about\n Swagger a"
},
{
"path": "swagger-coverage-commandline/src/test/resources/v3/petstory_without_parameters.yaml",
"chars": 17362,
"preview": "openapi: 3.0.0\ninfo:\n description: \"This is a sample server Petstore server. You can find out more about\n Swagger a"
},
{
"path": "swagger-coverage-commandline/src/test/resources/v3/swagger-coverage-output/empty_parameters.yaml",
"chars": 263,
"preview": "---\nopenapi: 3.0.0\npaths:\n /pet/findByStatus:\n get:\n responses:\n \"200\":\n description: \"\"\n "
},
{
"path": "swagger-coverage-commandline/src/test/resources/v3/swagger-coverage-output/enum_param_1.yaml",
"chars": 808,
"preview": "---\nopenapi: 3.0.0\npaths:\n /pet/findByStatus:\n get:\n parameters:\n - name: status\n in: query\n "
},
{
"path": "swagger-coverage-commandline/src/test/resources/v3/swagger-coverage-output/enum_param_2.yaml",
"chars": 806,
"preview": "---\nopenapi: 3.0.0\npaths:\n /pet/findByStatus:\n get:\n parameters:\n - name: status\n in: query\n "
},
{
"path": "swagger-coverage-commandline/src/test/resources/v3/swagger-coverage-output/ignore_header.yaml",
"chars": 798,
"preview": "---\nopenapi: 3.0.0\npaths:\n \"/pet/{petId}\":\n delete:\n parameters:\n - name: petId\n in: path\n "
},
{
"path": "swagger-coverage-commandline/src/test/resources/v3/swagger-coverage-output/match_pattern.yaml",
"chars": 796,
"preview": "---\nopenapi: 3.0.0\npaths:\n /user/victor:\n get:\n parameters:\n - name: username\n in: path\n "
},
{
"path": "swagger-coverage-commandline/src/test/resources/v3/swagger-coverage-output/missed_in_swagger.yaml",
"chars": 896,
"preview": "---\nopenapi: 3.0.0\npaths:\n /some/operation/missed/in/swagger:\n get:\n parameters:\n - name: petId\n "
},
{
"path": "swagger-coverage-commandline/src/test/resources/v3/swagger-coverage-output/missed_in_swagger_without_x_example.yaml",
"chars": 919,
"preview": "---\nopenapi: 3.0.0\npaths:\n /some/operation/missed/in/swagger/without/x/example:\n get:\n parameters:\n - na"
},
{
"path": "swagger-coverage-commandline/src/test/resources/v3/swagger-coverage-output/not_200.yaml",
"chars": 808,
"preview": "---\nopenapi: 3.0.0\npaths:\n \"/pet/{petId}/uploadImage\":\n post:\n parameters:\n - name: petId\n in: "
},
{
"path": "swagger-coverage-commandline/src/test/resources/v3/swagger-coverage-output/one_coverage.yaml",
"chars": 877,
"preview": "---\nopenapi: 3.0.0\npaths:\n \"/pet/{petId}\":\n get:\n parameters:\n - name: petId\n in: path\n "
},
{
"path": "swagger-coverage-commandline/src/test/resources/v3/swagger-coverage-output/one_parameter.yaml",
"chars": 802,
"preview": "---\nopenapi: 3.0.0\npaths:\n \"/user/{username}\":\n put:\n parameters:\n - name: username\n in: path\n "
},
{
"path": "swagger-coverage-commandline/src/test/resources/v3/swagger-coverage-output/one_partial_coverage.yaml",
"chars": 795,
"preview": "---\nopenapi: 3.0.0\npaths:\n \"/pet/{petId}\":\n get:\n parameters:\n - name: petId\n in: path\n "
},
{
"path": "swagger-coverage-commandline/src/test/resources/v3/swagger-coverage-output/test_empty_operation.yaml",
"chars": 179,
"preview": "---\nopenapi: 3.0.0\npaths:\n /store/inventory:\n get:\n responses:\n \"404\":\n description: \"\"\nservers"
},
{
"path": "swagger-coverage-commandline/src/test/resources/v3/swagger-coverage-output/two_coverage.yaml",
"chars": 798,
"preview": "---\nopenapi: 3.0.0\npaths:\n /pet/findByStatus:\n get:\n parameters:\n - name: tags\n in: query\n "
},
{
"path": "swagger-coverage-commons/build.gradle.kts",
"chars": 709,
"preview": "plugins {\n java\n `java-library`\n}\n\ndescription = \"Swagger Coverage Commons\"\n\nrepositories {\n mavenCentral()\n}\n\n"
},
{
"path": "swagger-coverage-commons/src/main/java/com/github/viclovsky/swagger/coverage/CoverageOutputReader.java",
"chars": 169,
"preview": "package com.github.viclovsky.swagger.coverage;\n\nimport java.nio.file.Path;\nimport java.util.Set;\n\npublic interface Cover"
},
{
"path": "swagger-coverage-commons/src/main/java/com/github/viclovsky/swagger/coverage/CoverageOutputWriter.java",
"chars": 235,
"preview": "package com.github.viclovsky.swagger.coverage;\n\nimport io.swagger.models.Swagger;\nimport io.swagger.v3.oas.models.OpenAP"
},
{
"path": "swagger-coverage-commons/src/main/java/com/github/viclovsky/swagger/coverage/FileSystemOutputReader.java",
"chars": 835,
"preview": "package com.github.viclovsky.swagger.coverage;\n\nimport java.io.IOException;\nimport java.nio.file.Files;\nimport java.nio."
},
{
"path": "swagger-coverage-commons/src/main/java/com/github/viclovsky/swagger/coverage/FileSystemOutputWriter.java",
"chars": 2437,
"preview": "package com.github.viclovsky.swagger.coverage;\n\nimport com.fasterxml.jackson.databind.ObjectMapper;\nimport com.github.vi"
},
{
"path": "swagger-coverage-commons/src/main/java/com/github/viclovsky/swagger/coverage/SwaggerCoverageConstants.java",
"chars": 688,
"preview": "package com.github.viclovsky.swagger.coverage;\n\npublic final class SwaggerCoverageConstants {\n\n public static final S"
},
{
"path": "swagger-coverage-commons/src/main/java/com/github/viclovsky/swagger/coverage/SwaggerCoverageReadException.java",
"chars": 217,
"preview": "package com.github.viclovsky.swagger.coverage;\n\nclass SwaggerCoverageReadException extends RuntimeException {\n Swagge"
},
{
"path": "swagger-coverage-commons/src/main/java/com/github/viclovsky/swagger/coverage/SwaggerCoverageUtils.java",
"chars": 904,
"preview": "package com.github.viclovsky.swagger.coverage;\n\nimport java.util.UUID;\n\nimport static com.github.viclovsky.swagger.cover"
},
{
"path": "swagger-coverage-commons/src/main/java/com/github/viclovsky/swagger/coverage/SwaggerCoverageWriteException.java",
"chars": 233,
"preview": "package com.github.viclovsky.swagger.coverage;\n\npublic class SwaggerCoverageWriteException extends RuntimeException {\n "
},
{
"path": "swagger-coverage-commons/src/main/java/com/github/viclovsky/swagger/coverage/model/SwaggerCoverage2ModelJackson.java",
"chars": 1026,
"preview": "package com.github.viclovsky.swagger.coverage.model;\n\n\nimport com.fasterxml.jackson.databind.ObjectMapper;\nimport com.fa"
},
{
"path": "swagger-coverage-commons/src/main/java/com/github/viclovsky/swagger/coverage/utils/FreemarkerUtils.java",
"chars": 3552,
"preview": "package com.github.viclovsky.swagger.coverage.utils;\n\nimport freemarker.cache.FileTemplateLoader;\nimport freemarker.temp"
},
{
"path": "swagger-coverage-commons/src/main/resources/details/condition.ftl",
"chars": 354,
"preview": "<#import \"operation.ftl\" as operation />\n\n<#macro list coverage prefix>\n <div class=\"accordion\" id=\"${prefix}-accordi"
},
{
"path": "swagger-coverage-commons/src/main/resources/details/operation.ftl",
"chars": 6583,
"preview": "<#import \"../ui.ftl\" as ui/>\n\n<#macro list coverage prefix>\n <div class=\"accordion\" id=\"${prefix}-accordion\">\n "
},
{
"path": "swagger-coverage-commons/src/main/resources/details/tag.ftl",
"chars": 2107,
"preview": "<#import \"operation.ftl\" as operation />\n<#import \"../ui.ftl\" as ui/>\n\n<#macro list tags>\n <div class=\"accordion\" id="
},
{
"path": "swagger-coverage-commons/src/main/resources/message.en",
"chars": 3577,
"preview": "menu.summary=Summary\nmenu.operations=Operations details\nmenu.tags=Tags details\nmenu.condition=Conditions details\nmenu.ge"
},
{
"path": "swagger-coverage-commons/src/main/resources/message.ru",
"chars": 3440,
"preview": "menu.summary=Сводка\nmenu.operations=Методы\nmenu.tags=Группы\nmenu.condition=Варианты\nmenu.generation=Об отчёте\n\ncommon.st"
},
{
"path": "swagger-coverage-commons/src/main/resources/report.ftl",
"chars": 18557,
"preview": "<#ftl output_format=\"HTML\">\n\n<#global i18=messages>\n<#global operationMap=data.flatOperations>\n\n<#-- @ftlvariable ftlvar"
},
{
"path": "swagger-coverage-commons/src/main/resources/sections/generation.ftl",
"chars": 516,
"preview": "<#macro data statistic>\n <div class=\"row\">\n <div class=\"col-sm\">\n <div class=\"col-12\">\n "
},
{
"path": "swagger-coverage-commons/src/main/resources/sections/summary.ftl",
"chars": 3606,
"preview": "<#import \"../ui.ftl\" as ui/>\n\n<#macro operations operationCoveredMap>\n <div class=\"row\">\n <div class=\"col-12\">"
},
{
"path": "swagger-coverage-commons/src/main/resources/ui.ftl",
"chars": 6607,
"preview": "<#macro progressbar current full height=16>\n <#if full gt 0 >\n <#assign percentValue = 100*current/(full)>\n "
},
{
"path": "swagger-coverage-karate/README.md",
"chars": 8199,
"preview": "# swagger-coverage for Karate\nThis module provides an integration of swagger-coverage for the [Karate Framework](https:/"
},
{
"path": "swagger-coverage-karate/build.gradle.kts",
"chars": 975,
"preview": "plugins {\n java\n `java-library`\n}\n\ndescription = \"Swagger Coverage Karate\"\n\nrepositories {\n mavenCentral()\n}\n\nd"
},
{
"path": "swagger-coverage-karate/src/main/java/com/github/viclovsky/swagger/coverage/karate/Request.java",
"chars": 2404,
"preview": "package com.github.viclovsky.swagger.coverage.karate;\n\nimport java.util.List;\nimport java.util.Map;\n\npublic class Reques"
},
{
"path": "swagger-coverage-karate/src/main/java/com/github/viclovsky/swagger/coverage/karate/RequestWriter.java",
"chars": 5978,
"preview": "package com.github.viclovsky.swagger.coverage.karate;\n\nimport static io.swagger.models.Scheme.forValue;\n\nimport java.io."
},
{
"path": "swagger-coverage-karate/src/main/java/com/github/viclovsky/swagger/coverage/karate/SwaggerCoverageOptions.java",
"chars": 812,
"preview": "package com.github.viclovsky.swagger.coverage.karate;\n\npublic class SwaggerCoverageOptions {\n private static String d"
},
{
"path": "swagger-coverage-karate/src/main/java/com/github/viclovsky/swagger/coverage/karate/SwaggerCoverageRunner.java",
"chars": 6399,
"preview": "package com.github.viclovsky.swagger.coverage.karate;\n\nimport java.io.File;\nimport java.io.IOException;\nimport java.net."
},
{
"path": "swagger-coverage-karate/src/main/resources/httpProxy.feature",
"chars": 1628,
"preview": "@ignore\nFeature: Http Proxy for Swagger-Coverage\n\nBackground:\n * print 'using oas3:', oas3\n * print 'working Dir:'"
},
{
"path": "swagger-coverage-karate/src/main/resources/karate-base.js",
"chars": 879,
"preview": "function fn(){\n var proxyPort = karate.properties['proxy.port'];\n\n if(proxyPort){\n karate.configure('proxy'"
},
{
"path": "swagger-coverage-karate/src/test/java/com/github/viclovsky/swagger/coverage/karate/RequestWriterTest.java",
"chars": 2717,
"preview": "package com.github.viclovsky.swagger.coverage.karate;\n\nimport static com.github.viclovsky.swagger.coverage.SwaggerCovera"
},
{
"path": "swagger-coverage-karate/src/test/java/com/github/viclovsky/swagger/coverage/karate/SwaggerCoverageRunnerTest.java",
"chars": 7967,
"preview": "package com.github.viclovsky.swagger.coverage.karate;\n\nimport java.io.File;\nimport java.io.IOException;\nimport java.net."
},
{
"path": "swagger-coverage-karate/src/test/resources/api-test-coverage-v2/swagger-coverage-config.json",
"chars": 194,
"preview": "{\n \"rules\" : { },\n \"writers\" : { \n \"html\": {\n \"locale\": \"en\",\n \"filename\":\"swagger-co"
},
{
"path": "swagger-coverage-karate/src/test/resources/api-test-coverage-v2/swagger-specification.json",
"chars": 25273,
"preview": "{\n \"swagger\": \"2.0\",\n \"info\": {\n \"description\": \"This is a sample server Petstore server. You can find out more ab"
},
{
"path": "swagger-coverage-karate/src/test/resources/api-test-coverage-v3/swagger-coverage-config.json",
"chars": 194,
"preview": "{\n \"rules\" : { },\n \"writers\" : { \n \"html\": {\n \"locale\": \"en\",\n \"filename\":\"swagger-co"
},
{
"path": "swagger-coverage-karate/src/test/resources/api-test-coverage-v3/swagger-specification.yaml",
"chars": 20886,
"preview": "openapi: 3.0.2\ninfo:\n title: Swagger Petstore - OpenAPI 3.0\n description: \"This is a sample Pet Store Server based on "
},
{
"path": "swagger-coverage-karate/src/test/resources/petv2.feature",
"chars": 276,
"preview": "Feature: Petstore v2\n\nBackground:\n * def baseUrl = karate.properties[\"baseUrl\"]\n * url baseUrl\n * eval scOption"
},
{
"path": "swagger-coverage-karate/src/test/resources/petv3.feature",
"chars": 281,
"preview": "Feature: Petstore v3\n\nBackground:\n * def baseUrl = karate.properties[\"baseUrl\"]\n * url baseUrl\n * eval scOption"
},
{
"path": "swagger-coverage-karate/src/test/resources/request.json",
"chars": 844,
"preview": "{\n \"baseUrl\": \"petstore.swagger.io/v2\",\n \"path\": \"pet\",\n \"requestParams\": {\n \"param1\": [\n \"va"
},
{
"path": "swagger-coverage-karate/src/test/resources/wiremock/__files/openapi.yaml",
"chars": 20886,
"preview": "openapi: 3.0.2\ninfo:\n title: Swagger Petstore - OpenAPI 3.0\n description: \"This is a sample Pet Store Server based on "
},
{
"path": "swagger-coverage-karate/src/test/resources/wiremock/__files/swagger.json",
"chars": 25273,
"preview": "{\n \"swagger\": \"2.0\",\n \"info\": {\n \"description\": \"This is a sample server Petstore server. You can find out more ab"
},
{
"path": "swagger-coverage-rest-assured/build.gradle.kts",
"chars": 666,
"preview": "plugins {\n java\n `java-library`\n}\n\ndescription = \"Swagger Coverage Rest-Assured\"\n\nrepositories {\n mavenCentral("
},
{
"path": "swagger-coverage-rest-assured/src/main/java/com/github/viclovsky/swagger/coverage/SwaggerCoverageRestAssured.java",
"chars": 3636,
"preview": "package com.github.viclovsky.swagger.coverage;\n\nimport io.restassured.filter.FilterContext;\nimport io.restassured.filter"
},
{
"path": "swagger-coverage-rest-assured/src/main/java/com/github/viclovsky/swagger/coverage/SwaggerCoverageV3RestAssured.java",
"chars": 4174,
"preview": "package com.github.viclovsky.swagger.coverage;\n\nimport io.restassured.filter.FilterContext;\nimport io.restassured.filter"
},
{
"path": "swagger-coverage-rest-assured/src/test/java/com/github/viclovsky/swagger/coverage/RequestLoggerFilterTest.java",
"chars": 3494,
"preview": "package com.github.viclovsky.swagger.coverage;\n\nimport com.github.tomakehurst.wiremock.junit.WireMockRule;\nimport io.res"
},
{
"path": "swagger-coverage-rest-assured/src/test/java/com/github/viclovsky/swagger/coverage/RequestLoggerV3FilterTest.java",
"chars": 3501,
"preview": "package com.github.viclovsky.swagger.coverage;\n\nimport com.github.tomakehurst.wiremock.junit.WireMockRule;\nimport io.res"
}
]
// ... and 1 more files (download for full content)
About this extraction
This page contains the full source code of the viclovsky/swagger-coverage GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 186 files (625.7 KB), approximately 145.6k tokens, and a symbol index with 639 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.