Compare commits
237 Commits
V1.0.0-bet
...
v3.6.0
Author | SHA1 | Date | |
---|---|---|---|
2492661f1f | |||
a7b52ec114 | |||
8ebab04a83 | |||
921f6f9691 | |||
558b9fea62 | |||
752cb238d3 | |||
92d4760dbc | |||
4946a27327 | |||
e4217843b7 | |||
b8f2090a8a | |||
178db951a5 | |||
fa5ada8f64 | |||
4345833b75 | |||
3158195bd9 | |||
70586a7cc6 | |||
6f4e268b91 | |||
a1638f930a | |||
0120feb168 | |||
1da3ad5db9 | |||
a8019bc4f8 | |||
ecf0d42ee1 | |||
d76927ba3c | |||
2c43d4d274 | |||
3111b63916 | |||
1759be5ba3 | |||
622dd6a5e7 | |||
6d6836927f | |||
9109a249e4 | |||
60552b8abb | |||
70345494ab | |||
b3dcf7dc8b | |||
b1aa2e497a | |||
d6b852d297 | |||
42ea128aa3 | |||
8df32d7af6 | |||
3f21879417 | |||
cf238beccb | |||
3b5324ded1 | |||
95ae274f1d | |||
fdcc64d29c | |||
4daf6e000e | |||
ba19389f16 | |||
e43627fa09 | |||
f1d252954b | |||
39d5c8b258 | |||
28b844da6c | |||
76e6b0a278 | |||
8ea6a001c2 | |||
190b3c4abe | |||
52e54b75b9 | |||
07bdeda364 | |||
bf31dd213c | |||
d6d3ca517e | |||
e589d917c8 | |||
196fba790a | |||
4d2c392b05 | |||
db696309c8 | |||
3326f10576 | |||
700cda2f46 | |||
3b50e67ff3 | |||
ee875b6fce | |||
c312b201b3 | |||
0d4b1ddd03 | |||
8ae74705ba | |||
99f5cb5b86 | |||
e89636fa58 | |||
7cd0e6154b | |||
62080f3248 | |||
2007b1bb8c | |||
5beeade430 | |||
2e29b46f0f | |||
90b1f47dbb | |||
c73c9b4605 | |||
48969a8fcc | |||
72b61fa765 | |||
18c2cdf5ae | |||
72af88406c | |||
0a8cf54220 | |||
6f3b97da6c | |||
22dc0b8eea | |||
d61e0f85dd | |||
072858a4f5 | |||
6999f7d2c8 | |||
ab68770e1a | |||
c24cafcaf1 | |||
947a507af9 | |||
95eb39803d | |||
9b55593d8c | |||
a74d2e41a9 | |||
bd15060fb0 | |||
69ceae5b66 | |||
9e8b35d26d | |||
37b8dfffd1 | |||
a3ddffbc5d | |||
c0e84207ed | |||
79d183750c | |||
35b1a829ff | |||
39a67b9786 | |||
d0951e5631 | |||
13fbde1315 | |||
ecd4e03081 | |||
9b2b4c6aa8 | |||
0722b59d87 | |||
6ace967b60 | |||
ddbeb88929 | |||
227e914b7b | |||
3648c69ce4 | |||
ca63d4b0eb | |||
8032e23cce | |||
514fd70e0c | |||
26c481e1a4 | |||
7a1e57f50c | |||
af9197e6b5 | |||
ecd9415662 | |||
cbfdacb596 | |||
ad2ccf92a1 | |||
e520364785 | |||
5de3939b9b | |||
a3dfb09942 | |||
6da21b0cbe | |||
f7473564b9 | |||
6e3f310214 | |||
7c5f30ff50 | |||
371424b3ce | |||
5ba5645201 | |||
8b3444e647 | |||
66473203ba | |||
5fe9fffdee | |||
2364aaa754 | |||
de877d9cbb | |||
f742ea5485 | |||
bae3a16e30 | |||
1355d4dd75 | |||
b5b4795f4c | |||
d5dc41ccf5 | |||
d2dc18fd6a | |||
a0770054ca | |||
1d8e1bc60d | |||
89ac0e19dd | |||
9d972355fd | |||
7cee839119 | |||
d2aa6e84d2 | |||
31fa5e40c8 | |||
f919a6a4b1 | |||
019b2cf4db | |||
64c352064e | |||
c50f7f7ccc | |||
c8f64a50b0 | |||
558824003b | |||
69d6b1af1d | |||
2cebb66134 | |||
52a425a5d2 | |||
21928ba53a | |||
452ab4773f | |||
9bd34c4f97 | |||
99750ccacb | |||
99590563fc | |||
d9cde5b0d8 | |||
2788be53ce | |||
b1bffc6e99 | |||
d1b951b4b1 | |||
71ddc62366 | |||
9bc9ff8085 | |||
c2ea986d3a | |||
d54b8a730f | |||
a2be2c9e93 | |||
cc38391e7c | |||
fbf05b6dcd | |||
ed14c2d01a | |||
c95c525ffb | |||
0ace1efadc | |||
c8595543f9 | |||
94b6a5cea3 | |||
d97717f8f8 | |||
3c585c06a3 | |||
7bfd168d74 | |||
19298f4deb | |||
54bdf107e2 | |||
721302d651 | |||
3ffda43a52 | |||
ae2a1b578a | |||
147c7e7fb0 | |||
906b329c2e | |||
1bf81cfd82 | |||
c9f173d6b0 | |||
c43fafae1b | |||
3b2fa72d26 | |||
91d4ec10b7 | |||
aa1b898b22 | |||
aa21c1219b | |||
bc380077fb | |||
fc9929e9cc | |||
a26ad72b67 | |||
38a70e4979 | |||
4a1425b73b | |||
01c118373e | |||
7535d67661 | |||
eb369dcdc8 | |||
da104d0a63 | |||
c6ed261fe4 | |||
012db5ad26 | |||
f02f7ad211 | |||
c29567114d | |||
d66880f9b2 | |||
5e070e1875 | |||
dd780ad29d | |||
d2165d23bf | |||
d9d0f129b5 | |||
c8d56e62a2 | |||
67bd6ad36f | |||
1a924058a1 | |||
8f81b4d795 | |||
9edd3a53ce | |||
91a6164663 | |||
5a7e052ac4 | |||
6ba3617e32 | |||
c32c91829b | |||
b021935b10 | |||
3d99bf35fd | |||
c5f8ace5d2 | |||
b0149c293e | |||
925172cf86 | |||
aa3290243b | |||
2e7dad444b | |||
6e56bf7425 | |||
dfc1593022 | |||
5fe98a04e8 | |||
59c0c3aabf | |||
c885ff1cfb | |||
8c206b7ad6 | |||
2bccb1745a | |||
b66c757c51 | |||
1e76a2382d | |||
798ff553b5 | |||
5b71adc323 | |||
5a038697bc | |||
5b99564a75 |
1
.gitbook.yaml
Normal file
1
.gitbook.yaml
Normal file
@ -0,0 +1 @@
|
|||||||
|
root: ./docs/
|
38
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
38
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
---
|
||||||
|
name: Bug report
|
||||||
|
about: Create a report to help us improve
|
||||||
|
title: ''
|
||||||
|
labels: ''
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Describe the bug**
|
||||||
|
A clear and concise description of what the bug is.
|
||||||
|
|
||||||
|
**To Reproduce**
|
||||||
|
Steps to reproduce the behavior:
|
||||||
|
1. Go to '...'
|
||||||
|
2. Click on '....'
|
||||||
|
3. Scroll down to '....'
|
||||||
|
4. See error
|
||||||
|
|
||||||
|
**Expected behavior**
|
||||||
|
A clear and concise description of what you expected to happen.
|
||||||
|
|
||||||
|
**Screenshots**
|
||||||
|
If applicable, add screenshots to help explain your problem.
|
||||||
|
|
||||||
|
**Desktop (please complete the following information):**
|
||||||
|
- OS: [e.g. iOS]
|
||||||
|
- Browser [e.g. chrome, safari]
|
||||||
|
- Version [e.g. 22]
|
||||||
|
|
||||||
|
**Smartphone (please complete the following information):**
|
||||||
|
- Device: [e.g. iPhone6]
|
||||||
|
- OS: [e.g. iOS8.1]
|
||||||
|
- Browser [e.g. stock browser, safari]
|
||||||
|
- Version [e.g. 22]
|
||||||
|
|
||||||
|
**Additional context**
|
||||||
|
Add any other context about the problem here.
|
20
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
20
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
---
|
||||||
|
name: Feature request
|
||||||
|
about: Suggest an idea for this project
|
||||||
|
title: ''
|
||||||
|
labels: ''
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Is your feature request related to a problem? Please describe.**
|
||||||
|
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||||
|
|
||||||
|
**Describe the solution you'd like**
|
||||||
|
A clear and concise description of what you want to happen.
|
||||||
|
|
||||||
|
**Describe alternatives you've considered**
|
||||||
|
A clear and concise description of any alternative solutions or features you've considered.
|
||||||
|
|
||||||
|
**Additional context**
|
||||||
|
Add any other context or screenshots about the feature request here.
|
5
.github/pull_request_template.md
vendored
5
.github/pull_request_template.md
vendored
@ -11,7 +11,8 @@ Please delete options that are not relevant.
|
|||||||
- [ ] Bug fix (non-breaking change which fixes an issue)
|
- [ ] Bug fix (non-breaking change which fixes an issue)
|
||||||
- [ ] New feature (non-breaking change which adds functionality)
|
- [ ] New feature (non-breaking change which adds functionality)
|
||||||
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
|
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
|
||||||
- [ ] This change requires a documentation update
|
- [ ] Documentation
|
||||||
|
- [ ] Chore
|
||||||
|
|
||||||
# How Has This Been Tested?
|
# How Has This Been Tested?
|
||||||
|
|
||||||
@ -23,7 +24,7 @@ Please describe the tests that you ran to verify your changes.
|
|||||||
- [ ] I have performed a self-review of my own code
|
- [ ] I have performed a self-review of my own code
|
||||||
- [ ] I have commented my code, particularly in hard-to-understand areas
|
- [ ] I have commented my code, particularly in hard-to-understand areas
|
||||||
- [ ] I have made corresponding changes to the documentation
|
- [ ] I have made corresponding changes to the documentation
|
||||||
- [ ] I have updated the CHANGELOG and bumped the version
|
- [ ] I have updated the CHANGELOG in the `Unreleased` section
|
||||||
- [ ] My changes generate no new warnings
|
- [ ] My changes generate no new warnings
|
||||||
- [ ] I have added tests that prove my fix is effective or that my feature works
|
- [ ] I have added tests that prove my fix is effective or that my feature works
|
||||||
- [ ] New and existing unit tests pass locally with my changes
|
- [ ] New and existing unit tests pass locally with my changes
|
||||||
|
12
.github/workflows/autoupdate.yml
vendored
Normal file
12
.github/workflows/autoupdate.yml
vendored
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
name: autoupdate
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ main ]
|
||||||
|
jobs:
|
||||||
|
autoupdate:
|
||||||
|
name: autoupdate
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: docker://chinthakagodawita/autoupdate-action:v1
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
|
40
.github/workflows/pr_checks.yml
vendored
40
.github/workflows/pr_checks.yml
vendored
@ -4,36 +4,28 @@ jobs:
|
|||||||
lint:
|
lint:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
- name: Set up JDK 11
|
- name: Set up JDK 17
|
||||||
uses: actions/setup-java@v2
|
uses: actions/setup-java@v3
|
||||||
with:
|
with:
|
||||||
distribution: 'adopt'
|
distribution: 'adopt'
|
||||||
java-version: '11'
|
java-version: '17'
|
||||||
- name: Cache Gradle packages
|
- name: Lint
|
||||||
uses: actions/cache@v2
|
uses: burrunan/gradle-cache-action@v1
|
||||||
with:
|
with:
|
||||||
path: ~/.gradle/caches
|
gradle-version: wrapper
|
||||||
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle.kts') }}
|
arguments: detekt
|
||||||
restore-keys: ${{ runner.os }}-gradle
|
|
||||||
- name: Lint using detekt
|
|
||||||
run: ./gradlew detekt
|
|
||||||
unit:
|
unit:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
- name: Set up JDK 11
|
- name: Set up JDK 17
|
||||||
uses: actions/setup-java@v2
|
uses: actions/setup-java@v3
|
||||||
with:
|
with:
|
||||||
distribution: 'adopt'
|
distribution: 'adopt'
|
||||||
java-version: '11'
|
java-version: '17'
|
||||||
- name: Cache Gradle packages
|
- name: Unit Tests
|
||||||
uses: actions/cache@v2
|
uses: burrunan/gradle-cache-action@v1
|
||||||
with:
|
with:
|
||||||
path: ~/.gradle/caches
|
gradle-version: wrapper
|
||||||
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle.kts') }}
|
arguments: test koverMergedReport
|
||||||
restore-keys: ${{ runner.os }}-gradle
|
|
||||||
- name: Assemble with Gradle
|
|
||||||
run: ./gradlew assemble
|
|
||||||
- name: Run Unit Tests
|
|
||||||
run: ./gradlew test
|
|
||||||
|
22
.github/workflows/publish.yml
vendored
22
.github/workflows/publish.yml
vendored
@ -2,22 +2,24 @@ name: Publish to GitHub Packages
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ main ]
|
branches: [ main ]
|
||||||
|
paths-ignore:
|
||||||
|
- docs/**
|
||||||
|
env:
|
||||||
|
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SONATYPE_SIGNING_KEY }}
|
||||||
|
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SONATYPE_SIGNING_PASSWORD }}
|
||||||
jobs:
|
jobs:
|
||||||
publish:
|
publish:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
- uses: actions/setup-java@v2
|
- uses: actions/setup-java@v3
|
||||||
with:
|
with:
|
||||||
distribution: 'adopt'
|
distribution: 'adopt'
|
||||||
java-version: '11'
|
java-version: '17'
|
||||||
- name: Cache Gradle packages
|
- name: Publish to GitHub Packages
|
||||||
uses: actions/cache@v2
|
uses: burrunan/gradle-cache-action@v1
|
||||||
with:
|
with:
|
||||||
path: ~/.gradle/caches
|
gradle-version: wrapper
|
||||||
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle.kts') }}
|
arguments: publishAllPublicationsToGithubPackagesRepository
|
||||||
restore-keys: ${{ runner.os }}-gradle
|
|
||||||
- name: Publish package
|
|
||||||
run: ./gradlew publish
|
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
29
.github/workflows/release.yml
vendored
29
.github/workflows/release.yml
vendored
@ -1,25 +1,28 @@
|
|||||||
name: Publish to GitHub Packages
|
name: Publish Release
|
||||||
on:
|
on:
|
||||||
release:
|
release:
|
||||||
types:
|
types:
|
||||||
- prereleased
|
- prereleased
|
||||||
- released
|
- released
|
||||||
|
env:
|
||||||
|
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SONATYPE_SIGNING_KEY }}
|
||||||
|
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SONATYPE_SIGNING_PASSWORD }}
|
||||||
jobs:
|
jobs:
|
||||||
publish:
|
publish-to-nexus:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
- uses: actions/setup-java@v2
|
- uses: actions/setup-java@v3
|
||||||
with:
|
with:
|
||||||
distribution: 'adopt'
|
distribution: 'adopt'
|
||||||
java-version: '11'
|
java-version: '17'
|
||||||
- name: Cache Gradle packages
|
- name: Publish to Maven Central
|
||||||
uses: actions/cache@v2
|
uses: burrunan/gradle-cache-action@v1
|
||||||
with:
|
with:
|
||||||
path: ~/.gradle/caches
|
gradle-version: wrapper
|
||||||
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle.kts') }}
|
arguments: publishToSonatype closeAndReleaseSonatypeStagingRepository
|
||||||
restore-keys: ${{ runner.os }}-gradle
|
properties: |
|
||||||
- name: Publish package
|
release=true
|
||||||
run: ./gradlew publish -Prelease=true
|
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.SONATYPE_USER }}
|
||||||
|
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.SONATYPE_PASSWORD }}
|
||||||
|
4
.gitignore
vendored
4
.gitignore
vendored
@ -1,7 +1,3 @@
|
|||||||
# Ignore Gradle project-specific cache directory
|
|
||||||
.gradle
|
.gradle
|
||||||
|
|
||||||
# Ignore Gradle build output directory
|
|
||||||
build
|
build
|
||||||
|
|
||||||
.idea
|
.idea
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
kotlin 1.5.0-M2
|
|
||||||
java openjdk-14.0.1
|
|
||||||
gradle 7.0
|
|
396
CHANGELOG.md
396
CHANGELOG.md
@ -1,5 +1,391 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## Unreleased
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
### Remove
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Released
|
||||||
|
|
||||||
|
## [3.6.0] - November 5th, 2022
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Schemas for types in nullable properties are no longer nullable themselves
|
||||||
|
- Enums are now generated as references, which makes it possible to generate types for them
|
||||||
|
|
||||||
|
## [3.5.0] - October 29th, 2022
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- New `kompendium-resources` plugin to support Ktor Resources API
|
||||||
|
|
||||||
|
## [3.4.0] - October 26th, 2022
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Support for custom docs path
|
||||||
|
|
||||||
|
## [3.3.1] - September 26th, 2022
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Better exception thrown when unidentified type is encountered
|
||||||
|
|
||||||
|
## [3.3.0] - September 15th, 2022
|
||||||
|
|
||||||
|
### Added
|
||||||
|
- Support for @Transient annotation
|
||||||
|
- Support for @SerialName annotation on fields
|
||||||
|
- Supports for un-backed fields, by excluding them from the generated schema.
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
- Actually turned on detekt formatting 🤦
|
||||||
|
- Removed some rouge print statements
|
||||||
|
|
||||||
|
## Released
|
||||||
|
|
||||||
|
## [3.2.0] - August 23rd, 2022
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- `SchemaConfigurator` to allow for advanced json schema configuration such as field level overrides and transient
|
||||||
|
omission
|
||||||
|
|
||||||
|
## [3.1.0] - August 18th, 2022
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Ability to automatically detect authentication via route
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Improved stack trace output
|
||||||
|
|
||||||
|
## [3.0.0] - August 16th, 2022
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Ktor 2 Support 🎉
|
||||||
|
- OpenAPI 3.1 Standard
|
||||||
|
- JsonSchema Generator
|
||||||
|
- `NotarizedRoute` plugin
|
||||||
|
|
||||||
|
### Removed
|
||||||
|
|
||||||
|
- SwaggerUI module removed (due to lack of OpenAPI 3.1 support)
|
||||||
|
- Kompendium Annotations removed (field renames, undeclared fields, etc. will be follow-up work)
|
||||||
|
|
||||||
|
## [2.3.5] - June 7th, 2022
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Fix serialization for api key location in api key auth configuration
|
||||||
|
|
||||||
|
### Remove
|
||||||
|
|
||||||
|
## [2.3.4] - April 7th, 2022
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Put request body info now nullable
|
||||||
|
|
||||||
|
## [2.3.3] - April 1st, 2022
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Added tests for Swagger UI module that verify that plugin generates correct responses for Swagger UI WEB resources (
|
||||||
|
tests should detect future incompatible changes in new versions of `org.webjars.swagger-ui`)
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Fixed broken Swagger UI plugin (`org.webjars.swagger-ui` WEB resources structure changed in version 4.9.X).
|
||||||
|
Issue: https://github.com/bkbnio/kompendium/issues/236
|
||||||
|
|
||||||
|
## [2.3.2] - March 30th, 2022
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Fixed bug where nullable enum fields caused runtime exceptions
|
||||||
|
|
||||||
|
## [2.3.1] - March 5th, 2022
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Can now apply `@FreeFormObject` to top level types
|
||||||
|
|
||||||
|
## [2.3.0] - March 1st, 2022
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Brand new SwaggerUI support as a KTor plugin with WebJar under the hood and flexible configuration
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Playground example `SwaggerPlaygound` now demonstrates new SwaggerUI KTor plugin usage (including OAuth security)
|
||||||
|
|
||||||
|
### Remove
|
||||||
|
|
||||||
|
- Deprecated Swagger Webjar approach was removed from codebase
|
||||||
|
|
||||||
|
## [2.2.1] - February 26th, 2022
|
||||||
|
|
||||||
|
- Fix to support sealed class typed Maps
|
||||||
|
|
||||||
|
## [2.2.0] - February 25th, 2022
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Fixed support Location classes located in other non-location classes
|
||||||
|
- Fixed formatting of a custom `SimpleSchema`
|
||||||
|
- Multipart form-data multiple file request support
|
||||||
|
|
||||||
|
## [2.1.1] - February 19th, 2022
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Fixed sealed typed collections schema generation
|
||||||
|
- Nullability no longer breaks object schema comparison
|
||||||
|
|
||||||
|
## [2.1.0] - February 18th, 2022
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Ability to override serializer via custom route
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- All complex types are now represented by reference schemas
|
||||||
|
- Deprecated `@Referenced` since all complex types now create references
|
||||||
|
|
||||||
|
## [2.0.4] - February 10th, 2022
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Custom Type example to playground
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Cleaned up and broke out handlers into separate classes
|
||||||
|
- Serializer cleanup
|
||||||
|
- Tests now run against Jackson, Gson and kotlinx on every run
|
||||||
|
- Swagger UI bumped from v3 to v4
|
||||||
|
|
||||||
|
## [2.0.3] - February 7th, 2022
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Fixed swagger documentation bug
|
||||||
|
- Deprecated Swagger Webjar approach
|
||||||
|
|
||||||
|
## [2.0.2] - February 4th, 2022
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- `@Referenced` annotation enabling support for recursive models
|
||||||
|
|
||||||
|
## [2.0.1] - January 23rd, 2022
|
||||||
|
|
||||||
|
### Change
|
||||||
|
|
||||||
|
- Fix bug in documentation publishing pipeline
|
||||||
|
|
||||||
|
## [2.0.0] - January 23rd, 2022
|
||||||
|
|
||||||
|
Major Release 🎉 As we head towards the Ktor 2 release, this library will be kept compatible with Ktor 1. A future
|
||||||
|
Kompendium 2 repository will be created soon, porting much of the changes you see here, with some awesome Ktor 2 twists
|
||||||
|
😉
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Support for HTTP Patch, Head, and Options methods
|
||||||
|
- Support for including parameter examples via `MethodInfo`
|
||||||
|
- Dokka Pipeline Generation
|
||||||
|
- GitHub Pages integration
|
||||||
|
- Sourdough Gradle updates
|
||||||
|
- Support for OAuth authentication
|
||||||
|
- Gradle Toolchain feature to ensure match between local JDK and compile target
|
||||||
|
- Dokka integration
|
||||||
|
- Post-processing callback hook
|
||||||
|
- `description` key to KompendiumField
|
||||||
|
- Set of base constraints for simple and formatted types
|
||||||
|
- Ability to document expected unstructured data
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Kompendium now leverages the chosen API serializer. Supports Jackson, Gson and Kotlinx Serialization
|
||||||
|
- Fixed bug where overridden field names were not reflected in serialized object and required array
|
||||||
|
- Fixed bug where Ktor Location parents were not being scanned for parameters
|
||||||
|
- `$ref` types are no longer generated, instead all objects are defined explicitly
|
||||||
|
- All OpenAPI domain models moved to a separate module `kompendium-oas`
|
||||||
|
- Moved all files in `kompendium-core` into `io.bkbn.kompendium.core` package from `io.bkbn.kompendium`
|
||||||
|
- Gradle bumped to 7.3.2
|
||||||
|
- Gradle build logic offloaded to Sourdough Plugin
|
||||||
|
- Minimum supported Java version is now 11
|
||||||
|
- Bumped Kotlin to 1.6
|
||||||
|
- Annotations now live in a separate module. (Should not impact end users as module is imported as api dependency by
|
||||||
|
core).
|
||||||
|
- Kotest as the testing framework of choice
|
||||||
|
- Path calculation removed in favor of built-in route toString
|
||||||
|
- Ktor to 1.6.7
|
||||||
|
- Completely reworked authentication and exceptions
|
||||||
|
- MethodInfo now exists in a separate package as a sealed interface, each implementation also has its own file
|
||||||
|
- Kompendium is now a Ktor Plugin!
|
||||||
|
- GitHub Actions now leverage Gradle Wrapper
|
||||||
|
- Dropped Codacy support b/c codacy kinda sucks
|
||||||
|
- Fixed bug where KompendiumField was being completely ignored
|
||||||
|
- Redid playground to serve as a showcase for various functionality
|
||||||
|
- README updates
|
||||||
|
- Refactored `handleComplexType` 🎉
|
||||||
|
- Enabled field descriptions
|
||||||
|
- Dropped Version Catalog
|
||||||
|
- Responses are now a map of _actual_ responses rather than generic payloads
|
||||||
|
- Fixed bug where params with default values were listed as required
|
||||||
|
- Made empty put/post request info opt-in rather than default
|
||||||
|
- Fields are now marked as required when there is no default, and they are non-nullable
|
||||||
|
- `KompendiumField` and 'KompendiumParam' renamed to `Field` and `Param` respectively
|
||||||
|
- Description dropped from `Param`
|
||||||
|
- Dropped unnecessary parameter content scanning method
|
||||||
|
- Fixed bug causing all request bodies to be marked as optional
|
||||||
|
- Dropped ASDF tool manifest
|
||||||
|
|
||||||
|
## [1.11.1] - November 25th, 2021
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Documentation showing how to add header names using Kotlin backtick convention
|
||||||
|
|
||||||
|
## [1.11.0] - November 25th, 2021
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Support for Ktor Location Plugin
|
||||||
|
|
||||||
|
## [1.10.0] - November 25th, 2021
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Added `operationId` parameter to `MethodInfo`
|
||||||
|
|
||||||
|
## [1.9.2] - October 24th, 2021
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Jackson ObjectMapper passed by parameter to openapi module
|
||||||
|
- Added serializable annotation to ExceptionResponse
|
||||||
|
|
||||||
|
## [1.9.1] - October 17th, 2021
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Code Coverage removed from PR checks due to limitations with GitHub workflows
|
||||||
|
- Minor linting fixes
|
||||||
|
- Detekt now builds off of default config
|
||||||
|
|
||||||
|
## [1.9.0] - october 15th, 2021
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- ByteArray added to the set of default types
|
||||||
|
|
||||||
|
## [1.8.1] - October 4th, 2021
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Codacy integration
|
||||||
|
|
||||||
|
## [1.8.0] - October 4th, 2021
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Path calculation revamped to allow for simpler selector injection
|
||||||
|
- Kotlin version bumped to 1.5.31
|
||||||
|
- Ktor version bumped to 1.6.4
|
||||||
|
|
||||||
|
## [1.7.0] - August 14th, 2021
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Added ability to inject an emergency `UndeclaredField` in the event of certain polymorphic serializers and such
|
||||||
|
|
||||||
|
## [1.6.0] - August 12th, 2021
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Ability to add custom type schema overrides for edge case types.
|
||||||
|
|
||||||
|
## [1.5.1] - August 12th, 2021
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Fixed bug where polymorphic types were not being rendered correctly when part of collections and maps
|
||||||
|
|
||||||
|
## [1.5.0] - July 25th, 2021
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Added support for BigInteger and BigDecimal in response types
|
||||||
|
|
||||||
|
## [1.4.0] - July 22nd, 2021
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Decreased jvmTarget version from 11 to 1.8
|
||||||
|
|
||||||
|
## [1.3.0] - June 4th, 2021
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Explicitly encode JSON object by default
|
||||||
|
|
||||||
|
## [1.2.3] - June 3rd, 2021
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Updates showing/explaining serializer agnostic approach
|
||||||
|
|
||||||
|
## [1.2.2] - May 23rd, 2021
|
||||||
|
|
||||||
|
This is just to get my repo back to normal now that I have confirmed sonatype publish is happening
|
||||||
|
|
||||||
|
## [1.2.0] - May 23rd, 2021
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Finally, successfully pushed to Maven Central!!!
|
||||||
|
|
||||||
|
## [1.1.0] - May 19th, 2021
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Support for sealed classes 🔥
|
||||||
|
- Support for generic classes ☄️
|
||||||
|
|
||||||
|
## [1.0.1] - May 10th, 2021
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- a word to sweep my rude commit message to Nexus under the rug
|
||||||
|
|
||||||
|
## [1.0.0] - May 9th, 2021
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- SonaType integration to publish to MavenCentral
|
||||||
|
|
||||||
|
### [1.0.0-rc] - May 8th, 2021
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Migrated to io.bkbn group and package name
|
||||||
|
|
||||||
### [1.0.0-beta] - May 6th, 2021
|
### [1.0.0-beta] - May 6th, 2021
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
@ -28,7 +414,7 @@
|
|||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
- Support for example request and response bodies. Parameter examples / defaults are a separate issue for later.
|
- Support for example request and response bodies. Parameter examples / defaults are a separate issue for later.
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
@ -77,7 +463,8 @@
|
|||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
- Added an explicit `PathCalculator` interface to allow for easier handling of routes external to the core set of Ktor route selectors.
|
- Added an explicit `PathCalculator` interface to allow for easier handling of routes external to the core set of Ktor
|
||||||
|
route selectors.
|
||||||
|
|
||||||
## [0.5.1] - April 19th, 2021
|
## [0.5.1] - April 19th, 2021
|
||||||
|
|
||||||
@ -168,12 +555,13 @@
|
|||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
- Beginning of an implementation. Currently, able to generate a rough outline of the API at runtime, along with generating
|
- Beginning of an implementation. Currently, able to generate a rough outline of the API at runtime, along with
|
||||||
full data classes represented by JSON Schema.
|
generating full data classes represented by JSON Schema.
|
||||||
|
|
||||||
## [0.0.1] - April 11th, 2021
|
## [0.0.1] - April 11th, 2021
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
- Added _most_ of the data classes necessary for generating an [Open API Spec](https://swagger.io/specification)
|
- Added _most_ of the data classes necessary for generating an [Open API Spec](https://swagger.io/specification)
|
||||||
- Added playground to allow users to tinker with a live Ktor api in conjunction with development
|
- Added playground to allow users to tinker with a live Ktor api in conjunction with development
|
||||||
- Added all standard OSS files
|
- Added all standard OSS files
|
||||||
|
80
CODE_OF_CONDUCT.md
Normal file
80
CODE_OF_CONDUCT.md
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
# Contributor Covenant Code of Conduct
|
||||||
|
|
||||||
|
## Our Pledge
|
||||||
|
|
||||||
|
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
|
||||||
|
|
||||||
|
We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
|
||||||
|
|
||||||
|
## Our Standards
|
||||||
|
|
||||||
|
Examples of behavior that contributes to a positive environment for our community include:
|
||||||
|
|
||||||
|
* Demonstrating empathy and kindness toward other people
|
||||||
|
* Being respectful of differing opinions, viewpoints, and experiences
|
||||||
|
* Giving and gracefully accepting constructive feedback
|
||||||
|
* Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
|
||||||
|
* Focusing on what is best not just for us as individuals, but for the overall community
|
||||||
|
|
||||||
|
Examples of unacceptable behavior include:
|
||||||
|
|
||||||
|
* The use of sexualized language or imagery, and sexual attention or advances of any kind
|
||||||
|
* Trolling, insulting or derogatory comments, and personal or political attacks
|
||||||
|
* Public or private harassment
|
||||||
|
* Publishing others' private information, such as a physical or email address, without their explicit permission
|
||||||
|
* Contacting individual members, contributors, or leaders privately, outside designated community mechanisms, without their explicit permission
|
||||||
|
* Other conduct which could reasonably be considered inappropriate in a professional setting
|
||||||
|
|
||||||
|
## Enforcement Responsibilities
|
||||||
|
|
||||||
|
Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
|
||||||
|
|
||||||
|
Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
|
||||||
|
|
||||||
|
## Scope
|
||||||
|
|
||||||
|
This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
|
||||||
|
|
||||||
|
## Enforcement
|
||||||
|
|
||||||
|
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at opensource@github.com. All complaints will be reviewed and investigated promptly and fairly.
|
||||||
|
|
||||||
|
All community leaders are obligated to respect the privacy and security of the reporter of any incident.
|
||||||
|
|
||||||
|
## Enforcement Guidelines
|
||||||
|
|
||||||
|
Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
|
||||||
|
|
||||||
|
### 1. Correction
|
||||||
|
|
||||||
|
**Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
|
||||||
|
|
||||||
|
**Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
|
||||||
|
|
||||||
|
### 2. Warning
|
||||||
|
|
||||||
|
**Community Impact**: A violation through a single incident or series of actions.
|
||||||
|
|
||||||
|
**Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
|
||||||
|
|
||||||
|
### 3. Temporary Ban
|
||||||
|
|
||||||
|
**Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
|
||||||
|
|
||||||
|
**Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
|
||||||
|
|
||||||
|
### 4. Permanent Ban
|
||||||
|
|
||||||
|
**Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
|
||||||
|
|
||||||
|
**Consequence**: A permanent ban from any sort of public interaction within the community.
|
||||||
|
|
||||||
|
## Attribution
|
||||||
|
|
||||||
|
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0, available at <https://www.contributor-covenant.org/version/2/0/code_of_conduct.html>.
|
||||||
|
|
||||||
|
Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
|
||||||
|
|
||||||
|
[homepage]: https://www.contributor-covenant.org
|
||||||
|
|
||||||
|
For answers to common questions about this code of conduct, see the FAQ at <https://www.contributor-covenant.org/faq>. Translations are available at <https://www.contributor-covenant.org/translations>.
|
73
CONTRIBUTING.md
Normal file
73
CONTRIBUTING.md
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
# Welcome to Kompendium contributing guide <!-- omit in toc -->
|
||||||
|
|
||||||
|
Thank you for investing your time in contributing to our project! Any contribution you make will help build the best OpenAPI generator for Ktor :sparkles:.
|
||||||
|
|
||||||
|
Read our [Code of Conduct](./CODE_OF_CONDUCT.md) to keep our community approachable and respectable.
|
||||||
|
|
||||||
|
In this guide you will get an overview of the contribution workflow from opening an issue, creating a PR, reviewing, and merging the PR.
|
||||||
|
|
||||||
|
Use the table of contents icon in the top left corner of this document to get to a specific section of this guide quickly.
|
||||||
|
|
||||||
|
## New contributor guide
|
||||||
|
|
||||||
|
To get an overview of the project, read the [README](README.md). Here are some resources to help you get started with open source contributions:
|
||||||
|
|
||||||
|
- [Finding ways to contribute to open source on GitHub](https://docs.github.com/en/get-started/exploring-projects-on-github/finding-ways-to-contribute-to-open-source-on-github)
|
||||||
|
- [Set up Git](https://docs.github.com/en/get-started/quickstart/set-up-git)
|
||||||
|
- [GitHub flow](https://docs.github.com/en/get-started/quickstart/github-flow)
|
||||||
|
- [Collaborating with pull requests](https://docs.github.com/en/github/collaborating-with-pull-requests)
|
||||||
|
|
||||||
|
|
||||||
|
## Getting started
|
||||||
|
|
||||||
|
The best way to get started with Kompendium is to read the [docs](https://bkbn.gitbook.io/kompendium).
|
||||||
|
|
||||||
|
If live examples are more your thing, inside the `kompendium-playground` module, you will find a collection of starter
|
||||||
|
examples ranging from simple CRUD and authentication examples, to more advanced topics like polymorphic serialization
|
||||||
|
and custom type overrides.
|
||||||
|
|
||||||
|
### Issues
|
||||||
|
|
||||||
|
#### Create a new issue
|
||||||
|
|
||||||
|
If you've discovered an issue with Kompendium, or have an idea for a new feature, [search if an issue already exists](https://docs.github.com/en/github/searching-for-information-on-github/searching-on-github/searching-issues-and-pull-requests#search-by-the-title-body-or-comments). If a related issue doesn't exist, you can open a new issue using a relevant [issue form](https://github.com/bkbnio/kompendium/issues/new/choose).
|
||||||
|
|
||||||
|
#### Solve an issue
|
||||||
|
|
||||||
|
Scan through our [existing issues](https://github.com/bkbnio/kompendium/issues) to find one that interests you. As a general rule, issue assignment is informal and not required. If you find an issue to work on, you are welcome to open a PR with a fix.
|
||||||
|
|
||||||
|
### Make Changes
|
||||||
|
|
||||||
|
#### Make changes locally
|
||||||
|
|
||||||
|
1. Fork the repository.
|
||||||
|
- Using GitHub Desktop:
|
||||||
|
- [Getting started with GitHub Desktop](https://docs.github.com/en/desktop/installing-and-configuring-github-desktop/getting-started-with-github-desktop) will guide you through setting up Desktop.
|
||||||
|
- Once Desktop is set up, you can use it to [fork the repo](https://docs.github.com/en/desktop/contributing-and-collaborating-using-github-desktop/cloning-and-forking-repositories-from-github-desktop)!
|
||||||
|
|
||||||
|
- Using the command line:
|
||||||
|
- [Fork the repo](https://docs.github.com/en/github/getting-started-with-github/fork-a-repo#fork-an-example-repository) so that you can make your changes without affecting the original project until you're ready to merge them.
|
||||||
|
|
||||||
|
- GitHub Codespaces:
|
||||||
|
- [Fork, edit, and preview](https://docs.github.com/en/free-pro-team@latest/github/developing-online-with-codespaces/creating-a-codespace) using [GitHub Codespaces](https://github.com/features/codespaces) without having to install and run the project locally.
|
||||||
|
|
||||||
|
2. Install Java. Any version of Java 11+ should be fine.
|
||||||
|
|
||||||
|
3. Create a working branch and start with your changes!
|
||||||
|
|
||||||
|
### Commit your update
|
||||||
|
|
||||||
|
Commit the changes once you are happy with them. Git hooks are automatically installed via Gradle that will run the linter
|
||||||
|
on every commit, and run the tests prior to pushing your code. This helps speed up the review cycle immensely. If you would like
|
||||||
|
to push a draft PR that skips the hooks, you can simply add the `--no-verify` flag, ie `git commit --no-verify -m "commit message"`.
|
||||||
|
|
||||||
|
### Pull Request
|
||||||
|
|
||||||
|
When you're finished with the changes, you are ready to create a pull request! There is no hard and fast rules here, but
|
||||||
|
do your best to fill out the pull request template with all the requisite information!
|
||||||
|
|
||||||
|
### Your PR is merged!
|
||||||
|
|
||||||
|
Congratulations :tada::tada: The Kompendium team thanks you :sparkles:.
|
||||||
|
|
||||||
|
Once your PR is merged, it will go out in the next release cycle. We often keep these cycles super tight, it is not uncommon for each PR to get its own release.
|
209
README.md
209
README.md
@ -1,210 +1,5 @@
|
|||||||
# Kompendium
|
# Kompendium
|
||||||
|
|
||||||
## What is Kompendium
|
[](https://search.maven.org/search?q=io.bkbn%20kompendium)
|
||||||
|
|
||||||
Kompendium is intended to be a minimally invasive OpenApi Specification generator for [Ktor](https://ktor.io).
|
Documentation is stored in the `docs` folder and is hosted [here](https://bkbn.gitbook.io/kompendium)
|
||||||
Minimally invasive meaning that users will use only Ktor native functions when implementing their API, and will
|
|
||||||
supplement with Kompendium code in order to generate the appropriate spec.
|
|
||||||
|
|
||||||
## How to install
|
|
||||||
|
|
||||||
Kompendium uses GitHub packages as its repository. Installing with Gradle is pretty painless. In your `build.gradle.kts`
|
|
||||||
add the following
|
|
||||||
|
|
||||||
```kotlin
|
|
||||||
// 1 Setup a helper function to import any Github Repository Package
|
|
||||||
// This step is optional but I have a bunch of stuff stored on github so I find it useful 😄
|
|
||||||
fun RepositoryHandler.github(packageUrl: String) = maven {
|
|
||||||
name = "GithubPackages"
|
|
||||||
url = uri(packageUrl)
|
|
||||||
credentials { // TODO Not sure this is necessary for public repositories?
|
|
||||||
username = java.lang.System.getenv("GITHUB_USER")
|
|
||||||
password = java.lang.System.getenv("GITHUB_TOKEN")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 2 Add the repo in question (in this case Kompendium)
|
|
||||||
repositories {
|
|
||||||
github("https://maven.pkg.github.com/lg-backbone/kompendium")
|
|
||||||
}
|
|
||||||
|
|
||||||
// 3 Add the package like any normal dependency
|
|
||||||
dependencies {
|
|
||||||
implementation("org.leafygreens:kompendium-core:0.1.0-SNAPSHOT")
|
|
||||||
}
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
## In depth
|
|
||||||
|
|
||||||
### Notarized Routes
|
|
||||||
|
|
||||||
Kompendium introduces the concept of `notarized` HTTP methods. That is, for all your `GET`, `POST`, `PUT`, and `DELETE`
|
|
||||||
operations, there is a corresponding `notarized` method. These operations are strongly typed, and use reification for
|
|
||||||
a lot of the class based reflection that powers Kompendium. Generally speaking the three types that a `notarized` method
|
|
||||||
will consume are
|
|
||||||
|
|
||||||
- `TParam`: Used to notarize expected request parameters
|
|
||||||
- `TReq`: Used to build the object schema for a request body
|
|
||||||
- `TResp`: Used to build the object schema for a response body
|
|
||||||
|
|
||||||
`GET` and `DELETE` take `TParam` and `TResp` while `PUT` and `POST` take all three.
|
|
||||||
|
|
||||||
|
|
||||||
In addition to standard HTTP Methods, Kompendium also introduced the concept of `notarizedExceptions`. Using the `StatusPage`
|
|
||||||
extension, users can notarize all handled exceptions, along with their respective HTTP codes and response types.
|
|
||||||
Exceptions that have been `notarized` require two types as supplemental information
|
|
||||||
|
|
||||||
- `TErr`: Used to notarize the exception being handled by this use case. Used for matching responses at the route level.
|
|
||||||
- `TResp`: Same as above, this dictates the expected return type of the error response.
|
|
||||||
|
|
||||||
In keeping with minimal invasion, these extension methods all consume the same code block as a standard Ktor route method,
|
|
||||||
meaning that swapping in a default Ktor route and a Kompendium `notarized` route is as simple as a single method change.
|
|
||||||
|
|
||||||
### Supplemental Annotations
|
|
||||||
|
|
||||||
In general, Kompendium tries to limit the number of annotations that developers need to use in order to get an app
|
|
||||||
integrated.
|
|
||||||
|
|
||||||
Currently, the annotations used by Kompendium are as follows
|
|
||||||
|
|
||||||
- `KompendiumField`
|
|
||||||
- `KompendiumParam`
|
|
||||||
|
|
||||||
The intended purpose of `KompendiumField` is to offer field level overrides such as naming conventions (ie snake instead of camel).
|
|
||||||
|
|
||||||
The purpose of `KompendiumParam` is to provide supplemental information needed to properly assign the type of parameter
|
|
||||||
(cookie, header, query, path) as well as other parameter-level metadata.
|
|
||||||
|
|
||||||
## Examples
|
|
||||||
|
|
||||||
The full source code can be found in the `kompendium-playground` module. Here is a simple get endpoint example
|
|
||||||
|
|
||||||
```kotlin
|
|
||||||
// Minimal API Example
|
|
||||||
fun Application.mainModule() {
|
|
||||||
install(StatusPages) {
|
|
||||||
notarizedException<Exception, ExceptionResponse>(
|
|
||||||
info = ResponseInfo(
|
|
||||||
KompendiumHttpCodes.BAD_REQUEST,
|
|
||||||
"Bad Things Happened"
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
call.respond(HttpStatusCode.BadRequest, ExceptionResponse("Why you do dis?"))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
routing {
|
|
||||||
openApi(oas)
|
|
||||||
redoc(oas)
|
|
||||||
swaggerUI()
|
|
||||||
route("/potato/spud") {
|
|
||||||
notarizedGet(simpleGetInfo) {
|
|
||||||
call.respond(HttpStatusCode.OK)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
val simpleGetInfo = GetInfo<Unit, ExampleResponse>(
|
|
||||||
summary = "Example Parameters",
|
|
||||||
description = "A test for setting parameter examples",
|
|
||||||
responseInfo = ResponseInfo(
|
|
||||||
status = 200,
|
|
||||||
description = "nice",
|
|
||||||
examples = mapOf("test" to ExampleResponse(c = "spud"))
|
|
||||||
),
|
|
||||||
canThrow = setOf(Exception::class)
|
|
||||||
)
|
|
||||||
```
|
|
||||||
|
|
||||||
### Kompendium Auth and security schemes
|
|
||||||
|
|
||||||
There is a separate library to handle security schemes: `kompendium-auth`.
|
|
||||||
This needs to be added to your project as dependency.
|
|
||||||
|
|
||||||
At the moment, the basic and jwt authentication is only supported.
|
|
||||||
|
|
||||||
A minimal example would be:
|
|
||||||
```kotlin
|
|
||||||
install(Authentication) {
|
|
||||||
notarizedBasic("basic") {
|
|
||||||
realm = "Ktor realm 1"
|
|
||||||
// configure basic authentication provider..
|
|
||||||
}
|
|
||||||
notarizedJwt("jwt") {
|
|
||||||
realm = "Ktor realm 2"
|
|
||||||
// configure jwt authentication provider...
|
|
||||||
}
|
|
||||||
}
|
|
||||||
routing {
|
|
||||||
authenticate("basic") {
|
|
||||||
route("/basic_auth") {
|
|
||||||
notarizedGet(basicAuthGetInfo) {
|
|
||||||
call.respondText { "basic auth" }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
authenticate("jwt") {
|
|
||||||
route("/jwt") {
|
|
||||||
notarizedGet(jwtAuthGetInfo) {
|
|
||||||
call.respondText { "jwt" }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
val basicAuthGetInfo = MethodInfo<Unit, ExampleResponse>(
|
|
||||||
summary = "Another get test",
|
|
||||||
description = "testing more",
|
|
||||||
responseInfo = testGetResponse,
|
|
||||||
securitySchemes = setOf("basic")
|
|
||||||
)
|
|
||||||
val jwtAuthGetInfo = basicAuthGetInfo.copy(securitySchemes = setOf("jwt"))
|
|
||||||
```
|
|
||||||
|
|
||||||
### Enabling Swagger ui
|
|
||||||
To enable Swagger UI, `kompendium-swagger-ui` needs to be added.
|
|
||||||
This will also add the [ktor webjars feature](https://ktor.io/docs/webjars.html) to your classpath as it is required for swagger ui.
|
|
||||||
Minimal Example:
|
|
||||||
```kotlin
|
|
||||||
install(Webjars)
|
|
||||||
routing {
|
|
||||||
openApi(oas)
|
|
||||||
swaggerUI()
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Enabling ReDoc
|
|
||||||
Unlike swagger, redoc is provided (perhaps confusingly, in the `core` module). This means out of the box with `kompendium-core`, you can add
|
|
||||||
[ReDoc](https://github.com/Redocly/redoc) as follows
|
|
||||||
|
|
||||||
```kotlin
|
|
||||||
routing {
|
|
||||||
openApi(oas)
|
|
||||||
redoc(oas)
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
## Limitations
|
|
||||||
|
|
||||||
### Kompendium as a singleton
|
|
||||||
|
|
||||||
Currently, Kompendium exists as a Kotlin object. This comes with a couple perks, but a couple downsides. Primarily,
|
|
||||||
it offers a seriously clean UX where the implementer doesn't need to worry about what instance to send data to. The main
|
|
||||||
drawback, however, is that you are limited to a single API per classpath.
|
|
||||||
|
|
||||||
If this is a blocker, please open a GitHub issue, and we can start to think out solutions!
|
|
||||||
|
|
||||||
## Future Work
|
|
||||||
Work on V1 of Kompendium has come to a close. This, however, does not mean it has achieved complete
|
|
||||||
parity with the OpenAPI feature spec, nor does it have all-of-the nice to have features that a truly next-gen API spec
|
|
||||||
should have. There are several outstanding features that have been added to the
|
|
||||||
[V2 Milestone](https://github.com/lg-backbone/kompendium/milestone/2). Among others, this includes
|
|
||||||
|
|
||||||
- Polymorphic support
|
|
||||||
- AsyncAPI Integration
|
|
||||||
- Field Validation
|
|
||||||
- MavenCentral Release
|
|
||||||
|
|
||||||
If you have a feature that you would like to see implemented that is not on this list, or discover a 🐞, please open
|
|
||||||
an issue [here](https://github.com/lg-backbone/kompendium/issues/new)
|
|
||||||
|
@ -1,62 +1,45 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id("org.jetbrains.kotlin.jvm") version "1.4.32" apply false
|
kotlin("jvm") version "1.7.20" apply false
|
||||||
id("io.gitlab.arturbosch.detekt") version "1.16.0-RC2" apply false
|
kotlin("plugin.serialization") version "1.7.20" apply false
|
||||||
id("com.adarshr.test-logger") version "3.0.0" apply false
|
id("io.bkbn.sourdough.library.jvm") version "0.12.0" apply false
|
||||||
|
id("io.bkbn.sourdough.application.jvm") version "0.12.0" apply false
|
||||||
|
id("io.bkbn.sourdough.root") version "0.12.0"
|
||||||
|
id("com.github.jakemarsden.git-hooks") version "0.0.2"
|
||||||
|
id("org.jetbrains.kotlinx.kover") version "0.6.1"
|
||||||
|
id("io.github.gradle-nexus.publish-plugin") version "1.1.0"
|
||||||
|
}
|
||||||
|
|
||||||
|
gitHooks {
|
||||||
|
setHooks(
|
||||||
|
mapOf(
|
||||||
|
"pre-commit" to "detekt",
|
||||||
|
"pre-push" to "test"
|
||||||
|
)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
group = "org.leafygreens"
|
group = "io.bkbn"
|
||||||
version = run {
|
version = run {
|
||||||
val baseVersion =
|
val baseVersion =
|
||||||
project.findProperty("project.version") ?: error("project.version must be set in gradle.properties")
|
project.findProperty("project.version") ?: error("project.version needs to be set in gradle.properties")
|
||||||
when ((project.findProperty("release") as? String)?.toBoolean()) {
|
when ((project.findProperty("release") as? String)?.toBoolean()) {
|
||||||
true -> baseVersion
|
true -> baseVersion
|
||||||
else -> "$baseVersion-SNAPSHOT"
|
else -> "$baseVersion-SNAPSHOT"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
repositories {
|
subprojects {
|
||||||
mavenCentral()
|
plugins.withType(io.bkbn.sourdough.gradle.library.jvm.LibraryJvmPlugin::class) {
|
||||||
maven { url = uri("https://maven.pkg.jetbrains.space/public/p/kotlinx-html/maven") }
|
extensions.configure(io.bkbn.sourdough.gradle.library.jvm.LibraryJvmExtension::class) {
|
||||||
}
|
githubOrg.set("bkbnio")
|
||||||
|
githubRepo.set("kompendium")
|
||||||
apply(plugin = "org.jetbrains.kotlin.jvm")
|
licenseName.set("MIT License")
|
||||||
apply(plugin = "io.gitlab.arturbosch.detekt")
|
licenseUrl.set("https://mit-license.org")
|
||||||
apply(plugin = "com.adarshr.test-logger")
|
developerId.set("unredundant")
|
||||||
apply(plugin = "idea")
|
developerName.set("Ryan Brink")
|
||||||
|
developerEmail.set("admin@bkbn.io")
|
||||||
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
|
|
||||||
kotlinOptions {
|
|
||||||
jvmTarget = "11"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
configure<com.adarshr.gradle.testlogger.TestLoggerExtension> {
|
|
||||||
setTheme("standard")
|
|
||||||
setLogLevel("lifecycle")
|
|
||||||
showExceptions = true
|
|
||||||
showStackTraces = true
|
|
||||||
showFullStackTraces = false
|
|
||||||
showCauses = true
|
|
||||||
slowThreshold = 2000
|
|
||||||
showSummary = true
|
|
||||||
showSimpleNames = false
|
|
||||||
showPassed = true
|
|
||||||
showSkipped = true
|
|
||||||
showFailed = true
|
|
||||||
showStandardStreams = false
|
|
||||||
showPassedStandardStreams = true
|
|
||||||
showSkippedStandardStreams = true
|
|
||||||
showFailedStandardStreams = true
|
|
||||||
}
|
|
||||||
|
|
||||||
configure<io.gitlab.arturbosch.detekt.extensions.DetektExtension> {
|
|
||||||
toolVersion = "1.16.0-RC2"
|
|
||||||
config = files("${rootProject.projectDir}/detekt.yml")
|
|
||||||
buildUponDefaultConfig = true
|
|
||||||
}
|
|
||||||
|
|
||||||
configure<JavaPluginExtension> {
|
|
||||||
withSourcesJar()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
3
codacy.yml
Normal file
3
codacy.yml
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
---
|
||||||
|
exclude_paths:
|
||||||
|
- "**/*.md"
|
72
core/build.gradle.kts
Normal file
72
core/build.gradle.kts
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
plugins {
|
||||||
|
kotlin("jvm")
|
||||||
|
kotlin("plugin.serialization")
|
||||||
|
id("io.bkbn.sourdough.library.jvm")
|
||||||
|
id("io.gitlab.arturbosch.detekt")
|
||||||
|
id("com.adarshr.test-logger")
|
||||||
|
id("maven-publish")
|
||||||
|
id("java-library")
|
||||||
|
id("signing")
|
||||||
|
id("java-test-fixtures")
|
||||||
|
id("org.jetbrains.kotlinx.kover")
|
||||||
|
}
|
||||||
|
|
||||||
|
sourdoughLibrary {
|
||||||
|
libraryName.set("Kompendium Core")
|
||||||
|
libraryDescription.set("Core functionality for the Kompendium library")
|
||||||
|
compilerArgs.set(listOf("-opt-in=kotlin.RequiresOptIn"))
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
// VERSIONS
|
||||||
|
val kotestVersion: String by project
|
||||||
|
val ktorVersion: String by project
|
||||||
|
val detektVersion: String by project
|
||||||
|
|
||||||
|
// IMPLEMENTATION
|
||||||
|
|
||||||
|
api(projects.kompendiumOas)
|
||||||
|
api(projects.kompendiumJsonSchema)
|
||||||
|
|
||||||
|
implementation("io.ktor:ktor-server-core:$ktorVersion")
|
||||||
|
implementation("io.ktor:ktor-server-cio:$ktorVersion")
|
||||||
|
implementation("io.ktor:ktor-server-html-builder:$ktorVersion")
|
||||||
|
implementation("io.ktor:ktor-server-content-negotiation:$ktorVersion")
|
||||||
|
implementation("io.ktor:ktor-serialization-kotlinx-json:$ktorVersion")
|
||||||
|
implementation("ch.qos.logback:logback-classic:1.4.4")
|
||||||
|
|
||||||
|
// Formatting
|
||||||
|
detektPlugins("io.gitlab.arturbosch.detekt:detekt-formatting:$detektVersion")
|
||||||
|
|
||||||
|
// TEST FIXTURES
|
||||||
|
|
||||||
|
testFixturesApi("io.kotest:kotest-runner-junit5-jvm:$kotestVersion")
|
||||||
|
testFixturesApi("io.kotest:kotest-assertions-core-jvm:$kotestVersion")
|
||||||
|
testFixturesApi("io.kotest:kotest-property-jvm:$kotestVersion")
|
||||||
|
testFixturesApi("io.kotest:kotest-assertions-json-jvm:$kotestVersion")
|
||||||
|
testFixturesApi("io.kotest:kotest-assertions-ktor-jvm:4.4.3")
|
||||||
|
|
||||||
|
testFixturesApi("io.ktor:ktor-server-core:$ktorVersion")
|
||||||
|
testFixturesApi("io.ktor:ktor-server-test-host:$ktorVersion")
|
||||||
|
testFixturesApi("io.ktor:ktor-serialization:$ktorVersion")
|
||||||
|
testFixturesApi("io.ktor:ktor-serialization-jackson:$ktorVersion")
|
||||||
|
testFixturesApi("io.ktor:ktor-serialization-gson:$ktorVersion")
|
||||||
|
testFixturesApi("io.ktor:ktor-serialization-kotlinx-json:$ktorVersion")
|
||||||
|
testFixturesApi("io.ktor:ktor-server-content-negotiation:$ktorVersion")
|
||||||
|
testFixturesApi("io.ktor:ktor-server-auth:$ktorVersion")
|
||||||
|
testFixturesApi("io.ktor:ktor-server-auth-jwt:$ktorVersion")
|
||||||
|
testFixturesApi("io.ktor:ktor-client:$ktorVersion")
|
||||||
|
testFixturesApi("io.ktor:ktor-client-cio:$ktorVersion")
|
||||||
|
|
||||||
|
testFixturesApi("dev.forst:ktor-api-key:2.1.3")
|
||||||
|
|
||||||
|
testFixturesApi("org.jetbrains.kotlinx:kotlinx-serialization-json:1.4.1")
|
||||||
|
}
|
||||||
|
|
||||||
|
testing {
|
||||||
|
suites {
|
||||||
|
named("test", JvmTestSuite::class) {
|
||||||
|
useJUnitJupiter()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,10 @@
|
|||||||
|
package io.bkbn.kompendium.core.attribute
|
||||||
|
|
||||||
|
import io.bkbn.kompendium.json.schema.SchemaConfigurator
|
||||||
|
import io.bkbn.kompendium.oas.OpenApiSpec
|
||||||
|
import io.ktor.util.AttributeKey
|
||||||
|
|
||||||
|
object KompendiumAttributes {
|
||||||
|
val openApiSpec = AttributeKey<OpenApiSpec>("OpenApiSpec")
|
||||||
|
val schemaConfigurator = AttributeKey<SchemaConfigurator>("SchemaConfigurator")
|
||||||
|
}
|
@ -0,0 +1,39 @@
|
|||||||
|
package io.bkbn.kompendium.core.metadata
|
||||||
|
|
||||||
|
import io.bkbn.kompendium.oas.common.ExternalDocumentation
|
||||||
|
import io.bkbn.kompendium.oas.payload.Parameter
|
||||||
|
|
||||||
|
class DeleteInfo private constructor(
|
||||||
|
override val response: ResponseInfo,
|
||||||
|
override val errors: MutableList<ResponseInfo>,
|
||||||
|
override val tags: Set<String>,
|
||||||
|
override val summary: String,
|
||||||
|
override val description: String,
|
||||||
|
override val externalDocumentation: ExternalDocumentation?,
|
||||||
|
override val operationId: String?,
|
||||||
|
override val deprecated: Boolean,
|
||||||
|
override val parameters: List<Parameter>
|
||||||
|
) : MethodInfo {
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
fun builder(init: Builder.() -> Unit): DeleteInfo {
|
||||||
|
val builder = Builder()
|
||||||
|
builder.init()
|
||||||
|
return builder.build()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class Builder : MethodInfo.Builder<DeleteInfo>() {
|
||||||
|
override fun build() = DeleteInfo(
|
||||||
|
response = response ?: error("Response info must be present"),
|
||||||
|
errors = errors,
|
||||||
|
tags = tags,
|
||||||
|
summary = summary ?: error("Summary must be present"),
|
||||||
|
description = description ?: error("Description must be present"),
|
||||||
|
externalDocumentation = externalDocumentation,
|
||||||
|
operationId = operationId,
|
||||||
|
deprecated = deprecated,
|
||||||
|
parameters = parameters
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,39 @@
|
|||||||
|
package io.bkbn.kompendium.core.metadata
|
||||||
|
|
||||||
|
import io.bkbn.kompendium.oas.common.ExternalDocumentation
|
||||||
|
import io.bkbn.kompendium.oas.payload.Parameter
|
||||||
|
|
||||||
|
class GetInfo private constructor(
|
||||||
|
override val response: ResponseInfo,
|
||||||
|
override val errors: MutableList<ResponseInfo>,
|
||||||
|
override val tags: Set<String>,
|
||||||
|
override val summary: String,
|
||||||
|
override val description: String,
|
||||||
|
override val externalDocumentation: ExternalDocumentation?,
|
||||||
|
override val operationId: String?,
|
||||||
|
override val deprecated: Boolean,
|
||||||
|
override val parameters: List<Parameter>
|
||||||
|
) : MethodInfo {
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
fun builder(init: Builder.() -> Unit): GetInfo {
|
||||||
|
val builder = Builder()
|
||||||
|
builder.init()
|
||||||
|
return builder.build()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class Builder : MethodInfo.Builder<GetInfo>() {
|
||||||
|
override fun build() = GetInfo(
|
||||||
|
response = response ?: error("You must provide a response in order to notarize a GET"),
|
||||||
|
errors = errors,
|
||||||
|
tags = tags,
|
||||||
|
summary = summary ?: error("You must provide a summary in order to notarize a GET"),
|
||||||
|
description = description ?: error("You must provide a description in order to notarize a GET"),
|
||||||
|
externalDocumentation = externalDocumentation,
|
||||||
|
operationId = operationId,
|
||||||
|
deprecated = deprecated,
|
||||||
|
parameters = parameters
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,39 @@
|
|||||||
|
package io.bkbn.kompendium.core.metadata
|
||||||
|
|
||||||
|
import io.bkbn.kompendium.oas.common.ExternalDocumentation
|
||||||
|
import io.bkbn.kompendium.oas.payload.Parameter
|
||||||
|
|
||||||
|
class HeadInfo private constructor(
|
||||||
|
override val response: ResponseInfo,
|
||||||
|
override val errors: MutableList<ResponseInfo>,
|
||||||
|
override val tags: Set<String>,
|
||||||
|
override val summary: String,
|
||||||
|
override val description: String,
|
||||||
|
override val externalDocumentation: ExternalDocumentation?,
|
||||||
|
override val operationId: String?,
|
||||||
|
override val deprecated: Boolean,
|
||||||
|
override val parameters: List<Parameter>
|
||||||
|
) : MethodInfo {
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
fun builder(init: Builder.() -> Unit): HeadInfo {
|
||||||
|
val builder = Builder()
|
||||||
|
builder.init()
|
||||||
|
return builder.build()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class Builder : MethodInfo.Builder<HeadInfo>() {
|
||||||
|
override fun build() = HeadInfo(
|
||||||
|
response = response ?: error("Response info must be present"),
|
||||||
|
errors = errors,
|
||||||
|
tags = tags,
|
||||||
|
summary = summary ?: error("Summary must be present"),
|
||||||
|
description = description ?: error("Description must be present"),
|
||||||
|
externalDocumentation = externalDocumentation,
|
||||||
|
operationId = operationId,
|
||||||
|
deprecated = deprecated,
|
||||||
|
parameters = parameters
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,64 @@
|
|||||||
|
package io.bkbn.kompendium.core.metadata
|
||||||
|
|
||||||
|
import io.bkbn.kompendium.oas.common.ExternalDocumentation
|
||||||
|
import io.bkbn.kompendium.oas.payload.Parameter
|
||||||
|
|
||||||
|
sealed interface MethodInfo {
|
||||||
|
val response: ResponseInfo
|
||||||
|
val errors: List<ResponseInfo>
|
||||||
|
val tags: Set<String>
|
||||||
|
val summary: String
|
||||||
|
val description: String
|
||||||
|
val externalDocumentation: ExternalDocumentation?
|
||||||
|
get() = null
|
||||||
|
val operationId: String?
|
||||||
|
get() = null
|
||||||
|
val deprecated: Boolean
|
||||||
|
get() = false
|
||||||
|
val parameters: List<Parameter>
|
||||||
|
get() = emptyList()
|
||||||
|
|
||||||
|
abstract class Builder<T : MethodInfo> {
|
||||||
|
internal var response: ResponseInfo? = null
|
||||||
|
internal var summary: String? = null
|
||||||
|
internal var description: String? = null
|
||||||
|
internal var externalDocumentation: ExternalDocumentation? = null
|
||||||
|
internal var operationId: String? = null
|
||||||
|
internal var deprecated: Boolean = false
|
||||||
|
internal var tags: Set<String> = emptySet()
|
||||||
|
internal var parameters: List<Parameter> = emptyList()
|
||||||
|
internal var errors: MutableList<ResponseInfo> = mutableListOf()
|
||||||
|
|
||||||
|
fun response(init: ResponseInfo.Builder.() -> Unit) = apply {
|
||||||
|
val builder = ResponseInfo.Builder()
|
||||||
|
builder.init()
|
||||||
|
this.response = builder.build()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun canRespond(init: ResponseInfo.Builder.() -> Unit) = apply {
|
||||||
|
val builder = ResponseInfo.Builder()
|
||||||
|
builder.init()
|
||||||
|
errors.add(builder.build())
|
||||||
|
}
|
||||||
|
|
||||||
|
fun canRespond(responses: List<ResponseInfo>) = apply {
|
||||||
|
errors.addAll(responses)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun summary(s: String) = apply { this.summary = s }
|
||||||
|
|
||||||
|
fun description(s: String) = apply { this.description = s }
|
||||||
|
|
||||||
|
fun externalDocumentation(docs: ExternalDocumentation) = apply { this.externalDocumentation = docs }
|
||||||
|
|
||||||
|
fun operationId(id: String) = apply { this.operationId = id }
|
||||||
|
|
||||||
|
fun isDeprecated() = apply { this.deprecated = true }
|
||||||
|
|
||||||
|
fun tags(vararg tags: String) = apply { this.tags = tags.toSet() }
|
||||||
|
|
||||||
|
fun parameters(vararg parameters: Parameter) = apply { this.parameters = parameters.toList() }
|
||||||
|
|
||||||
|
abstract fun build(): T
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
package io.bkbn.kompendium.core.metadata
|
||||||
|
|
||||||
|
sealed interface MethodInfoWithRequest : MethodInfo {
|
||||||
|
val request: RequestInfo
|
||||||
|
|
||||||
|
abstract class Builder<T : MethodInfoWithRequest> : MethodInfo.Builder<T>() {
|
||||||
|
internal var request: RequestInfo? = null
|
||||||
|
|
||||||
|
fun request(init: RequestInfo.Builder.() -> Unit) = apply {
|
||||||
|
val builder = RequestInfo.Builder()
|
||||||
|
builder.init()
|
||||||
|
this.request = builder.build()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,39 @@
|
|||||||
|
package io.bkbn.kompendium.core.metadata
|
||||||
|
|
||||||
|
import io.bkbn.kompendium.oas.common.ExternalDocumentation
|
||||||
|
import io.bkbn.kompendium.oas.payload.Parameter
|
||||||
|
|
||||||
|
class OptionsInfo private constructor(
|
||||||
|
override val response: ResponseInfo,
|
||||||
|
override val errors: MutableList<ResponseInfo>,
|
||||||
|
override val tags: Set<String>,
|
||||||
|
override val summary: String,
|
||||||
|
override val description: String,
|
||||||
|
override val externalDocumentation: ExternalDocumentation?,
|
||||||
|
override val operationId: String?,
|
||||||
|
override val deprecated: Boolean,
|
||||||
|
override val parameters: List<Parameter>
|
||||||
|
) : MethodInfo {
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
fun builder(init: Builder.() -> Unit): OptionsInfo {
|
||||||
|
val builder = Builder()
|
||||||
|
builder.init()
|
||||||
|
return builder.build()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class Builder : MethodInfo.Builder<OptionsInfo>() {
|
||||||
|
override fun build() = OptionsInfo(
|
||||||
|
response = response ?: error("Response info must be provided!"),
|
||||||
|
errors = errors,
|
||||||
|
tags = tags,
|
||||||
|
summary = summary ?: error("Summary must be provided!"),
|
||||||
|
description = description ?: error("Description must be provided!"),
|
||||||
|
externalDocumentation = externalDocumentation,
|
||||||
|
operationId = operationId,
|
||||||
|
deprecated = deprecated,
|
||||||
|
parameters = parameters
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,41 @@
|
|||||||
|
package io.bkbn.kompendium.core.metadata
|
||||||
|
|
||||||
|
import io.bkbn.kompendium.oas.common.ExternalDocumentation
|
||||||
|
import io.bkbn.kompendium.oas.payload.Parameter
|
||||||
|
|
||||||
|
class PatchInfo private constructor(
|
||||||
|
override val request: RequestInfo,
|
||||||
|
override val errors: MutableList<ResponseInfo>,
|
||||||
|
override val response: ResponseInfo,
|
||||||
|
override val tags: Set<String>,
|
||||||
|
override val summary: String,
|
||||||
|
override val description: String,
|
||||||
|
override val externalDocumentation: ExternalDocumentation?,
|
||||||
|
override val operationId: String?,
|
||||||
|
override val deprecated: Boolean,
|
||||||
|
override val parameters: List<Parameter>
|
||||||
|
) : MethodInfoWithRequest {
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
fun builder(init: Builder.() -> Unit): PatchInfo {
|
||||||
|
val builder = Builder()
|
||||||
|
builder.init()
|
||||||
|
return builder.build()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class Builder : MethodInfoWithRequest.Builder<PatchInfo>() {
|
||||||
|
override fun build() = PatchInfo(
|
||||||
|
request = request ?: error("request info must be present"),
|
||||||
|
errors = errors,
|
||||||
|
response = response ?: error("response info must be present"),
|
||||||
|
tags = tags,
|
||||||
|
summary = summary ?: error("Summary must be present"),
|
||||||
|
description = description ?: error("Description must be present"),
|
||||||
|
externalDocumentation = externalDocumentation,
|
||||||
|
operationId = operationId,
|
||||||
|
deprecated = deprecated,
|
||||||
|
parameters = parameters
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,41 @@
|
|||||||
|
package io.bkbn.kompendium.core.metadata
|
||||||
|
|
||||||
|
import io.bkbn.kompendium.oas.common.ExternalDocumentation
|
||||||
|
import io.bkbn.kompendium.oas.payload.Parameter
|
||||||
|
|
||||||
|
class PostInfo private constructor(
|
||||||
|
override val request: RequestInfo,
|
||||||
|
override val errors: MutableList<ResponseInfo>,
|
||||||
|
override val response: ResponseInfo,
|
||||||
|
override val tags: Set<String>,
|
||||||
|
override val summary: String,
|
||||||
|
override val description: String,
|
||||||
|
override val externalDocumentation: ExternalDocumentation?,
|
||||||
|
override val operationId: String?,
|
||||||
|
override val deprecated: Boolean,
|
||||||
|
override val parameters: List<Parameter>
|
||||||
|
) : MethodInfoWithRequest {
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
fun builder(init: Builder.() -> Unit): PostInfo {
|
||||||
|
val builder = Builder()
|
||||||
|
builder.init()
|
||||||
|
return builder.build()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class Builder : MethodInfoWithRequest.Builder<PostInfo>() {
|
||||||
|
override fun build() = PostInfo(
|
||||||
|
request = request ?: error("request info must be present"),
|
||||||
|
errors = errors,
|
||||||
|
response = response ?: error("response info must be present"),
|
||||||
|
tags = tags,
|
||||||
|
summary = summary ?: error("Summary must be present"),
|
||||||
|
description = description ?: error("Description must be present"),
|
||||||
|
externalDocumentation = externalDocumentation,
|
||||||
|
operationId = operationId,
|
||||||
|
deprecated = deprecated,
|
||||||
|
parameters = parameters
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,41 @@
|
|||||||
|
package io.bkbn.kompendium.core.metadata
|
||||||
|
|
||||||
|
import io.bkbn.kompendium.oas.common.ExternalDocumentation
|
||||||
|
import io.bkbn.kompendium.oas.payload.Parameter
|
||||||
|
|
||||||
|
class PutInfo private constructor(
|
||||||
|
override val request: RequestInfo,
|
||||||
|
override val errors: MutableList<ResponseInfo>,
|
||||||
|
override val response: ResponseInfo,
|
||||||
|
override val tags: Set<String>,
|
||||||
|
override val summary: String,
|
||||||
|
override val description: String,
|
||||||
|
override val externalDocumentation: ExternalDocumentation?,
|
||||||
|
override val operationId: String?,
|
||||||
|
override val deprecated: Boolean,
|
||||||
|
override val parameters: List<Parameter>
|
||||||
|
) : MethodInfoWithRequest {
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
fun builder(init: Builder.() -> Unit): PutInfo {
|
||||||
|
val builder = Builder()
|
||||||
|
builder.init()
|
||||||
|
return builder.build()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class Builder : MethodInfoWithRequest.Builder<PutInfo>() {
|
||||||
|
override fun build() = PutInfo(
|
||||||
|
request = request ?: error("request info must be present"),
|
||||||
|
errors = errors,
|
||||||
|
response = response ?: error("response info must be present"),
|
||||||
|
tags = tags,
|
||||||
|
summary = summary ?: error("Summary must be present"),
|
||||||
|
description = description ?: error("Description must be present"),
|
||||||
|
externalDocumentation = externalDocumentation,
|
||||||
|
operationId = operationId,
|
||||||
|
deprecated = deprecated,
|
||||||
|
parameters = parameters
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,44 @@
|
|||||||
|
package io.bkbn.kompendium.core.metadata
|
||||||
|
|
||||||
|
import io.bkbn.kompendium.oas.payload.MediaType
|
||||||
|
import kotlin.reflect.KType
|
||||||
|
import kotlin.reflect.typeOf
|
||||||
|
|
||||||
|
class RequestInfo private constructor(
|
||||||
|
val requestType: KType,
|
||||||
|
val description: String,
|
||||||
|
val examples: Map<String, MediaType.Example>?
|
||||||
|
) {
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
fun builder(init: Builder.() -> Unit): RequestInfo {
|
||||||
|
val builder = Builder()
|
||||||
|
builder.init()
|
||||||
|
return builder.build()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class Builder {
|
||||||
|
private var requestType: KType? = null
|
||||||
|
private var description: String? = null
|
||||||
|
private var examples: Map<String, MediaType.Example>? = null
|
||||||
|
|
||||||
|
fun requestType(t: KType) = apply {
|
||||||
|
this.requestType = t
|
||||||
|
}
|
||||||
|
|
||||||
|
inline fun <reified T> requestType() = apply { requestType(typeOf<T>()) }
|
||||||
|
|
||||||
|
fun description(s: String) = apply { this.description = s }
|
||||||
|
|
||||||
|
fun examples(vararg e: Pair<String, Any>) = apply {
|
||||||
|
this.examples = e.toMap().mapValues { (_, v) -> MediaType.Example(v) }
|
||||||
|
}
|
||||||
|
|
||||||
|
fun build() = RequestInfo(
|
||||||
|
requestType = requestType ?: error("Request type must be present"),
|
||||||
|
description = description ?: error("Description must be present"),
|
||||||
|
examples = examples
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,52 @@
|
|||||||
|
package io.bkbn.kompendium.core.metadata
|
||||||
|
|
||||||
|
import io.bkbn.kompendium.oas.payload.MediaType
|
||||||
|
import io.ktor.http.HttpStatusCode
|
||||||
|
import kotlin.reflect.KType
|
||||||
|
import kotlin.reflect.typeOf
|
||||||
|
|
||||||
|
class ResponseInfo private constructor(
|
||||||
|
val responseCode: HttpStatusCode,
|
||||||
|
val responseType: KType,
|
||||||
|
val description: String,
|
||||||
|
val examples: Map<String, MediaType.Example>?
|
||||||
|
) {
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
fun builder(init: Builder.() -> Unit): ResponseInfo {
|
||||||
|
val builder = Builder()
|
||||||
|
builder.init()
|
||||||
|
return builder.build()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class Builder {
|
||||||
|
private var responseCode: HttpStatusCode? = null
|
||||||
|
private var responseType: KType? = null
|
||||||
|
private var description: String? = null
|
||||||
|
private var examples: Map<String, MediaType.Example>? = null
|
||||||
|
|
||||||
|
fun responseCode(code: HttpStatusCode) = apply {
|
||||||
|
this.responseCode = code
|
||||||
|
}
|
||||||
|
|
||||||
|
fun responseType(t: KType) = apply {
|
||||||
|
this.responseType = t
|
||||||
|
}
|
||||||
|
|
||||||
|
inline fun <reified T> responseType() = apply { responseType(typeOf<T>()) }
|
||||||
|
|
||||||
|
fun description(s: String) = apply { this.description = s }
|
||||||
|
|
||||||
|
fun examples(vararg e: Pair<String, Any>) = apply {
|
||||||
|
this.examples = e.toMap().mapValues { (_, v) -> MediaType.Example(v) }
|
||||||
|
}
|
||||||
|
|
||||||
|
fun build() = ResponseInfo(
|
||||||
|
responseCode = responseCode ?: error("You must provide a response code in order to build a Response!"),
|
||||||
|
responseType = responseType ?: error("You must provide a response type in order to build a Response!"),
|
||||||
|
description = description ?: error("You must provide a description in order to build a Response!"),
|
||||||
|
examples = examples
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,47 @@
|
|||||||
|
package io.bkbn.kompendium.core.plugin
|
||||||
|
|
||||||
|
import io.bkbn.kompendium.core.attribute.KompendiumAttributes
|
||||||
|
import io.bkbn.kompendium.json.schema.SchemaConfigurator
|
||||||
|
import io.bkbn.kompendium.json.schema.definition.JsonSchema
|
||||||
|
import io.bkbn.kompendium.json.schema.util.Helpers.getSimpleSlug
|
||||||
|
import io.bkbn.kompendium.oas.OpenApiSpec
|
||||||
|
import io.ktor.http.HttpStatusCode
|
||||||
|
import io.ktor.server.application.call
|
||||||
|
import io.ktor.server.application.createApplicationPlugin
|
||||||
|
import io.ktor.server.response.respond
|
||||||
|
import io.ktor.server.routing.Routing
|
||||||
|
import io.ktor.server.routing.application
|
||||||
|
import io.ktor.server.routing.get
|
||||||
|
import io.ktor.server.routing.route
|
||||||
|
import io.ktor.server.routing.routing
|
||||||
|
import kotlin.reflect.KType
|
||||||
|
|
||||||
|
object NotarizedApplication {
|
||||||
|
|
||||||
|
class Config {
|
||||||
|
lateinit var spec: OpenApiSpec
|
||||||
|
var openApiJson: Routing.() -> Unit = {
|
||||||
|
route("/openapi.json") {
|
||||||
|
get {
|
||||||
|
call.respond(HttpStatusCode.OK, this@route.application.attributes[KompendiumAttributes.openApiSpec])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var customTypes: Map<KType, JsonSchema> = emptyMap()
|
||||||
|
var schemaConfigurator: SchemaConfigurator = SchemaConfigurator.Default()
|
||||||
|
}
|
||||||
|
|
||||||
|
operator fun invoke() = createApplicationPlugin(
|
||||||
|
name = "NotarizedApplication",
|
||||||
|
createConfiguration = ::Config
|
||||||
|
) {
|
||||||
|
val spec = pluginConfig.spec
|
||||||
|
val routing = application.routing { }
|
||||||
|
pluginConfig.openApiJson(routing)
|
||||||
|
pluginConfig.customTypes.forEach { (type, schema) ->
|
||||||
|
spec.components.schemas[type.getSimpleSlug()] = schema
|
||||||
|
}
|
||||||
|
application.attributes.put(KompendiumAttributes.openApiSpec, spec)
|
||||||
|
application.attributes.put(KompendiumAttributes.schemaConfigurator, pluginConfig.schemaConfigurator)
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,112 @@
|
|||||||
|
package io.bkbn.kompendium.core.plugin
|
||||||
|
|
||||||
|
import io.bkbn.kompendium.core.attribute.KompendiumAttributes
|
||||||
|
import io.bkbn.kompendium.core.metadata.DeleteInfo
|
||||||
|
import io.bkbn.kompendium.core.metadata.GetInfo
|
||||||
|
import io.bkbn.kompendium.core.metadata.HeadInfo
|
||||||
|
import io.bkbn.kompendium.core.metadata.OptionsInfo
|
||||||
|
import io.bkbn.kompendium.core.metadata.PatchInfo
|
||||||
|
import io.bkbn.kompendium.core.metadata.PostInfo
|
||||||
|
import io.bkbn.kompendium.core.metadata.PutInfo
|
||||||
|
import io.bkbn.kompendium.core.util.Helpers.addToSpec
|
||||||
|
import io.bkbn.kompendium.core.util.SpecConfig
|
||||||
|
import io.bkbn.kompendium.oas.path.Path
|
||||||
|
import io.bkbn.kompendium.oas.path.PathOperation
|
||||||
|
import io.bkbn.kompendium.oas.payload.Parameter
|
||||||
|
import io.ktor.server.application.ApplicationCallPipeline
|
||||||
|
import io.ktor.server.application.Hook
|
||||||
|
import io.ktor.server.application.createRouteScopedPlugin
|
||||||
|
import io.ktor.server.routing.Route
|
||||||
|
|
||||||
|
object NotarizedRoute {
|
||||||
|
|
||||||
|
class Config : SpecConfig {
|
||||||
|
override var tags: Set<String> = emptySet()
|
||||||
|
override var parameters: List<Parameter> = emptyList()
|
||||||
|
override var get: GetInfo? = null
|
||||||
|
override var post: PostInfo? = null
|
||||||
|
override var put: PutInfo? = null
|
||||||
|
override var delete: DeleteInfo? = null
|
||||||
|
override var patch: PatchInfo? = null
|
||||||
|
override var head: HeadInfo? = null
|
||||||
|
override var options: OptionsInfo? = null
|
||||||
|
override var security: Map<String, List<String>>? = null
|
||||||
|
internal var path: Path? = null
|
||||||
|
}
|
||||||
|
|
||||||
|
private object InstallHook : Hook<(ApplicationCallPipeline) -> Unit> {
|
||||||
|
override fun install(pipeline: ApplicationCallPipeline, handler: (ApplicationCallPipeline) -> Unit) {
|
||||||
|
handler(pipeline)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
operator fun invoke() = createRouteScopedPlugin(
|
||||||
|
name = "NotarizedRoute",
|
||||||
|
createConfiguration = ::Config
|
||||||
|
) {
|
||||||
|
|
||||||
|
// This is required in order to introspect the route path and authentication
|
||||||
|
on(InstallHook) {
|
||||||
|
val route = it as? Route ?: return@on
|
||||||
|
val spec = application.attributes[KompendiumAttributes.openApiSpec]
|
||||||
|
val routePath = route.calculateRoutePath()
|
||||||
|
val authMethods = route.collectAuthMethods()
|
||||||
|
pluginConfig.path?.addDefaultAuthMethods(authMethods)
|
||||||
|
require(spec.paths[routePath] == null) {
|
||||||
|
"""
|
||||||
|
The specified path ${Parameter.Location.path} has already been documented!
|
||||||
|
Please make sure that all notarized paths are unique
|
||||||
|
""".trimIndent()
|
||||||
|
}
|
||||||
|
spec.paths[routePath] = pluginConfig.path
|
||||||
|
?: error("This indicates a bug in Kompendium. Please file a GitHub issue!")
|
||||||
|
}
|
||||||
|
|
||||||
|
val spec = application.attributes[KompendiumAttributes.openApiSpec]
|
||||||
|
val serializableReader = application.attributes[KompendiumAttributes.schemaConfigurator]
|
||||||
|
|
||||||
|
val path = Path()
|
||||||
|
path.parameters = pluginConfig.parameters
|
||||||
|
|
||||||
|
pluginConfig.get?.addToSpec(path, spec, pluginConfig, serializableReader)
|
||||||
|
pluginConfig.delete?.addToSpec(path, spec, pluginConfig, serializableReader)
|
||||||
|
pluginConfig.head?.addToSpec(path, spec, pluginConfig, serializableReader)
|
||||||
|
pluginConfig.options?.addToSpec(path, spec, pluginConfig, serializableReader)
|
||||||
|
pluginConfig.post?.addToSpec(path, spec, pluginConfig, serializableReader)
|
||||||
|
pluginConfig.put?.addToSpec(path, spec, pluginConfig, serializableReader)
|
||||||
|
pluginConfig.patch?.addToSpec(path, spec, pluginConfig, serializableReader)
|
||||||
|
|
||||||
|
pluginConfig.path = path
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun Route.calculateRoutePath() = toString().replace(Regex("/\\(.+\\)"), "")
|
||||||
|
private fun Route.collectAuthMethods() = toString()
|
||||||
|
.split("/")
|
||||||
|
.filter { it.contains(Regex("\\(authenticate .*\\)")) }
|
||||||
|
.map { it.replace("(authenticate ", "").replace(")", "") }
|
||||||
|
.map { it.split(", ") }
|
||||||
|
.flatten()
|
||||||
|
|
||||||
|
private fun Path.addDefaultAuthMethods(methods: List<String>) {
|
||||||
|
get?.addDefaultAuthMethods(methods)
|
||||||
|
put?.addDefaultAuthMethods(methods)
|
||||||
|
post?.addDefaultAuthMethods(methods)
|
||||||
|
delete?.addDefaultAuthMethods(methods)
|
||||||
|
options?.addDefaultAuthMethods(methods)
|
||||||
|
head?.addDefaultAuthMethods(methods)
|
||||||
|
patch?.addDefaultAuthMethods(methods)
|
||||||
|
trace?.addDefaultAuthMethods(methods)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun PathOperation.addDefaultAuthMethods(methods: List<String>) {
|
||||||
|
methods.forEach { m ->
|
||||||
|
if (security == null || security?.all { s -> !s.containsKey(m) } == true) {
|
||||||
|
if (security == null) {
|
||||||
|
security = mutableListOf(mapOf(m to emptyList()))
|
||||||
|
} else {
|
||||||
|
security?.add(mapOf(m to emptyList()))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,10 +1,11 @@
|
|||||||
package org.leafygreens.kompendium.routes
|
package io.bkbn.kompendium.core.routes
|
||||||
|
|
||||||
import io.ktor.application.call
|
import io.ktor.http.HttpStatusCode
|
||||||
import io.ktor.html.respondHtml
|
import io.ktor.server.application.call
|
||||||
import io.ktor.routing.Routing
|
import io.ktor.server.html.respondHtml
|
||||||
import io.ktor.routing.get
|
import io.ktor.server.routing.Route
|
||||||
import io.ktor.routing.route
|
import io.ktor.server.routing.get
|
||||||
|
import io.ktor.server.routing.route
|
||||||
import kotlinx.html.body
|
import kotlinx.html.body
|
||||||
import kotlinx.html.head
|
import kotlinx.html.head
|
||||||
import kotlinx.html.link
|
import kotlinx.html.link
|
||||||
@ -13,20 +14,20 @@ import kotlinx.html.script
|
|||||||
import kotlinx.html.style
|
import kotlinx.html.style
|
||||||
import kotlinx.html.title
|
import kotlinx.html.title
|
||||||
import kotlinx.html.unsafe
|
import kotlinx.html.unsafe
|
||||||
import org.leafygreens.kompendium.models.oas.OpenApiSpec
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides an out-of-the-box route to view docs using ReDoc
|
* Provides an out-of-the-box route to view docs using ReDoc on the specified [path].
|
||||||
* @param oas spec to reference
|
* @param pageTitle Webpage title you wish to be displayed on your docs
|
||||||
|
* @param route path to docs resource
|
||||||
* @param specUrl url to point ReDoc to the OpenAPI json document
|
* @param specUrl url to point ReDoc to the OpenAPI json document
|
||||||
*/
|
*/
|
||||||
fun Routing.redoc(oas: OpenApiSpec, specUrl: String = "/openapi.json") {
|
fun Route.redoc(pageTitle: String = "Docs", path: String = "/docs", specUrl: String = "/openapi.json") {
|
||||||
route("/docs") {
|
route(path) {
|
||||||
get {
|
get {
|
||||||
call.respondHtml {
|
call.respondHtml(HttpStatusCode.OK) {
|
||||||
head {
|
head {
|
||||||
title {
|
title {
|
||||||
+"${oas.info.title}"
|
+pageTitle
|
||||||
}
|
}
|
||||||
meta {
|
meta {
|
||||||
charset = "utf-8"
|
charset = "utf-8"
|
||||||
@ -46,7 +47,7 @@ fun Routing.redoc(oas: OpenApiSpec, specUrl: String = "/openapi.json") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
body {
|
body {
|
||||||
unsafe { +"<redoc spec-url='${specUrl}'></redoc>" }
|
unsafe { +"<redoc spec-url='$specUrl'></redoc>" }
|
||||||
script {
|
script {
|
||||||
src = "https://cdn.jsdelivr.net/npm/redoc@next/bundles/redoc.standalone.js"
|
src = "https://cdn.jsdelivr.net/npm/redoc@next/bundles/redoc.standalone.js"
|
||||||
}
|
}
|
121
core/src/main/kotlin/io/bkbn/kompendium/core/util/Helpers.kt
Normal file
121
core/src/main/kotlin/io/bkbn/kompendium/core/util/Helpers.kt
Normal file
@ -0,0 +1,121 @@
|
|||||||
|
package io.bkbn.kompendium.core.util
|
||||||
|
|
||||||
|
import io.bkbn.kompendium.core.metadata.DeleteInfo
|
||||||
|
import io.bkbn.kompendium.core.metadata.GetInfo
|
||||||
|
import io.bkbn.kompendium.core.metadata.HeadInfo
|
||||||
|
import io.bkbn.kompendium.core.metadata.MethodInfo
|
||||||
|
import io.bkbn.kompendium.core.metadata.MethodInfoWithRequest
|
||||||
|
import io.bkbn.kompendium.core.metadata.OptionsInfo
|
||||||
|
import io.bkbn.kompendium.core.metadata.PatchInfo
|
||||||
|
import io.bkbn.kompendium.core.metadata.PostInfo
|
||||||
|
import io.bkbn.kompendium.core.metadata.PutInfo
|
||||||
|
import io.bkbn.kompendium.core.metadata.ResponseInfo
|
||||||
|
import io.bkbn.kompendium.json.schema.SchemaConfigurator
|
||||||
|
import io.bkbn.kompendium.json.schema.SchemaGenerator
|
||||||
|
import io.bkbn.kompendium.json.schema.definition.NullableDefinition
|
||||||
|
import io.bkbn.kompendium.json.schema.definition.OneOfDefinition
|
||||||
|
import io.bkbn.kompendium.json.schema.definition.ReferenceDefinition
|
||||||
|
import io.bkbn.kompendium.json.schema.util.Helpers.getReferenceSlug
|
||||||
|
import io.bkbn.kompendium.json.schema.util.Helpers.getSimpleSlug
|
||||||
|
import io.bkbn.kompendium.oas.OpenApiSpec
|
||||||
|
import io.bkbn.kompendium.oas.path.Path
|
||||||
|
import io.bkbn.kompendium.oas.path.PathOperation
|
||||||
|
import io.bkbn.kompendium.oas.payload.MediaType
|
||||||
|
import io.bkbn.kompendium.oas.payload.Request
|
||||||
|
import io.bkbn.kompendium.oas.payload.Response
|
||||||
|
import kotlin.reflect.KClass
|
||||||
|
import kotlin.reflect.KType
|
||||||
|
|
||||||
|
object Helpers {
|
||||||
|
|
||||||
|
fun MethodInfo.addToSpec(path: Path, spec: OpenApiSpec, config: SpecConfig, schemaConfigurator: SchemaConfigurator) {
|
||||||
|
SchemaGenerator.fromTypeOrUnit(
|
||||||
|
this.response.responseType,
|
||||||
|
spec.components.schemas, schemaConfigurator
|
||||||
|
)?.let { schema ->
|
||||||
|
spec.components.schemas[this.response.responseType.getSimpleSlug()] = schema
|
||||||
|
}
|
||||||
|
|
||||||
|
errors.forEach { error ->
|
||||||
|
SchemaGenerator.fromTypeOrUnit(error.responseType, spec.components.schemas, schemaConfigurator)?.let { schema ->
|
||||||
|
spec.components.schemas[error.responseType.getSimpleSlug()] = schema
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
when (this) {
|
||||||
|
is MethodInfoWithRequest -> {
|
||||||
|
SchemaGenerator.fromTypeOrUnit(
|
||||||
|
this.request.requestType,
|
||||||
|
spec.components.schemas,
|
||||||
|
schemaConfigurator
|
||||||
|
)?.let { schema ->
|
||||||
|
spec.components.schemas[this.request.requestType.getSimpleSlug()] = schema
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
else -> {}
|
||||||
|
}
|
||||||
|
|
||||||
|
val operations = this.toPathOperation(config)
|
||||||
|
|
||||||
|
when (this) {
|
||||||
|
is DeleteInfo -> path.delete = operations
|
||||||
|
is GetInfo -> path.get = operations
|
||||||
|
is HeadInfo -> path.head = operations
|
||||||
|
is PatchInfo -> path.patch = operations
|
||||||
|
is PostInfo -> path.post = operations
|
||||||
|
is PutInfo -> path.put = operations
|
||||||
|
is OptionsInfo -> path.options = operations
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun MethodInfo.toPathOperation(config: SpecConfig) = PathOperation(
|
||||||
|
tags = config.tags.plus(this.tags),
|
||||||
|
summary = this.summary,
|
||||||
|
description = this.description,
|
||||||
|
externalDocs = this.externalDocumentation,
|
||||||
|
operationId = this.operationId,
|
||||||
|
deprecated = this.deprecated,
|
||||||
|
parameters = this.parameters,
|
||||||
|
security = config.security
|
||||||
|
?.map { (k, v) -> k to v }
|
||||||
|
?.map { listOf(it).toMap() }
|
||||||
|
?.toMutableList(),
|
||||||
|
requestBody = when (this) {
|
||||||
|
is MethodInfoWithRequest -> Request(
|
||||||
|
description = this.request.description,
|
||||||
|
content = this.request.requestType.toReferenceContent(this.request.examples),
|
||||||
|
required = true
|
||||||
|
)
|
||||||
|
|
||||||
|
else -> null
|
||||||
|
},
|
||||||
|
responses = mapOf(
|
||||||
|
this.response.responseCode.value to Response(
|
||||||
|
description = this.response.description,
|
||||||
|
content = this.response.responseType.toReferenceContent(this.response.examples)
|
||||||
|
)
|
||||||
|
).plus(this.errors.toResponseMap())
|
||||||
|
)
|
||||||
|
|
||||||
|
private fun List<ResponseInfo>.toResponseMap(): Map<Int, Response> = associate { error ->
|
||||||
|
error.responseCode.value to Response(
|
||||||
|
description = error.description,
|
||||||
|
content = error.responseType.toReferenceContent(error.examples)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun KType.toReferenceContent(examples: Map<String, MediaType.Example>?): Map<String, MediaType>? =
|
||||||
|
when (this.classifier as KClass<*>) {
|
||||||
|
Unit::class -> null
|
||||||
|
else -> mapOf(
|
||||||
|
"application/json" to MediaType(
|
||||||
|
schema = if (this.isMarkedNullable) OneOfDefinition(
|
||||||
|
NullableDefinition(),
|
||||||
|
ReferenceDefinition(this.getReferenceSlug())
|
||||||
|
) else ReferenceDefinition(this.getReferenceSlug()),
|
||||||
|
examples = examples
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
package io.bkbn.kompendium.core.util
|
||||||
|
|
||||||
|
import io.bkbn.kompendium.core.metadata.DeleteInfo
|
||||||
|
import io.bkbn.kompendium.core.metadata.GetInfo
|
||||||
|
import io.bkbn.kompendium.core.metadata.HeadInfo
|
||||||
|
import io.bkbn.kompendium.core.metadata.OptionsInfo
|
||||||
|
import io.bkbn.kompendium.core.metadata.PatchInfo
|
||||||
|
import io.bkbn.kompendium.core.metadata.PostInfo
|
||||||
|
import io.bkbn.kompendium.core.metadata.PutInfo
|
||||||
|
import io.bkbn.kompendium.oas.payload.Parameter
|
||||||
|
|
||||||
|
interface SpecConfig {
|
||||||
|
var tags: Set<String>
|
||||||
|
var parameters: List<Parameter>
|
||||||
|
var get: GetInfo?
|
||||||
|
var post: PostInfo?
|
||||||
|
var put: PutInfo?
|
||||||
|
var delete: DeleteInfo?
|
||||||
|
var patch: PatchInfo?
|
||||||
|
var head: HeadInfo?
|
||||||
|
var options: OptionsInfo?
|
||||||
|
var security: Map<String, List<String>>?
|
||||||
|
}
|
367
core/src/test/kotlin/io/bkbn/kompendium/core/KompendiumTest.kt
Normal file
367
core/src/test/kotlin/io/bkbn/kompendium/core/KompendiumTest.kt
Normal file
@ -0,0 +1,367 @@
|
|||||||
|
package io.bkbn.kompendium.core
|
||||||
|
|
||||||
|
import dev.forst.ktor.apikey.apiKey
|
||||||
|
import io.bkbn.kompendium.core.fixtures.TestHelpers.openApiTestAllSerializers
|
||||||
|
import io.bkbn.kompendium.core.util.TestModules.complexRequest
|
||||||
|
import io.bkbn.kompendium.core.util.TestModules.customAuthConfig
|
||||||
|
import io.bkbn.kompendium.core.util.TestModules.customFieldNameResponse
|
||||||
|
import io.bkbn.kompendium.core.util.TestModules.dateTimeString
|
||||||
|
import io.bkbn.kompendium.core.util.TestModules.defaultAuthConfig
|
||||||
|
import io.bkbn.kompendium.core.util.TestModules.defaultField
|
||||||
|
import io.bkbn.kompendium.core.util.TestModules.defaultParameter
|
||||||
|
import io.bkbn.kompendium.core.util.TestModules.exampleParams
|
||||||
|
import io.bkbn.kompendium.core.util.TestModules.genericException
|
||||||
|
import io.bkbn.kompendium.core.util.TestModules.genericPolymorphicResponse
|
||||||
|
import io.bkbn.kompendium.core.util.TestModules.genericPolymorphicResponseMultipleImpls
|
||||||
|
import io.bkbn.kompendium.core.util.TestModules.gnarlyGenericResponse
|
||||||
|
import io.bkbn.kompendium.core.util.TestModules.headerParameter
|
||||||
|
import io.bkbn.kompendium.core.util.TestModules.ignoredFieldsResponse
|
||||||
|
import io.bkbn.kompendium.core.util.TestModules.multipleAuthStrategies
|
||||||
|
import io.bkbn.kompendium.core.util.TestModules.multipleExceptions
|
||||||
|
import io.bkbn.kompendium.core.util.TestModules.nestedGenericCollection
|
||||||
|
import io.bkbn.kompendium.core.util.TestModules.nestedGenericMultipleParamsCollection
|
||||||
|
import io.bkbn.kompendium.core.util.TestModules.nestedGenericResponse
|
||||||
|
import io.bkbn.kompendium.core.util.TestModules.nestedTypeName
|
||||||
|
import io.bkbn.kompendium.core.util.TestModules.nestedUnderRoot
|
||||||
|
import io.bkbn.kompendium.core.util.TestModules.nonRequiredParam
|
||||||
|
import io.bkbn.kompendium.core.util.TestModules.nonRequiredParams
|
||||||
|
import io.bkbn.kompendium.core.util.TestModules.notarizedDelete
|
||||||
|
import io.bkbn.kompendium.core.util.TestModules.notarizedGet
|
||||||
|
import io.bkbn.kompendium.core.util.TestModules.notarizedHead
|
||||||
|
import io.bkbn.kompendium.core.util.TestModules.notarizedOptions
|
||||||
|
import io.bkbn.kompendium.core.util.TestModules.notarizedPatch
|
||||||
|
import io.bkbn.kompendium.core.util.TestModules.notarizedPost
|
||||||
|
import io.bkbn.kompendium.core.util.TestModules.notarizedPut
|
||||||
|
import io.bkbn.kompendium.core.util.TestModules.nullableEnumField
|
||||||
|
import io.bkbn.kompendium.core.util.TestModules.nullableField
|
||||||
|
import io.bkbn.kompendium.core.util.TestModules.nullableNestedObject
|
||||||
|
import io.bkbn.kompendium.core.util.TestModules.nullableReference
|
||||||
|
import io.bkbn.kompendium.core.util.TestModules.polymorphicCollectionResponse
|
||||||
|
import io.bkbn.kompendium.core.util.TestModules.polymorphicException
|
||||||
|
import io.bkbn.kompendium.core.util.TestModules.polymorphicMapResponse
|
||||||
|
import io.bkbn.kompendium.core.util.TestModules.polymorphicResponse
|
||||||
|
import io.bkbn.kompendium.core.util.TestModules.primitives
|
||||||
|
import io.bkbn.kompendium.core.util.TestModules.reqRespExamples
|
||||||
|
import io.bkbn.kompendium.core.util.TestModules.requiredParams
|
||||||
|
import io.bkbn.kompendium.core.util.TestModules.returnsList
|
||||||
|
import io.bkbn.kompendium.core.util.TestModules.rootRoute
|
||||||
|
import io.bkbn.kompendium.core.util.TestModules.simpleGenericResponse
|
||||||
|
import io.bkbn.kompendium.core.util.TestModules.simplePathParsing
|
||||||
|
import io.bkbn.kompendium.core.util.TestModules.simpleRecursive
|
||||||
|
import io.bkbn.kompendium.core.util.TestModules.singleException
|
||||||
|
import io.bkbn.kompendium.core.util.TestModules.topLevelNullable
|
||||||
|
import io.bkbn.kompendium.core.util.TestModules.trailingSlash
|
||||||
|
import io.bkbn.kompendium.core.util.TestModules.unbackedFieldsResponse
|
||||||
|
import io.bkbn.kompendium.core.util.TestModules.withOperationId
|
||||||
|
import io.bkbn.kompendium.json.schema.definition.TypeDefinition
|
||||||
|
import io.bkbn.kompendium.json.schema.exception.UnknownSchemaException
|
||||||
|
import io.bkbn.kompendium.oas.component.Components
|
||||||
|
import io.bkbn.kompendium.oas.security.ApiKeyAuth
|
||||||
|
import io.bkbn.kompendium.oas.security.BasicAuth
|
||||||
|
import io.bkbn.kompendium.oas.security.BearerAuth
|
||||||
|
import io.bkbn.kompendium.oas.security.OAuth
|
||||||
|
import io.kotest.assertions.throwables.shouldThrow
|
||||||
|
import io.kotest.core.spec.style.DescribeSpec
|
||||||
|
import io.kotest.matchers.should
|
||||||
|
import io.kotest.matchers.string.startWith
|
||||||
|
import io.ktor.client.HttpClient
|
||||||
|
import io.ktor.client.engine.cio.CIO
|
||||||
|
import io.ktor.http.HttpMethod
|
||||||
|
import io.ktor.server.application.install
|
||||||
|
import io.ktor.server.auth.Authentication
|
||||||
|
import io.ktor.server.auth.OAuthServerSettings
|
||||||
|
import io.ktor.server.auth.UserIdPrincipal
|
||||||
|
import io.ktor.server.auth.basic
|
||||||
|
import io.ktor.server.auth.jwt.jwt
|
||||||
|
import io.ktor.server.auth.oauth
|
||||||
|
import kotlin.reflect.typeOf
|
||||||
|
import java.time.Instant
|
||||||
|
|
||||||
|
class KompendiumTest : DescribeSpec({
|
||||||
|
describe("Notarized Open API Metadata Tests") {
|
||||||
|
it("Can notarize a get request") {
|
||||||
|
openApiTestAllSerializers("T0001__notarized_get.json") { notarizedGet() }
|
||||||
|
}
|
||||||
|
it("Can notarize a post request") {
|
||||||
|
openApiTestAllSerializers("T0002__notarized_post.json") { notarizedPost() }
|
||||||
|
}
|
||||||
|
it("Can notarize a put request") {
|
||||||
|
openApiTestAllSerializers("T0003__notarized_put.json") { notarizedPut() }
|
||||||
|
}
|
||||||
|
it("Can notarize a delete request") {
|
||||||
|
openApiTestAllSerializers("T0004__notarized_delete.json") { notarizedDelete() }
|
||||||
|
}
|
||||||
|
it("Can notarize a patch request") {
|
||||||
|
openApiTestAllSerializers("T0005__notarized_patch.json") { notarizedPatch() }
|
||||||
|
}
|
||||||
|
it("Can notarize a head request") {
|
||||||
|
openApiTestAllSerializers("T0006__notarized_head.json") { notarizedHead() }
|
||||||
|
}
|
||||||
|
it("Can notarize an options request") {
|
||||||
|
openApiTestAllSerializers("T0007__notarized_options.json") { notarizedOptions() }
|
||||||
|
}
|
||||||
|
it("Can notarize a complex type") {
|
||||||
|
openApiTestAllSerializers("T0008__complex_type.json") { complexRequest() }
|
||||||
|
}
|
||||||
|
it("Can notarize primitives") {
|
||||||
|
openApiTestAllSerializers("T0009__notarized_primitives.json") { primitives() }
|
||||||
|
}
|
||||||
|
it("Can notarize a top level list response") {
|
||||||
|
openApiTestAllSerializers("T0010__response_list.json") { returnsList() }
|
||||||
|
}
|
||||||
|
it("Can notarize a route with non-required params") {
|
||||||
|
openApiTestAllSerializers("T0011__non_required_params.json") { nonRequiredParams() }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
describe("Route Parsing") {
|
||||||
|
it("Can parse a simple path and store it under the expected route") {
|
||||||
|
openApiTestAllSerializers("T0012__path_parser.json") { simplePathParsing() }
|
||||||
|
}
|
||||||
|
it("Can notarize the root route") {
|
||||||
|
openApiTestAllSerializers("T0013__root_route.json") { rootRoute() }
|
||||||
|
}
|
||||||
|
it("Can notarize a route under the root module without appending trailing slash") {
|
||||||
|
openApiTestAllSerializers("T0014__nested_under_root.json") { nestedUnderRoot() }
|
||||||
|
}
|
||||||
|
it("Can notarize a route with a trailing slash") {
|
||||||
|
openApiTestAllSerializers("T0015__trailing_slash.json") { trailingSlash() }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
describe("Exceptions") {
|
||||||
|
it("Can add an exception status code to a response") {
|
||||||
|
openApiTestAllSerializers("T0016__notarized_get_with_exception_response.json") { singleException() }
|
||||||
|
}
|
||||||
|
it("Can support multiple response codes") {
|
||||||
|
openApiTestAllSerializers("T0017__notarized_get_with_multiple_exception_responses.json") { multipleExceptions() }
|
||||||
|
}
|
||||||
|
it("Can add a polymorphic exception response") {
|
||||||
|
openApiTestAllSerializers("T0018__polymorphic_error_status_codes.json") { polymorphicException() }
|
||||||
|
}
|
||||||
|
it("Can add a generic exception response") {
|
||||||
|
openApiTestAllSerializers("T0019__generic_exception.json") { genericException() }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
describe("Examples") {
|
||||||
|
it("Can generate example response and request bodies") {
|
||||||
|
openApiTestAllSerializers("T0020__example_req_and_resp.json") { reqRespExamples() }
|
||||||
|
}
|
||||||
|
it("Can describe example parameters") {
|
||||||
|
openApiTestAllSerializers("T0021__example_parameters.json") { exampleParams() }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
describe("Defaults") {
|
||||||
|
it("Can generate a default parameter value") {
|
||||||
|
openApiTestAllSerializers("T0022__query_with_default_parameter.json") { defaultParameter() }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
describe("Required Fields") {
|
||||||
|
it("Marks a parameter as required if there is no default and it is not marked nullable") {
|
||||||
|
openApiTestAllSerializers("T0023__required_param.json") { requiredParams() }
|
||||||
|
}
|
||||||
|
it("Can mark a parameter as not required") {
|
||||||
|
openApiTestAllSerializers("T0024__non_required_param.json") { nonRequiredParam() }
|
||||||
|
}
|
||||||
|
it("Does not mark a field as required if a default value is provided") {
|
||||||
|
openApiTestAllSerializers("T0025__default_field.json") { defaultField() }
|
||||||
|
}
|
||||||
|
it("Does not mark a nullable field as required") {
|
||||||
|
openApiTestAllSerializers("T0026__nullable_field.json") { nullableField() }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
describe("Polymorphism and Generics") {
|
||||||
|
it("can generate a polymorphic response type") {
|
||||||
|
openApiTestAllSerializers("T0027__polymorphic_response.json") { polymorphicResponse() }
|
||||||
|
}
|
||||||
|
it("Can generate a collection with polymorphic response type") {
|
||||||
|
openApiTestAllSerializers("T0028__polymorphic_list_response.json") { polymorphicCollectionResponse() }
|
||||||
|
}
|
||||||
|
it("Can generate a map with a polymorphic response type") {
|
||||||
|
openApiTestAllSerializers("T0029__polymorphic_map_response.json") { polymorphicMapResponse() }
|
||||||
|
}
|
||||||
|
it("Can generate a response type with a generic type") {
|
||||||
|
openApiTestAllSerializers("T0030__simple_generic_response.json") { simpleGenericResponse() }
|
||||||
|
}
|
||||||
|
it("Can generate a response type with a nested generic type") {
|
||||||
|
openApiTestAllSerializers("T0031__nested_generic_response.json") { nestedGenericResponse() }
|
||||||
|
}
|
||||||
|
it("Can generate a polymorphic response type with generics") {
|
||||||
|
openApiTestAllSerializers("T0032__polymorphic_response_with_generics.json") { genericPolymorphicResponse() }
|
||||||
|
}
|
||||||
|
it("Can handle an absolutely psycho inheritance test") {
|
||||||
|
openApiTestAllSerializers("T0033__crazy_polymorphic_example.json") { genericPolymorphicResponseMultipleImpls() }
|
||||||
|
}
|
||||||
|
it("Can support nested generic collections") {
|
||||||
|
openApiTestAllSerializers("T0039__nested_generic_collection.json") { nestedGenericCollection() }
|
||||||
|
}
|
||||||
|
it("Can support nested generics with multiple type parameters") {
|
||||||
|
openApiTestAllSerializers("T0040__nested_generic_multiple_type_params.json") {
|
||||||
|
nestedGenericMultipleParamsCollection()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
it("Can handle a really gnarly generic example") {
|
||||||
|
openApiTestAllSerializers("T0043__gnarly_generic_example.json") { gnarlyGenericResponse() }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
describe("Custom Serializable Reader tests") {
|
||||||
|
it("Can support ignoring fields") {
|
||||||
|
openApiTestAllSerializers("T0048__ignored_property.json") { ignoredFieldsResponse() }
|
||||||
|
}
|
||||||
|
it("Can support un-backed fields") {
|
||||||
|
openApiTestAllSerializers("T0049__unbacked_property.json") { unbackedFieldsResponse() }
|
||||||
|
}
|
||||||
|
it("Can support custom named fields") {
|
||||||
|
openApiTestAllSerializers("T0050__custom_named_property.json") { customFieldNameResponse() }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
describe("Miscellaneous") {
|
||||||
|
xit("Can generate the necessary ReDoc home page") {
|
||||||
|
// TODO apiFunctionalityTest(getFileSnapshot("redoc.html"), "/docs") { returnsList() }
|
||||||
|
}
|
||||||
|
it("Can add an operation id to a notarized route") {
|
||||||
|
openApiTestAllSerializers("T0034__notarized_get_with_operation_id.json") { withOperationId() }
|
||||||
|
}
|
||||||
|
xit("Can add an undeclared field") {
|
||||||
|
// TODO openApiTestAllSerializers("undeclared_field.json") { undeclaredType() }
|
||||||
|
}
|
||||||
|
it("Can add a custom header parameter with a name override") {
|
||||||
|
openApiTestAllSerializers("T0035__override_parameter_name.json") { headerParameter() }
|
||||||
|
}
|
||||||
|
xit("Can override field name") {
|
||||||
|
// TODO Assess strategies here
|
||||||
|
}
|
||||||
|
it("Can serialize a recursive type") {
|
||||||
|
openApiTestAllSerializers("T0042__simple_recursive.json") { simpleRecursive() }
|
||||||
|
}
|
||||||
|
it("Nullable fields do not lead to doom") {
|
||||||
|
openApiTestAllSerializers("T0036__nullable_fields.json") { nullableNestedObject() }
|
||||||
|
}
|
||||||
|
it("Can have a nullable enum as a member field") {
|
||||||
|
openApiTestAllSerializers("T0037__nullable_enum_field.json") { nullableEnumField() }
|
||||||
|
}
|
||||||
|
it("Can have a nullable reference without impacting base type") {
|
||||||
|
openApiTestAllSerializers("T0041__nullable_reference.json") { nullableReference() }
|
||||||
|
}
|
||||||
|
it("Can handle nested type names") {
|
||||||
|
openApiTestAllSerializers("T0044__nested_type_name.json") { nestedTypeName() }
|
||||||
|
}
|
||||||
|
it("Can handle top level nullable types") {
|
||||||
|
openApiTestAllSerializers("T0051__top_level_nullable.json") { topLevelNullable() }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
describe("Error Handling") {
|
||||||
|
it("Throws a clear exception when an unidentified type is encountered") {
|
||||||
|
val exception = shouldThrow<UnknownSchemaException> { openApiTestAllSerializers("") { dateTimeString() } }
|
||||||
|
exception.message should startWith("An unknown type was encountered: class java.time.Instant")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
describe("Constraints") {
|
||||||
|
// TODO Assess strategies here
|
||||||
|
}
|
||||||
|
describe("Formats") {
|
||||||
|
it("Can set a format for a simple type schema") {
|
||||||
|
openApiTestAllSerializers(
|
||||||
|
snapshotName = "T0038__formatted_date_time_string.json",
|
||||||
|
customTypes = mapOf(typeOf<Instant>() to TypeDefinition(type = "string", format = "date"))
|
||||||
|
) { dateTimeString() }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
describe("Free Form") {
|
||||||
|
// todo Assess strategies here
|
||||||
|
}
|
||||||
|
describe("Authentication") {
|
||||||
|
it("Can add a default auth config by default") {
|
||||||
|
openApiTestAllSerializers(
|
||||||
|
snapshotName = "T0045__default_auth_config.json",
|
||||||
|
applicationSetup = {
|
||||||
|
install(Authentication) {
|
||||||
|
basic("basic") {
|
||||||
|
realm = "Ktor Server"
|
||||||
|
validate { UserIdPrincipal("Placeholder") }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
specOverrides = {
|
||||||
|
this.copy(
|
||||||
|
components = Components(
|
||||||
|
securitySchemes = mutableMapOf(
|
||||||
|
"basic" to BasicAuth()
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
) { defaultAuthConfig() }
|
||||||
|
}
|
||||||
|
it("Can provide custom auth config with proper scopes") {
|
||||||
|
openApiTestAllSerializers(
|
||||||
|
snapshotName = "T0046__custom_auth_config.json",
|
||||||
|
applicationSetup = {
|
||||||
|
install(Authentication) {
|
||||||
|
oauth("auth-oauth-google") {
|
||||||
|
urlProvider = { "http://localhost:8080/callback" }
|
||||||
|
providerLookup = {
|
||||||
|
OAuthServerSettings.OAuth2ServerSettings(
|
||||||
|
name = "google",
|
||||||
|
authorizeUrl = "https://accounts.google.com/o/oauth2/auth",
|
||||||
|
accessTokenUrl = "https://accounts.google.com/o/oauth2/token",
|
||||||
|
requestMethod = HttpMethod.Post,
|
||||||
|
clientId = "DUMMY_VAL",
|
||||||
|
clientSecret = "DUMMY_VAL",
|
||||||
|
defaultScopes = listOf("https://www.googleapis.com/auth/userinfo.profile"),
|
||||||
|
extraTokenParameters = listOf("access_type" to "offline")
|
||||||
|
)
|
||||||
|
}
|
||||||
|
client = HttpClient(CIO)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
specOverrides = {
|
||||||
|
this.copy(
|
||||||
|
components = Components(
|
||||||
|
securitySchemes = mutableMapOf(
|
||||||
|
"auth-oauth-google" to OAuth(
|
||||||
|
flows = OAuth.Flows(
|
||||||
|
implicit = OAuth.Flows.Implicit(
|
||||||
|
authorizationUrl = "https://accounts.google.com/o/oauth2/auth",
|
||||||
|
scopes = mapOf(
|
||||||
|
"write:pets" to "modify pets in your account",
|
||||||
|
"read:pets" to "read your pets"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
) { customAuthConfig() }
|
||||||
|
}
|
||||||
|
it("Can provide multiple authentication strategies") {
|
||||||
|
openApiTestAllSerializers(
|
||||||
|
snapshotName = "T0047__multiple_auth_strategies.json",
|
||||||
|
applicationSetup = {
|
||||||
|
install(Authentication) {
|
||||||
|
apiKey("api-key") {
|
||||||
|
headerName = "X-API-KEY"
|
||||||
|
validate {
|
||||||
|
UserIdPrincipal("Placeholder")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
jwt("jwt") {
|
||||||
|
realm = "Server"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
specOverrides = {
|
||||||
|
this.copy(
|
||||||
|
components = Components(
|
||||||
|
securitySchemes = mutableMapOf(
|
||||||
|
"jwt" to BearerAuth("JWT"),
|
||||||
|
"api-key" to ApiKeyAuth(ApiKeyAuth.ApiKeyLocation.HEADER, "X-API-KEY")
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
) { multipleAuthStrategies() }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
684
core/src/test/kotlin/io/bkbn/kompendium/core/util/TestModules.kt
Normal file
684
core/src/test/kotlin/io/bkbn/kompendium/core/util/TestModules.kt
Normal file
@ -0,0 +1,684 @@
|
|||||||
|
package io.bkbn.kompendium.core.util
|
||||||
|
|
||||||
|
import io.bkbn.kompendium.core.fixtures.Barzo
|
||||||
|
import io.bkbn.kompendium.core.fixtures.ColumnSchema
|
||||||
|
import io.bkbn.kompendium.core.fixtures.ComplexRequest
|
||||||
|
import io.bkbn.kompendium.core.fixtures.DateTimeString
|
||||||
|
import io.bkbn.kompendium.core.fixtures.DefaultField
|
||||||
|
import io.bkbn.kompendium.core.fixtures.ExceptionResponse
|
||||||
|
import io.bkbn.kompendium.core.fixtures.Flibbity
|
||||||
|
import io.bkbn.kompendium.core.fixtures.FlibbityGibbit
|
||||||
|
import io.bkbn.kompendium.core.fixtures.Foosy
|
||||||
|
import io.bkbn.kompendium.core.fixtures.Gibbity
|
||||||
|
import io.bkbn.kompendium.core.fixtures.ManyThings
|
||||||
|
import io.bkbn.kompendium.core.fixtures.MultiNestedGenerics
|
||||||
|
import io.bkbn.kompendium.core.fixtures.Nested
|
||||||
|
import io.bkbn.kompendium.core.fixtures.NullableEnum
|
||||||
|
import io.bkbn.kompendium.core.fixtures.NullableField
|
||||||
|
import io.bkbn.kompendium.core.fixtures.Page
|
||||||
|
import io.bkbn.kompendium.core.fixtures.ProfileUpdateRequest
|
||||||
|
import io.bkbn.kompendium.core.fixtures.SerialNameObject
|
||||||
|
import io.bkbn.kompendium.core.fixtures.TestCreatedResponse
|
||||||
|
import io.bkbn.kompendium.core.fixtures.TestNested
|
||||||
|
import io.bkbn.kompendium.core.fixtures.TestRequest
|
||||||
|
import io.bkbn.kompendium.core.fixtures.TestResponse
|
||||||
|
import io.bkbn.kompendium.core.fixtures.TestSimpleRequest
|
||||||
|
import io.bkbn.kompendium.core.fixtures.TransientObject
|
||||||
|
import io.bkbn.kompendium.core.fixtures.UnbackedObject
|
||||||
|
import io.bkbn.kompendium.core.metadata.DeleteInfo
|
||||||
|
import io.bkbn.kompendium.core.metadata.GetInfo
|
||||||
|
import io.bkbn.kompendium.core.metadata.HeadInfo
|
||||||
|
import io.bkbn.kompendium.core.metadata.OptionsInfo
|
||||||
|
import io.bkbn.kompendium.core.metadata.PatchInfo
|
||||||
|
import io.bkbn.kompendium.core.metadata.PostInfo
|
||||||
|
import io.bkbn.kompendium.core.metadata.PutInfo
|
||||||
|
import io.bkbn.kompendium.core.plugin.NotarizedRoute
|
||||||
|
import io.bkbn.kompendium.json.schema.definition.TypeDefinition
|
||||||
|
import io.bkbn.kompendium.oas.payload.Parameter
|
||||||
|
import io.ktor.http.HttpStatusCode
|
||||||
|
import io.ktor.server.application.call
|
||||||
|
import io.ktor.server.application.install
|
||||||
|
import io.ktor.server.auth.authenticate
|
||||||
|
import io.ktor.server.response.respond
|
||||||
|
import io.ktor.server.response.respondText
|
||||||
|
import io.ktor.server.routing.Route
|
||||||
|
import io.ktor.server.routing.Routing
|
||||||
|
import io.ktor.server.routing.delete
|
||||||
|
import io.ktor.server.routing.get
|
||||||
|
import io.ktor.server.routing.head
|
||||||
|
import io.ktor.server.routing.options
|
||||||
|
import io.ktor.server.routing.patch
|
||||||
|
import io.ktor.server.routing.post
|
||||||
|
import io.ktor.server.routing.put
|
||||||
|
import io.ktor.server.routing.route
|
||||||
|
|
||||||
|
object TestModules {
|
||||||
|
private const val defaultPath = "/test/{a}"
|
||||||
|
private const val rootPath = "/"
|
||||||
|
private const val defaultResponseDescription = "A Successful Endeavor"
|
||||||
|
private const val defaultRequestDescription = "You gotta send it"
|
||||||
|
private const val defaultPathSummary = "Great Summary!"
|
||||||
|
private const val defaultPathDescription = "testing more"
|
||||||
|
|
||||||
|
private val defaultParams = listOf(
|
||||||
|
Parameter(
|
||||||
|
name = "a",
|
||||||
|
`in` = Parameter.Location.path,
|
||||||
|
schema = TypeDefinition.STRING,
|
||||||
|
),
|
||||||
|
Parameter(
|
||||||
|
name = "aa",
|
||||||
|
`in` = Parameter.Location.query,
|
||||||
|
schema = TypeDefinition.INT
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
fun Routing.notarizedGet() {
|
||||||
|
route(defaultPath) {
|
||||||
|
install(NotarizedRoute()) {
|
||||||
|
parameters = defaultParams
|
||||||
|
get = GetInfo.builder {
|
||||||
|
response {
|
||||||
|
responseCode(HttpStatusCode.OK)
|
||||||
|
responseType<TestResponse>()
|
||||||
|
description(defaultResponseDescription)
|
||||||
|
}
|
||||||
|
summary(defaultPathSummary)
|
||||||
|
description(defaultPathDescription)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
get {
|
||||||
|
call.respondText { "hey dude ‼️ congrats on the get request" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun Routing.notarizedPost() {
|
||||||
|
route(defaultPath) {
|
||||||
|
install(NotarizedRoute()) {
|
||||||
|
parameters = defaultParams
|
||||||
|
post = PostInfo.builder {
|
||||||
|
summary(defaultPathSummary)
|
||||||
|
description(defaultPathDescription)
|
||||||
|
request {
|
||||||
|
requestType<TestSimpleRequest>()
|
||||||
|
description("A Test request")
|
||||||
|
}
|
||||||
|
response {
|
||||||
|
responseCode(HttpStatusCode.Created)
|
||||||
|
responseType<TestCreatedResponse>()
|
||||||
|
description(defaultResponseDescription)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
post {
|
||||||
|
call.respondText { "hey dude ‼️ congrats on the post request" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun Routing.notarizedPut() {
|
||||||
|
route(defaultPath) {
|
||||||
|
install(NotarizedRoute()) {
|
||||||
|
parameters = defaultParams
|
||||||
|
put = PutInfo.builder {
|
||||||
|
summary(defaultPathSummary)
|
||||||
|
description(defaultPathDescription)
|
||||||
|
request {
|
||||||
|
requestType<TestSimpleRequest>()
|
||||||
|
description("A Test request")
|
||||||
|
}
|
||||||
|
response {
|
||||||
|
responseCode(HttpStatusCode.Created)
|
||||||
|
responseType<TestCreatedResponse>()
|
||||||
|
description(defaultResponseDescription)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
put {
|
||||||
|
call.respondText { "hey dude ‼️ congrats on the post request" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun Routing.notarizedDelete() {
|
||||||
|
route(defaultPath) {
|
||||||
|
install(NotarizedRoute()) {
|
||||||
|
parameters = defaultParams
|
||||||
|
delete = DeleteInfo.builder {
|
||||||
|
summary(defaultPathSummary)
|
||||||
|
description(defaultPathDescription)
|
||||||
|
response {
|
||||||
|
responseCode(HttpStatusCode.NoContent)
|
||||||
|
responseType<Unit>()
|
||||||
|
description(defaultResponseDescription)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
delete {
|
||||||
|
call.respond(HttpStatusCode.NoContent)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun Routing.notarizedPatch() {
|
||||||
|
route(defaultPath) {
|
||||||
|
install(NotarizedRoute()) {
|
||||||
|
parameters = defaultParams
|
||||||
|
patch = PatchInfo.builder {
|
||||||
|
summary(defaultPathSummary)
|
||||||
|
description(defaultPathDescription)
|
||||||
|
request {
|
||||||
|
description("A Test request")
|
||||||
|
requestType<TestSimpleRequest>()
|
||||||
|
}
|
||||||
|
response {
|
||||||
|
responseCode(HttpStatusCode.Created)
|
||||||
|
responseType<TestCreatedResponse>()
|
||||||
|
description(defaultResponseDescription)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
patch {
|
||||||
|
call.respond(HttpStatusCode.Created) { TestCreatedResponse(123, "Nice!") }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun Routing.notarizedHead() {
|
||||||
|
route(defaultPath) {
|
||||||
|
install(NotarizedRoute()) {
|
||||||
|
parameters = defaultParams
|
||||||
|
head = HeadInfo.builder {
|
||||||
|
summary(defaultPathSummary)
|
||||||
|
description(defaultPathDescription)
|
||||||
|
|
||||||
|
response {
|
||||||
|
description("great!")
|
||||||
|
responseCode(HttpStatusCode.Created)
|
||||||
|
responseType<Unit>()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
head {
|
||||||
|
call.respond(HttpStatusCode.OK)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun Routing.notarizedOptions() {
|
||||||
|
route(defaultPath) {
|
||||||
|
install(NotarizedRoute()) {
|
||||||
|
parameters = defaultParams
|
||||||
|
options = OptionsInfo.builder {
|
||||||
|
summary(defaultPathSummary)
|
||||||
|
description(defaultPathDescription)
|
||||||
|
response {
|
||||||
|
responseCode(HttpStatusCode.OK)
|
||||||
|
responseType<TestResponse>()
|
||||||
|
description("nice")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
options {
|
||||||
|
call.respond(HttpStatusCode.NoContent)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun Routing.complexRequest() {
|
||||||
|
route(rootPath) {
|
||||||
|
install(NotarizedRoute()) {
|
||||||
|
put = PutInfo.builder {
|
||||||
|
summary(defaultPathSummary)
|
||||||
|
description(defaultPathDescription)
|
||||||
|
request {
|
||||||
|
requestType<ComplexRequest>()
|
||||||
|
description("A Complex request")
|
||||||
|
}
|
||||||
|
response {
|
||||||
|
responseCode(HttpStatusCode.Created)
|
||||||
|
responseType<TestCreatedResponse>()
|
||||||
|
description(defaultResponseDescription)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
patch {
|
||||||
|
call.respond(HttpStatusCode.Created, TestCreatedResponse(123, "nice!"))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun Routing.primitives() {
|
||||||
|
route(rootPath) {
|
||||||
|
install(NotarizedRoute()) {
|
||||||
|
put = PutInfo.builder {
|
||||||
|
summary(defaultPathSummary)
|
||||||
|
description(defaultPathDescription)
|
||||||
|
request {
|
||||||
|
requestType<Int>()
|
||||||
|
description("A Test Request")
|
||||||
|
}
|
||||||
|
response {
|
||||||
|
responseCode(HttpStatusCode.Created)
|
||||||
|
responseType<Boolean>()
|
||||||
|
description(defaultResponseDescription)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun Routing.returnsList() {
|
||||||
|
route(defaultPath) {
|
||||||
|
install(NotarizedRoute()) {
|
||||||
|
parameters = defaultParams
|
||||||
|
get = GetInfo.builder {
|
||||||
|
summary(defaultPathSummary)
|
||||||
|
description(defaultPathDescription)
|
||||||
|
response {
|
||||||
|
description("A Successful List-y Endeavor")
|
||||||
|
responseCode(HttpStatusCode.OK)
|
||||||
|
responseType<List<TestResponse>>()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun Routing.nonRequiredParams() {
|
||||||
|
route("/optional") {
|
||||||
|
install(NotarizedRoute()) {
|
||||||
|
parameters = listOf(
|
||||||
|
Parameter(
|
||||||
|
name = "notRequired",
|
||||||
|
`in` = Parameter.Location.query,
|
||||||
|
schema = TypeDefinition.STRING,
|
||||||
|
required = false,
|
||||||
|
),
|
||||||
|
Parameter(
|
||||||
|
name = "required",
|
||||||
|
`in` = Parameter.Location.query,
|
||||||
|
schema = TypeDefinition.STRING
|
||||||
|
)
|
||||||
|
)
|
||||||
|
get = GetInfo.builder {
|
||||||
|
summary(defaultPathSummary)
|
||||||
|
description(defaultPathDescription)
|
||||||
|
response {
|
||||||
|
responseType<Unit>()
|
||||||
|
description("Empty")
|
||||||
|
responseCode(HttpStatusCode.NoContent)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun Routing.simplePathParsing() {
|
||||||
|
route("/this") {
|
||||||
|
route("/is") {
|
||||||
|
route("/a") {
|
||||||
|
route("/complex") {
|
||||||
|
route("path") {
|
||||||
|
route("with/an/{id}") {
|
||||||
|
install(NotarizedRoute()) {
|
||||||
|
get = GetInfo.builder {
|
||||||
|
parameters = listOf(
|
||||||
|
Parameter(
|
||||||
|
name = "id",
|
||||||
|
`in` = Parameter.Location.path,
|
||||||
|
schema = TypeDefinition.STRING
|
||||||
|
)
|
||||||
|
)
|
||||||
|
summary(defaultPathSummary)
|
||||||
|
description(defaultPathDescription)
|
||||||
|
response {
|
||||||
|
description(defaultResponseDescription)
|
||||||
|
responseCode(HttpStatusCode.OK)
|
||||||
|
responseType<TestResponse>()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun Routing.rootRoute() {
|
||||||
|
route(rootPath) {
|
||||||
|
install(NotarizedRoute()) {
|
||||||
|
parameters = listOf(defaultParams.last())
|
||||||
|
get = GetInfo.builder {
|
||||||
|
summary(defaultPathSummary)
|
||||||
|
description(defaultPathDescription)
|
||||||
|
response {
|
||||||
|
description(defaultResponseDescription)
|
||||||
|
responseCode(HttpStatusCode.OK)
|
||||||
|
responseType<TestResponse>()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun Routing.nestedUnderRoot() {
|
||||||
|
route("/") {
|
||||||
|
route("/testerino") {
|
||||||
|
install(NotarizedRoute()) {
|
||||||
|
get = GetInfo.builder {
|
||||||
|
summary(defaultPathSummary)
|
||||||
|
description(defaultPathDescription)
|
||||||
|
response {
|
||||||
|
description(defaultResponseDescription)
|
||||||
|
responseCode(HttpStatusCode.OK)
|
||||||
|
responseType<TestResponse>()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun Routing.trailingSlash() {
|
||||||
|
route("/test") {
|
||||||
|
route("/") {
|
||||||
|
install(NotarizedRoute()) {
|
||||||
|
get = GetInfo.builder {
|
||||||
|
summary(defaultPathSummary)
|
||||||
|
description(defaultPathDescription)
|
||||||
|
response {
|
||||||
|
description(defaultResponseDescription)
|
||||||
|
responseCode(HttpStatusCode.OK)
|
||||||
|
responseType<TestResponse>()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun Routing.singleException() {
|
||||||
|
route(rootPath) {
|
||||||
|
install(NotarizedRoute()) {
|
||||||
|
get = GetInfo.builder {
|
||||||
|
summary(defaultPathSummary)
|
||||||
|
description(defaultPathDescription)
|
||||||
|
response {
|
||||||
|
description(defaultResponseDescription)
|
||||||
|
responseCode(HttpStatusCode.OK)
|
||||||
|
responseType<TestResponse>()
|
||||||
|
}
|
||||||
|
canRespond {
|
||||||
|
description("Bad Things Happened")
|
||||||
|
responseCode(HttpStatusCode.BadRequest)
|
||||||
|
responseType<ExceptionResponse>()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun Routing.multipleExceptions() {
|
||||||
|
route(rootPath) {
|
||||||
|
install(NotarizedRoute()) {
|
||||||
|
get = GetInfo.builder {
|
||||||
|
summary(defaultPathSummary)
|
||||||
|
description(defaultPathDescription)
|
||||||
|
response {
|
||||||
|
description(defaultResponseDescription)
|
||||||
|
responseCode(HttpStatusCode.OK)
|
||||||
|
responseType<TestResponse>()
|
||||||
|
}
|
||||||
|
canRespond {
|
||||||
|
description("Bad Things Happened")
|
||||||
|
responseCode(HttpStatusCode.BadRequest)
|
||||||
|
responseType<ExceptionResponse>()
|
||||||
|
}
|
||||||
|
canRespond {
|
||||||
|
description("Access Denied")
|
||||||
|
responseCode(HttpStatusCode.Forbidden)
|
||||||
|
responseType<ExceptionResponse>()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun Routing.polymorphicException() {
|
||||||
|
route(rootPath) {
|
||||||
|
install(NotarizedRoute()) {
|
||||||
|
get = GetInfo.builder {
|
||||||
|
summary(defaultPathSummary)
|
||||||
|
description(defaultPathDescription)
|
||||||
|
response {
|
||||||
|
description(defaultResponseDescription)
|
||||||
|
responseCode(HttpStatusCode.OK)
|
||||||
|
responseType<TestResponse>()
|
||||||
|
}
|
||||||
|
canRespond {
|
||||||
|
description("Bad Things Happened")
|
||||||
|
responseCode(HttpStatusCode.InternalServerError)
|
||||||
|
responseType<FlibbityGibbit>()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun Routing.genericException() {
|
||||||
|
route(rootPath) {
|
||||||
|
install(NotarizedRoute()) {
|
||||||
|
get = GetInfo.builder {
|
||||||
|
summary(defaultPathSummary)
|
||||||
|
description(defaultPathDescription)
|
||||||
|
response {
|
||||||
|
description(defaultResponseDescription)
|
||||||
|
responseCode(HttpStatusCode.OK)
|
||||||
|
responseType<TestResponse>()
|
||||||
|
}
|
||||||
|
canRespond {
|
||||||
|
description("Bad Things Happened")
|
||||||
|
responseCode(HttpStatusCode.BadRequest)
|
||||||
|
responseType<Flibbity<String>>()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun Routing.reqRespExamples() {
|
||||||
|
route(rootPath) {
|
||||||
|
install(NotarizedRoute()) {
|
||||||
|
post = PostInfo.builder {
|
||||||
|
summary(defaultPathSummary)
|
||||||
|
description(defaultPathDescription)
|
||||||
|
request {
|
||||||
|
description(defaultRequestDescription)
|
||||||
|
requestType<TestRequest>()
|
||||||
|
examples(
|
||||||
|
"Testerina" to TestRequest(TestNested("asdf"), 1.5, emptyList())
|
||||||
|
)
|
||||||
|
}
|
||||||
|
response {
|
||||||
|
description(defaultResponseDescription)
|
||||||
|
responseCode(HttpStatusCode.OK)
|
||||||
|
responseType<TestResponse>()
|
||||||
|
examples(
|
||||||
|
"Testerino" to TestResponse("Heya")
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun Routing.exampleParams() = basicGetGenerator<TestResponse>(
|
||||||
|
params = listOf(
|
||||||
|
Parameter(
|
||||||
|
name = "id",
|
||||||
|
`in` = Parameter.Location.path,
|
||||||
|
schema = TypeDefinition.STRING,
|
||||||
|
examples = mapOf(
|
||||||
|
"foo" to Parameter.Example("testing")
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
fun Routing.defaultParameter() = basicGetGenerator<TestResponse>(
|
||||||
|
params = listOf(
|
||||||
|
Parameter(
|
||||||
|
name = "id",
|
||||||
|
`in` = Parameter.Location.path,
|
||||||
|
schema = TypeDefinition.STRING.withDefault("IDK")
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
fun Routing.requiredParams() = basicGetGenerator<TestResponse>(
|
||||||
|
params = listOf(
|
||||||
|
Parameter(
|
||||||
|
name = "id",
|
||||||
|
`in` = Parameter.Location.path,
|
||||||
|
schema = TypeDefinition.STRING
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
fun Routing.nonRequiredParam() = basicGetGenerator<TestResponse>(
|
||||||
|
params = listOf(
|
||||||
|
Parameter(
|
||||||
|
name = "id",
|
||||||
|
`in` = Parameter.Location.query,
|
||||||
|
schema = TypeDefinition.STRING,
|
||||||
|
required = false
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
fun Routing.defaultField() = basicGetGenerator<DefaultField>()
|
||||||
|
|
||||||
|
fun Routing.nullableField() = basicGetGenerator<NullableField>()
|
||||||
|
|
||||||
|
fun Routing.polymorphicResponse() = basicGetGenerator<FlibbityGibbit>()
|
||||||
|
|
||||||
|
fun Routing.ignoredFieldsResponse() = basicGetGenerator<TransientObject>()
|
||||||
|
|
||||||
|
fun Routing.unbackedFieldsResponse() = basicGetGenerator<UnbackedObject>()
|
||||||
|
|
||||||
|
fun Routing.customFieldNameResponse() = basicGetGenerator<SerialNameObject>()
|
||||||
|
|
||||||
|
fun Routing.polymorphicCollectionResponse() = basicGetGenerator<List<FlibbityGibbit>>()
|
||||||
|
|
||||||
|
fun Routing.polymorphicMapResponse() = basicGetGenerator<Map<String, FlibbityGibbit>>()
|
||||||
|
|
||||||
|
fun Routing.simpleGenericResponse() = basicGetGenerator<Gibbity<String>>()
|
||||||
|
|
||||||
|
fun Routing.gnarlyGenericResponse() = basicGetGenerator<Foosy<Barzo<Int>, String>>()
|
||||||
|
|
||||||
|
fun Routing.nestedGenericResponse() = basicGetGenerator<Gibbity<Map<String, String>>>()
|
||||||
|
|
||||||
|
fun Routing.genericPolymorphicResponse() = basicGetGenerator<Flibbity<Double>>()
|
||||||
|
|
||||||
|
fun Routing.genericPolymorphicResponseMultipleImpls() = basicGetGenerator<Flibbity<FlibbityGibbit>>()
|
||||||
|
|
||||||
|
fun Routing.nestedGenericCollection() = basicGetGenerator<Page<Int>>()
|
||||||
|
|
||||||
|
fun Routing.nestedGenericMultipleParamsCollection() = basicGetGenerator<MultiNestedGenerics<String, ComplexRequest>>()
|
||||||
|
|
||||||
|
fun Routing.withOperationId() = basicGetGenerator<TestResponse>(operationId = "getThisDude")
|
||||||
|
|
||||||
|
fun Routing.nullableNestedObject() = basicGetGenerator<ProfileUpdateRequest>()
|
||||||
|
|
||||||
|
fun Routing.nullableEnumField() = basicGetGenerator<NullableEnum>()
|
||||||
|
|
||||||
|
fun Routing.nullableReference() = basicGetGenerator<ManyThings>()
|
||||||
|
|
||||||
|
fun Routing.dateTimeString() = basicGetGenerator<DateTimeString>()
|
||||||
|
|
||||||
|
fun Routing.headerParameter() = basicGetGenerator<TestResponse>(
|
||||||
|
params = listOf(
|
||||||
|
Parameter(
|
||||||
|
name = "X-User-Email",
|
||||||
|
`in` = Parameter.Location.header,
|
||||||
|
schema = TypeDefinition.STRING,
|
||||||
|
required = true
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
fun Routing.nestedTypeName() = basicGetGenerator<Nested.Response>()
|
||||||
|
|
||||||
|
fun Routing.topLevelNullable() = basicGetGenerator<TestResponse?>()
|
||||||
|
|
||||||
|
fun Routing.simpleRecursive() = basicGetGenerator<ColumnSchema>()
|
||||||
|
|
||||||
|
fun Routing.defaultAuthConfig() {
|
||||||
|
authenticate("basic") {
|
||||||
|
route(rootPath) {
|
||||||
|
basicGetGenerator<TestResponse>()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun Routing.customAuthConfig() {
|
||||||
|
authenticate("auth-oauth-google") {
|
||||||
|
route(rootPath) {
|
||||||
|
install(NotarizedRoute()) {
|
||||||
|
get = GetInfo.builder {
|
||||||
|
summary(defaultPathSummary)
|
||||||
|
description(defaultPathDescription)
|
||||||
|
response {
|
||||||
|
description(defaultResponseDescription)
|
||||||
|
responseCode(HttpStatusCode.OK)
|
||||||
|
responseType<TestResponse>()
|
||||||
|
}
|
||||||
|
security = mapOf(
|
||||||
|
"auth-oauth-google" to listOf("read:pets")
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun Routing.multipleAuthStrategies() {
|
||||||
|
authenticate("jwt", "api-key") {
|
||||||
|
route(rootPath) {
|
||||||
|
basicGetGenerator<TestResponse>()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private inline fun <reified T> Routing.basicGetGenerator(
|
||||||
|
params: List<Parameter> = emptyList(),
|
||||||
|
operationId: String? = null
|
||||||
|
) {
|
||||||
|
route(rootPath) {
|
||||||
|
basicGetGenerator<T>(params, operationId)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private inline fun <reified T> Route.basicGetGenerator(
|
||||||
|
params: List<Parameter> = emptyList(),
|
||||||
|
operationId: String? = null
|
||||||
|
) {
|
||||||
|
install(NotarizedRoute()) {
|
||||||
|
get = GetInfo.builder {
|
||||||
|
summary(defaultPathSummary)
|
||||||
|
description(defaultPathDescription)
|
||||||
|
operationId?.let { operationId(it) }
|
||||||
|
parameters = params
|
||||||
|
response {
|
||||||
|
description(defaultResponseDescription)
|
||||||
|
responseCode(HttpStatusCode.OK)
|
||||||
|
responseType<T>()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
92
core/src/test/resources/T0001__notarized_get.json
Normal file
92
core/src/test/resources/T0001__notarized_get.json
Normal file
@ -0,0 +1,92 @@
|
|||||||
|
{
|
||||||
|
"openapi": "3.1.0",
|
||||||
|
"jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
|
||||||
|
"info": {
|
||||||
|
"title": "Test API",
|
||||||
|
"version": "1.33.7",
|
||||||
|
"description": "An amazing, fully-ish 😉 generated API spec",
|
||||||
|
"termsOfService": "https://example.com",
|
||||||
|
"contact": {
|
||||||
|
"name": "Homer Simpson",
|
||||||
|
"url": "https://gph.is/1NPUDiM",
|
||||||
|
"email": "chunkylover53@aol.com"
|
||||||
|
},
|
||||||
|
"license": {
|
||||||
|
"name": "MIT",
|
||||||
|
"url": "https://github.com/bkbnio/kompendium/blob/main/LICENSE"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"servers": [
|
||||||
|
{
|
||||||
|
"url": "https://myawesomeapi.com",
|
||||||
|
"description": "Production instance of my API"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://staging.myawesomeapi.com",
|
||||||
|
"description": "Where the fun stuff happens"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"paths": {
|
||||||
|
"/test/{a}": {
|
||||||
|
"get": {
|
||||||
|
"tags": [],
|
||||||
|
"summary": "Great Summary!",
|
||||||
|
"description": "testing more",
|
||||||
|
"parameters": [],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "A Successful Endeavor",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/TestResponse"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"deprecated": false
|
||||||
|
},
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "a",
|
||||||
|
"in": "path",
|
||||||
|
"schema": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"required": true,
|
||||||
|
"deprecated": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "aa",
|
||||||
|
"in": "query",
|
||||||
|
"schema": {
|
||||||
|
"type": "number",
|
||||||
|
"format": "int32"
|
||||||
|
},
|
||||||
|
"required": true,
|
||||||
|
"deprecated": false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"webhooks": {},
|
||||||
|
"components": {
|
||||||
|
"schemas": {
|
||||||
|
"TestResponse": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"c": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"c"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"securitySchemes": {}
|
||||||
|
},
|
||||||
|
"security": [],
|
||||||
|
"tags": []
|
||||||
|
}
|
124
core/src/test/resources/T0002__notarized_post.json
Normal file
124
core/src/test/resources/T0002__notarized_post.json
Normal file
@ -0,0 +1,124 @@
|
|||||||
|
{
|
||||||
|
"openapi": "3.1.0",
|
||||||
|
"jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
|
||||||
|
"info": {
|
||||||
|
"title": "Test API",
|
||||||
|
"version": "1.33.7",
|
||||||
|
"description": "An amazing, fully-ish 😉 generated API spec",
|
||||||
|
"termsOfService": "https://example.com",
|
||||||
|
"contact": {
|
||||||
|
"name": "Homer Simpson",
|
||||||
|
"url": "https://gph.is/1NPUDiM",
|
||||||
|
"email": "chunkylover53@aol.com"
|
||||||
|
},
|
||||||
|
"license": {
|
||||||
|
"name": "MIT",
|
||||||
|
"url": "https://github.com/bkbnio/kompendium/blob/main/LICENSE"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"servers": [
|
||||||
|
{
|
||||||
|
"url": "https://myawesomeapi.com",
|
||||||
|
"description": "Production instance of my API"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://staging.myawesomeapi.com",
|
||||||
|
"description": "Where the fun stuff happens"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"paths": {
|
||||||
|
"/test/{a}": {
|
||||||
|
"post": {
|
||||||
|
"tags": [],
|
||||||
|
"summary": "Great Summary!",
|
||||||
|
"description": "testing more",
|
||||||
|
"parameters": [],
|
||||||
|
"requestBody": {
|
||||||
|
"description": "A Test request",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/TestSimpleRequest"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
"responses": {
|
||||||
|
"201": {
|
||||||
|
"description": "A Successful Endeavor",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/TestCreatedResponse"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"deprecated": false
|
||||||
|
},
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "a",
|
||||||
|
"in": "path",
|
||||||
|
"schema": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"required": true,
|
||||||
|
"deprecated": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "aa",
|
||||||
|
"in": "query",
|
||||||
|
"schema": {
|
||||||
|
"type": "number",
|
||||||
|
"format": "int32"
|
||||||
|
},
|
||||||
|
"required": true,
|
||||||
|
"deprecated": false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"webhooks": {},
|
||||||
|
"components": {
|
||||||
|
"schemas": {
|
||||||
|
"TestCreatedResponse": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"c": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"id": {
|
||||||
|
"type": "number",
|
||||||
|
"format": "int32"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"c",
|
||||||
|
"id"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"TestSimpleRequest": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"a": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"b": {
|
||||||
|
"type": "number",
|
||||||
|
"format": "int32"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"a",
|
||||||
|
"b"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"securitySchemes": {}
|
||||||
|
},
|
||||||
|
"security": [],
|
||||||
|
"tags": []
|
||||||
|
}
|
124
core/src/test/resources/T0003__notarized_put.json
Normal file
124
core/src/test/resources/T0003__notarized_put.json
Normal file
@ -0,0 +1,124 @@
|
|||||||
|
{
|
||||||
|
"openapi": "3.1.0",
|
||||||
|
"jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
|
||||||
|
"info": {
|
||||||
|
"title": "Test API",
|
||||||
|
"version": "1.33.7",
|
||||||
|
"description": "An amazing, fully-ish 😉 generated API spec",
|
||||||
|
"termsOfService": "https://example.com",
|
||||||
|
"contact": {
|
||||||
|
"name": "Homer Simpson",
|
||||||
|
"url": "https://gph.is/1NPUDiM",
|
||||||
|
"email": "chunkylover53@aol.com"
|
||||||
|
},
|
||||||
|
"license": {
|
||||||
|
"name": "MIT",
|
||||||
|
"url": "https://github.com/bkbnio/kompendium/blob/main/LICENSE"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"servers": [
|
||||||
|
{
|
||||||
|
"url": "https://myawesomeapi.com",
|
||||||
|
"description": "Production instance of my API"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://staging.myawesomeapi.com",
|
||||||
|
"description": "Where the fun stuff happens"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"paths": {
|
||||||
|
"/test/{a}": {
|
||||||
|
"put": {
|
||||||
|
"tags": [],
|
||||||
|
"summary": "Great Summary!",
|
||||||
|
"description": "testing more",
|
||||||
|
"parameters": [],
|
||||||
|
"requestBody": {
|
||||||
|
"description": "A Test request",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/TestSimpleRequest"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
"responses": {
|
||||||
|
"201": {
|
||||||
|
"description": "A Successful Endeavor",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/TestCreatedResponse"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"deprecated": false
|
||||||
|
},
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "a",
|
||||||
|
"in": "path",
|
||||||
|
"schema": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"required": true,
|
||||||
|
"deprecated": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "aa",
|
||||||
|
"in": "query",
|
||||||
|
"schema": {
|
||||||
|
"type": "number",
|
||||||
|
"format": "int32"
|
||||||
|
},
|
||||||
|
"required": true,
|
||||||
|
"deprecated": false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"webhooks": {},
|
||||||
|
"components": {
|
||||||
|
"schemas": {
|
||||||
|
"TestCreatedResponse": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"c": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"id": {
|
||||||
|
"type": "number",
|
||||||
|
"format": "int32"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"c",
|
||||||
|
"id"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"TestSimpleRequest": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"a": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"b": {
|
||||||
|
"type": "number",
|
||||||
|
"format": "int32"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"a",
|
||||||
|
"b"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"securitySchemes": {}
|
||||||
|
},
|
||||||
|
"security": [],
|
||||||
|
"tags": []
|
||||||
|
}
|
73
core/src/test/resources/T0004__notarized_delete.json
Normal file
73
core/src/test/resources/T0004__notarized_delete.json
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
{
|
||||||
|
"openapi": "3.1.0",
|
||||||
|
"jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
|
||||||
|
"info": {
|
||||||
|
"title": "Test API",
|
||||||
|
"version": "1.33.7",
|
||||||
|
"description": "An amazing, fully-ish 😉 generated API spec",
|
||||||
|
"termsOfService": "https://example.com",
|
||||||
|
"contact": {
|
||||||
|
"name": "Homer Simpson",
|
||||||
|
"url": "https://gph.is/1NPUDiM",
|
||||||
|
"email": "chunkylover53@aol.com"
|
||||||
|
},
|
||||||
|
"license": {
|
||||||
|
"name": "MIT",
|
||||||
|
"url": "https://github.com/bkbnio/kompendium/blob/main/LICENSE"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"servers": [
|
||||||
|
{
|
||||||
|
"url": "https://myawesomeapi.com",
|
||||||
|
"description": "Production instance of my API"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://staging.myawesomeapi.com",
|
||||||
|
"description": "Where the fun stuff happens"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"paths": {
|
||||||
|
"/test/{a}": {
|
||||||
|
"delete": {
|
||||||
|
"tags": [],
|
||||||
|
"summary": "Great Summary!",
|
||||||
|
"description": "testing more",
|
||||||
|
"parameters": [],
|
||||||
|
"responses": {
|
||||||
|
"204": {
|
||||||
|
"description": "A Successful Endeavor"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"deprecated": false
|
||||||
|
},
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "a",
|
||||||
|
"in": "path",
|
||||||
|
"schema": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"required": true,
|
||||||
|
"deprecated": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "aa",
|
||||||
|
"in": "query",
|
||||||
|
"schema": {
|
||||||
|
"type": "number",
|
||||||
|
"format": "int32"
|
||||||
|
},
|
||||||
|
"required": true,
|
||||||
|
"deprecated": false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"webhooks": {},
|
||||||
|
"components": {
|
||||||
|
"schemas": {},
|
||||||
|
"securitySchemes": {}
|
||||||
|
},
|
||||||
|
"security": [],
|
||||||
|
"tags": []
|
||||||
|
}
|
124
core/src/test/resources/T0005__notarized_patch.json
Normal file
124
core/src/test/resources/T0005__notarized_patch.json
Normal file
@ -0,0 +1,124 @@
|
|||||||
|
{
|
||||||
|
"openapi": "3.1.0",
|
||||||
|
"jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
|
||||||
|
"info": {
|
||||||
|
"title": "Test API",
|
||||||
|
"version": "1.33.7",
|
||||||
|
"description": "An amazing, fully-ish 😉 generated API spec",
|
||||||
|
"termsOfService": "https://example.com",
|
||||||
|
"contact": {
|
||||||
|
"name": "Homer Simpson",
|
||||||
|
"url": "https://gph.is/1NPUDiM",
|
||||||
|
"email": "chunkylover53@aol.com"
|
||||||
|
},
|
||||||
|
"license": {
|
||||||
|
"name": "MIT",
|
||||||
|
"url": "https://github.com/bkbnio/kompendium/blob/main/LICENSE"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"servers": [
|
||||||
|
{
|
||||||
|
"url": "https://myawesomeapi.com",
|
||||||
|
"description": "Production instance of my API"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://staging.myawesomeapi.com",
|
||||||
|
"description": "Where the fun stuff happens"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"paths": {
|
||||||
|
"/test/{a}": {
|
||||||
|
"patch": {
|
||||||
|
"tags": [],
|
||||||
|
"summary": "Great Summary!",
|
||||||
|
"description": "testing more",
|
||||||
|
"parameters": [],
|
||||||
|
"requestBody": {
|
||||||
|
"description": "A Test request",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/TestSimpleRequest"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
"responses": {
|
||||||
|
"201": {
|
||||||
|
"description": "A Successful Endeavor",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/TestCreatedResponse"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"deprecated": false
|
||||||
|
},
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "a",
|
||||||
|
"in": "path",
|
||||||
|
"schema": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"required": true,
|
||||||
|
"deprecated": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "aa",
|
||||||
|
"in": "query",
|
||||||
|
"schema": {
|
||||||
|
"type": "number",
|
||||||
|
"format": "int32"
|
||||||
|
},
|
||||||
|
"required": true,
|
||||||
|
"deprecated": false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"webhooks": {},
|
||||||
|
"components": {
|
||||||
|
"schemas": {
|
||||||
|
"TestCreatedResponse": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"c": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"id": {
|
||||||
|
"type": "number",
|
||||||
|
"format": "int32"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"c",
|
||||||
|
"id"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"TestSimpleRequest": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"a": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"b": {
|
||||||
|
"type": "number",
|
||||||
|
"format": "int32"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"a",
|
||||||
|
"b"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"securitySchemes": {}
|
||||||
|
},
|
||||||
|
"security": [],
|
||||||
|
"tags": []
|
||||||
|
}
|
73
core/src/test/resources/T0006__notarized_head.json
Normal file
73
core/src/test/resources/T0006__notarized_head.json
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
{
|
||||||
|
"openapi": "3.1.0",
|
||||||
|
"jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
|
||||||
|
"info": {
|
||||||
|
"title": "Test API",
|
||||||
|
"version": "1.33.7",
|
||||||
|
"description": "An amazing, fully-ish 😉 generated API spec",
|
||||||
|
"termsOfService": "https://example.com",
|
||||||
|
"contact": {
|
||||||
|
"name": "Homer Simpson",
|
||||||
|
"url": "https://gph.is/1NPUDiM",
|
||||||
|
"email": "chunkylover53@aol.com"
|
||||||
|
},
|
||||||
|
"license": {
|
||||||
|
"name": "MIT",
|
||||||
|
"url": "https://github.com/bkbnio/kompendium/blob/main/LICENSE"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"servers": [
|
||||||
|
{
|
||||||
|
"url": "https://myawesomeapi.com",
|
||||||
|
"description": "Production instance of my API"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://staging.myawesomeapi.com",
|
||||||
|
"description": "Where the fun stuff happens"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"paths": {
|
||||||
|
"/test/{a}": {
|
||||||
|
"head": {
|
||||||
|
"tags": [],
|
||||||
|
"summary": "Great Summary!",
|
||||||
|
"description": "testing more",
|
||||||
|
"parameters": [],
|
||||||
|
"responses": {
|
||||||
|
"201": {
|
||||||
|
"description": "great!"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"deprecated": false
|
||||||
|
},
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "a",
|
||||||
|
"in": "path",
|
||||||
|
"schema": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"required": true,
|
||||||
|
"deprecated": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "aa",
|
||||||
|
"in": "query",
|
||||||
|
"schema": {
|
||||||
|
"type": "number",
|
||||||
|
"format": "int32"
|
||||||
|
},
|
||||||
|
"required": true,
|
||||||
|
"deprecated": false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"webhooks": {},
|
||||||
|
"components": {
|
||||||
|
"schemas": {},
|
||||||
|
"securitySchemes": {}
|
||||||
|
},
|
||||||
|
"security": [],
|
||||||
|
"tags": []
|
||||||
|
}
|
92
core/src/test/resources/T0007__notarized_options.json
Normal file
92
core/src/test/resources/T0007__notarized_options.json
Normal file
@ -0,0 +1,92 @@
|
|||||||
|
{
|
||||||
|
"openapi": "3.1.0",
|
||||||
|
"jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
|
||||||
|
"info": {
|
||||||
|
"title": "Test API",
|
||||||
|
"version": "1.33.7",
|
||||||
|
"description": "An amazing, fully-ish 😉 generated API spec",
|
||||||
|
"termsOfService": "https://example.com",
|
||||||
|
"contact": {
|
||||||
|
"name": "Homer Simpson",
|
||||||
|
"url": "https://gph.is/1NPUDiM",
|
||||||
|
"email": "chunkylover53@aol.com"
|
||||||
|
},
|
||||||
|
"license": {
|
||||||
|
"name": "MIT",
|
||||||
|
"url": "https://github.com/bkbnio/kompendium/blob/main/LICENSE"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"servers": [
|
||||||
|
{
|
||||||
|
"url": "https://myawesomeapi.com",
|
||||||
|
"description": "Production instance of my API"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://staging.myawesomeapi.com",
|
||||||
|
"description": "Where the fun stuff happens"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"paths": {
|
||||||
|
"/test/{a}": {
|
||||||
|
"options": {
|
||||||
|
"tags": [],
|
||||||
|
"summary": "Great Summary!",
|
||||||
|
"description": "testing more",
|
||||||
|
"parameters": [],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "nice",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/TestResponse"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"deprecated": false
|
||||||
|
},
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "a",
|
||||||
|
"in": "path",
|
||||||
|
"schema": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"required": true,
|
||||||
|
"deprecated": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "aa",
|
||||||
|
"in": "query",
|
||||||
|
"schema": {
|
||||||
|
"type": "number",
|
||||||
|
"format": "int32"
|
||||||
|
},
|
||||||
|
"required": true,
|
||||||
|
"deprecated": false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"webhooks": {},
|
||||||
|
"components": {
|
||||||
|
"schemas": {
|
||||||
|
"TestResponse": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"c": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"c"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"securitySchemes": {}
|
||||||
|
},
|
||||||
|
"security": [],
|
||||||
|
"tags": []
|
||||||
|
}
|
146
core/src/test/resources/T0008__complex_type.json
Normal file
146
core/src/test/resources/T0008__complex_type.json
Normal file
@ -0,0 +1,146 @@
|
|||||||
|
{
|
||||||
|
"openapi": "3.1.0",
|
||||||
|
"jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
|
||||||
|
"info": {
|
||||||
|
"title": "Test API",
|
||||||
|
"version": "1.33.7",
|
||||||
|
"description": "An amazing, fully-ish 😉 generated API spec",
|
||||||
|
"termsOfService": "https://example.com",
|
||||||
|
"contact": {
|
||||||
|
"name": "Homer Simpson",
|
||||||
|
"url": "https://gph.is/1NPUDiM",
|
||||||
|
"email": "chunkylover53@aol.com"
|
||||||
|
},
|
||||||
|
"license": {
|
||||||
|
"name": "MIT",
|
||||||
|
"url": "https://github.com/bkbnio/kompendium/blob/main/LICENSE"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"servers": [
|
||||||
|
{
|
||||||
|
"url": "https://myawesomeapi.com",
|
||||||
|
"description": "Production instance of my API"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://staging.myawesomeapi.com",
|
||||||
|
"description": "Where the fun stuff happens"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"paths": {
|
||||||
|
"/": {
|
||||||
|
"put": {
|
||||||
|
"tags": [],
|
||||||
|
"summary": "Great Summary!",
|
||||||
|
"description": "testing more",
|
||||||
|
"parameters": [],
|
||||||
|
"requestBody": {
|
||||||
|
"description": "A Complex request",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/ComplexRequest"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
"responses": {
|
||||||
|
"201": {
|
||||||
|
"description": "A Successful Endeavor",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/TestCreatedResponse"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"deprecated": false
|
||||||
|
},
|
||||||
|
"parameters": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"webhooks": {},
|
||||||
|
"components": {
|
||||||
|
"schemas": {
|
||||||
|
"TestCreatedResponse": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"c": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"id": {
|
||||||
|
"type": "number",
|
||||||
|
"format": "int32"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"c",
|
||||||
|
"id"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"ComplexRequest": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"amazingField": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"org": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"tables": {
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/components/schemas/NestedComplexItem"
|
||||||
|
},
|
||||||
|
"type": "array"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"amazingField",
|
||||||
|
"org",
|
||||||
|
"tables"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"NestedComplexItem": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"alias": {
|
||||||
|
"additionalProperties": {
|
||||||
|
"$ref": "#/components/schemas/CrazyItem"
|
||||||
|
},
|
||||||
|
"type": "object"
|
||||||
|
},
|
||||||
|
"name": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"alias",
|
||||||
|
"name"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"CrazyItem": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"enumeration": {
|
||||||
|
"$ref": "#/components/schemas/SimpleEnum"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"enumeration"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"SimpleEnum": {
|
||||||
|
"type": "string",
|
||||||
|
"enum": [
|
||||||
|
"ONE",
|
||||||
|
"TWO"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"securitySchemes": {}
|
||||||
|
},
|
||||||
|
"security": [],
|
||||||
|
"tags": []
|
||||||
|
}
|
79
core/src/test/resources/T0009__notarized_primitives.json
Normal file
79
core/src/test/resources/T0009__notarized_primitives.json
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
{
|
||||||
|
"openapi": "3.1.0",
|
||||||
|
"jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
|
||||||
|
"info": {
|
||||||
|
"title": "Test API",
|
||||||
|
"version": "1.33.7",
|
||||||
|
"description": "An amazing, fully-ish 😉 generated API spec",
|
||||||
|
"termsOfService": "https://example.com",
|
||||||
|
"contact": {
|
||||||
|
"name": "Homer Simpson",
|
||||||
|
"url": "https://gph.is/1NPUDiM",
|
||||||
|
"email": "chunkylover53@aol.com"
|
||||||
|
},
|
||||||
|
"license": {
|
||||||
|
"name": "MIT",
|
||||||
|
"url": "https://github.com/bkbnio/kompendium/blob/main/LICENSE"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"servers": [
|
||||||
|
{
|
||||||
|
"url": "https://myawesomeapi.com",
|
||||||
|
"description": "Production instance of my API"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://staging.myawesomeapi.com",
|
||||||
|
"description": "Where the fun stuff happens"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"paths": {
|
||||||
|
"/": {
|
||||||
|
"put": {
|
||||||
|
"tags": [],
|
||||||
|
"summary": "Great Summary!",
|
||||||
|
"description": "testing more",
|
||||||
|
"parameters": [],
|
||||||
|
"requestBody": {
|
||||||
|
"description": "A Test Request",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/Int"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
"responses": {
|
||||||
|
"201": {
|
||||||
|
"description": "A Successful Endeavor",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/Boolean"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"deprecated": false
|
||||||
|
},
|
||||||
|
"parameters": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"webhooks": {},
|
||||||
|
"components": {
|
||||||
|
"schemas": {
|
||||||
|
"Boolean": {
|
||||||
|
"type": "boolean"
|
||||||
|
},
|
||||||
|
"Int": {
|
||||||
|
"type": "number",
|
||||||
|
"format": "int32"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"securitySchemes": {}
|
||||||
|
},
|
||||||
|
"security": [],
|
||||||
|
"tags": []
|
||||||
|
}
|
98
core/src/test/resources/T0010__response_list.json
Normal file
98
core/src/test/resources/T0010__response_list.json
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
{
|
||||||
|
"openapi": "3.1.0",
|
||||||
|
"jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
|
||||||
|
"info": {
|
||||||
|
"title": "Test API",
|
||||||
|
"version": "1.33.7",
|
||||||
|
"description": "An amazing, fully-ish 😉 generated API spec",
|
||||||
|
"termsOfService": "https://example.com",
|
||||||
|
"contact": {
|
||||||
|
"name": "Homer Simpson",
|
||||||
|
"url": "https://gph.is/1NPUDiM",
|
||||||
|
"email": "chunkylover53@aol.com"
|
||||||
|
},
|
||||||
|
"license": {
|
||||||
|
"name": "MIT",
|
||||||
|
"url": "https://github.com/bkbnio/kompendium/blob/main/LICENSE"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"servers": [
|
||||||
|
{
|
||||||
|
"url": "https://myawesomeapi.com",
|
||||||
|
"description": "Production instance of my API"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://staging.myawesomeapi.com",
|
||||||
|
"description": "Where the fun stuff happens"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"paths": {
|
||||||
|
"/test/{a}": {
|
||||||
|
"get": {
|
||||||
|
"tags": [],
|
||||||
|
"summary": "Great Summary!",
|
||||||
|
"description": "testing more",
|
||||||
|
"parameters": [],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "A Successful List-y Endeavor",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/List-TestResponse"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"deprecated": false
|
||||||
|
},
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "a",
|
||||||
|
"in": "path",
|
||||||
|
"schema": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"required": true,
|
||||||
|
"deprecated": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "aa",
|
||||||
|
"in": "query",
|
||||||
|
"schema": {
|
||||||
|
"type": "number",
|
||||||
|
"format": "int32"
|
||||||
|
},
|
||||||
|
"required": true,
|
||||||
|
"deprecated": false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"webhooks": {},
|
||||||
|
"components": {
|
||||||
|
"schemas": {
|
||||||
|
"TestResponse": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"c": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"c"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"List-TestResponse": {
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/components/schemas/TestResponse"
|
||||||
|
},
|
||||||
|
"type": "array"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"securitySchemes": {}
|
||||||
|
},
|
||||||
|
"security": [],
|
||||||
|
"tags": []
|
||||||
|
}
|
72
core/src/test/resources/T0011__non_required_params.json
Normal file
72
core/src/test/resources/T0011__non_required_params.json
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
{
|
||||||
|
"openapi": "3.1.0",
|
||||||
|
"jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
|
||||||
|
"info": {
|
||||||
|
"title": "Test API",
|
||||||
|
"version": "1.33.7",
|
||||||
|
"description": "An amazing, fully-ish 😉 generated API spec",
|
||||||
|
"termsOfService": "https://example.com",
|
||||||
|
"contact": {
|
||||||
|
"name": "Homer Simpson",
|
||||||
|
"url": "https://gph.is/1NPUDiM",
|
||||||
|
"email": "chunkylover53@aol.com"
|
||||||
|
},
|
||||||
|
"license": {
|
||||||
|
"name": "MIT",
|
||||||
|
"url": "https://github.com/bkbnio/kompendium/blob/main/LICENSE"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"servers": [
|
||||||
|
{
|
||||||
|
"url": "https://myawesomeapi.com",
|
||||||
|
"description": "Production instance of my API"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://staging.myawesomeapi.com",
|
||||||
|
"description": "Where the fun stuff happens"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"paths": {
|
||||||
|
"/optional": {
|
||||||
|
"get": {
|
||||||
|
"tags": [],
|
||||||
|
"summary": "Great Summary!",
|
||||||
|
"description": "testing more",
|
||||||
|
"parameters": [],
|
||||||
|
"responses": {
|
||||||
|
"204": {
|
||||||
|
"description": "Empty"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"deprecated": false
|
||||||
|
},
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "notRequired",
|
||||||
|
"in": "query",
|
||||||
|
"schema": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"required": false,
|
||||||
|
"deprecated": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "required",
|
||||||
|
"in": "query",
|
||||||
|
"schema": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"required": true,
|
||||||
|
"deprecated": false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"webhooks": {},
|
||||||
|
"components": {
|
||||||
|
"schemas": {},
|
||||||
|
"securitySchemes": {}
|
||||||
|
},
|
||||||
|
"security": [],
|
||||||
|
"tags": []
|
||||||
|
}
|
82
core/src/test/resources/T0012__path_parser.json
Normal file
82
core/src/test/resources/T0012__path_parser.json
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
{
|
||||||
|
"openapi": "3.1.0",
|
||||||
|
"jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
|
||||||
|
"info": {
|
||||||
|
"title": "Test API",
|
||||||
|
"version": "1.33.7",
|
||||||
|
"description": "An amazing, fully-ish 😉 generated API spec",
|
||||||
|
"termsOfService": "https://example.com",
|
||||||
|
"contact": {
|
||||||
|
"name": "Homer Simpson",
|
||||||
|
"url": "https://gph.is/1NPUDiM",
|
||||||
|
"email": "chunkylover53@aol.com"
|
||||||
|
},
|
||||||
|
"license": {
|
||||||
|
"name": "MIT",
|
||||||
|
"url": "https://github.com/bkbnio/kompendium/blob/main/LICENSE"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"servers": [
|
||||||
|
{
|
||||||
|
"url": "https://myawesomeapi.com",
|
||||||
|
"description": "Production instance of my API"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://staging.myawesomeapi.com",
|
||||||
|
"description": "Where the fun stuff happens"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"paths": {
|
||||||
|
"/this/is/a/complex/path/with/an/{id}": {
|
||||||
|
"get": {
|
||||||
|
"tags": [],
|
||||||
|
"summary": "Great Summary!",
|
||||||
|
"description": "testing more",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "id",
|
||||||
|
"in": "path",
|
||||||
|
"schema": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"required": true,
|
||||||
|
"deprecated": false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "A Successful Endeavor",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/TestResponse"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"deprecated": false
|
||||||
|
},
|
||||||
|
"parameters": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"webhooks": {},
|
||||||
|
"components": {
|
||||||
|
"schemas": {
|
||||||
|
"TestResponse": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"c": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"c"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"securitySchemes": {}
|
||||||
|
},
|
||||||
|
"security": [],
|
||||||
|
"tags": []
|
||||||
|
}
|
83
core/src/test/resources/T0013__root_route.json
Normal file
83
core/src/test/resources/T0013__root_route.json
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
{
|
||||||
|
"openapi": "3.1.0",
|
||||||
|
"jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
|
||||||
|
"info": {
|
||||||
|
"title": "Test API",
|
||||||
|
"version": "1.33.7",
|
||||||
|
"description": "An amazing, fully-ish 😉 generated API spec",
|
||||||
|
"termsOfService": "https://example.com",
|
||||||
|
"contact": {
|
||||||
|
"name": "Homer Simpson",
|
||||||
|
"url": "https://gph.is/1NPUDiM",
|
||||||
|
"email": "chunkylover53@aol.com"
|
||||||
|
},
|
||||||
|
"license": {
|
||||||
|
"name": "MIT",
|
||||||
|
"url": "https://github.com/bkbnio/kompendium/blob/main/LICENSE"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"servers": [
|
||||||
|
{
|
||||||
|
"url": "https://myawesomeapi.com",
|
||||||
|
"description": "Production instance of my API"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://staging.myawesomeapi.com",
|
||||||
|
"description": "Where the fun stuff happens"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"paths": {
|
||||||
|
"/": {
|
||||||
|
"get": {
|
||||||
|
"tags": [],
|
||||||
|
"summary": "Great Summary!",
|
||||||
|
"description": "testing more",
|
||||||
|
"parameters": [],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "A Successful Endeavor",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/TestResponse"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"deprecated": false
|
||||||
|
},
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "aa",
|
||||||
|
"in": "query",
|
||||||
|
"schema": {
|
||||||
|
"type": "number",
|
||||||
|
"format": "int32"
|
||||||
|
},
|
||||||
|
"required": true,
|
||||||
|
"deprecated": false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"webhooks": {},
|
||||||
|
"components": {
|
||||||
|
"schemas": {
|
||||||
|
"TestResponse": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"c": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"c"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"securitySchemes": {}
|
||||||
|
},
|
||||||
|
"security": [],
|
||||||
|
"tags": []
|
||||||
|
}
|
72
core/src/test/resources/T0014__nested_under_root.json
Normal file
72
core/src/test/resources/T0014__nested_under_root.json
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
{
|
||||||
|
"openapi": "3.1.0",
|
||||||
|
"jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
|
||||||
|
"info": {
|
||||||
|
"title": "Test API",
|
||||||
|
"version": "1.33.7",
|
||||||
|
"description": "An amazing, fully-ish 😉 generated API spec",
|
||||||
|
"termsOfService": "https://example.com",
|
||||||
|
"contact": {
|
||||||
|
"name": "Homer Simpson",
|
||||||
|
"url": "https://gph.is/1NPUDiM",
|
||||||
|
"email": "chunkylover53@aol.com"
|
||||||
|
},
|
||||||
|
"license": {
|
||||||
|
"name": "MIT",
|
||||||
|
"url": "https://github.com/bkbnio/kompendium/blob/main/LICENSE"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"servers": [
|
||||||
|
{
|
||||||
|
"url": "https://myawesomeapi.com",
|
||||||
|
"description": "Production instance of my API"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://staging.myawesomeapi.com",
|
||||||
|
"description": "Where the fun stuff happens"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"paths": {
|
||||||
|
"/testerino": {
|
||||||
|
"get": {
|
||||||
|
"tags": [],
|
||||||
|
"summary": "Great Summary!",
|
||||||
|
"description": "testing more",
|
||||||
|
"parameters": [],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "A Successful Endeavor",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/TestResponse"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"deprecated": false
|
||||||
|
},
|
||||||
|
"parameters": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"webhooks": {},
|
||||||
|
"components": {
|
||||||
|
"schemas": {
|
||||||
|
"TestResponse": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"c": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"c"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"securitySchemes": {}
|
||||||
|
},
|
||||||
|
"security": [],
|
||||||
|
"tags": []
|
||||||
|
}
|
72
core/src/test/resources/T0015__trailing_slash.json
Normal file
72
core/src/test/resources/T0015__trailing_slash.json
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
{
|
||||||
|
"openapi": "3.1.0",
|
||||||
|
"jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
|
||||||
|
"info": {
|
||||||
|
"title": "Test API",
|
||||||
|
"version": "1.33.7",
|
||||||
|
"description": "An amazing, fully-ish 😉 generated API spec",
|
||||||
|
"termsOfService": "https://example.com",
|
||||||
|
"contact": {
|
||||||
|
"name": "Homer Simpson",
|
||||||
|
"url": "https://gph.is/1NPUDiM",
|
||||||
|
"email": "chunkylover53@aol.com"
|
||||||
|
},
|
||||||
|
"license": {
|
||||||
|
"name": "MIT",
|
||||||
|
"url": "https://github.com/bkbnio/kompendium/blob/main/LICENSE"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"servers": [
|
||||||
|
{
|
||||||
|
"url": "https://myawesomeapi.com",
|
||||||
|
"description": "Production instance of my API"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://staging.myawesomeapi.com",
|
||||||
|
"description": "Where the fun stuff happens"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"paths": {
|
||||||
|
"/test/": {
|
||||||
|
"get": {
|
||||||
|
"tags": [],
|
||||||
|
"summary": "Great Summary!",
|
||||||
|
"description": "testing more",
|
||||||
|
"parameters": [],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "A Successful Endeavor",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/TestResponse"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"deprecated": false
|
||||||
|
},
|
||||||
|
"parameters": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"webhooks": {},
|
||||||
|
"components": {
|
||||||
|
"schemas": {
|
||||||
|
"TestResponse": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"c": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"c"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"securitySchemes": {}
|
||||||
|
},
|
||||||
|
"security": [],
|
||||||
|
"tags": []
|
||||||
|
}
|
@ -0,0 +1,93 @@
|
|||||||
|
{
|
||||||
|
"openapi": "3.1.0",
|
||||||
|
"jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
|
||||||
|
"info": {
|
||||||
|
"title": "Test API",
|
||||||
|
"version": "1.33.7",
|
||||||
|
"description": "An amazing, fully-ish 😉 generated API spec",
|
||||||
|
"termsOfService": "https://example.com",
|
||||||
|
"contact": {
|
||||||
|
"name": "Homer Simpson",
|
||||||
|
"url": "https://gph.is/1NPUDiM",
|
||||||
|
"email": "chunkylover53@aol.com"
|
||||||
|
},
|
||||||
|
"license": {
|
||||||
|
"name": "MIT",
|
||||||
|
"url": "https://github.com/bkbnio/kompendium/blob/main/LICENSE"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"servers": [
|
||||||
|
{
|
||||||
|
"url": "https://myawesomeapi.com",
|
||||||
|
"description": "Production instance of my API"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://staging.myawesomeapi.com",
|
||||||
|
"description": "Where the fun stuff happens"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"paths": {
|
||||||
|
"/": {
|
||||||
|
"get": {
|
||||||
|
"tags": [],
|
||||||
|
"summary": "Great Summary!",
|
||||||
|
"description": "testing more",
|
||||||
|
"parameters": [],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "A Successful Endeavor",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/TestResponse"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"400": {
|
||||||
|
"description": "Bad Things Happened",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/ExceptionResponse"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"deprecated": false
|
||||||
|
},
|
||||||
|
"parameters": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"webhooks": {},
|
||||||
|
"components": {
|
||||||
|
"schemas": {
|
||||||
|
"TestResponse": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"c": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"c"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"ExceptionResponse": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"message": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"message"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"securitySchemes": {}
|
||||||
|
},
|
||||||
|
"security": [],
|
||||||
|
"tags": []
|
||||||
|
}
|
@ -0,0 +1,103 @@
|
|||||||
|
{
|
||||||
|
"openapi": "3.1.0",
|
||||||
|
"jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
|
||||||
|
"info": {
|
||||||
|
"title": "Test API",
|
||||||
|
"version": "1.33.7",
|
||||||
|
"description": "An amazing, fully-ish 😉 generated API spec",
|
||||||
|
"termsOfService": "https://example.com",
|
||||||
|
"contact": {
|
||||||
|
"name": "Homer Simpson",
|
||||||
|
"url": "https://gph.is/1NPUDiM",
|
||||||
|
"email": "chunkylover53@aol.com"
|
||||||
|
},
|
||||||
|
"license": {
|
||||||
|
"name": "MIT",
|
||||||
|
"url": "https://github.com/bkbnio/kompendium/blob/main/LICENSE"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"servers": [
|
||||||
|
{
|
||||||
|
"url": "https://myawesomeapi.com",
|
||||||
|
"description": "Production instance of my API"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://staging.myawesomeapi.com",
|
||||||
|
"description": "Where the fun stuff happens"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"paths": {
|
||||||
|
"/": {
|
||||||
|
"get": {
|
||||||
|
"tags": [],
|
||||||
|
"summary": "Great Summary!",
|
||||||
|
"description": "testing more",
|
||||||
|
"parameters": [],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "A Successful Endeavor",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/TestResponse"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"400": {
|
||||||
|
"description": "Bad Things Happened",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/ExceptionResponse"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"403": {
|
||||||
|
"description": "Access Denied",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/ExceptionResponse"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"deprecated": false
|
||||||
|
},
|
||||||
|
"parameters": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"webhooks": {},
|
||||||
|
"components": {
|
||||||
|
"schemas": {
|
||||||
|
"TestResponse": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"c": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"c"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"ExceptionResponse": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"message": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"message"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"securitySchemes": {}
|
||||||
|
},
|
||||||
|
"security": [],
|
||||||
|
"tags": []
|
||||||
|
}
|
@ -0,0 +1,126 @@
|
|||||||
|
{
|
||||||
|
"openapi": "3.1.0",
|
||||||
|
"jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
|
||||||
|
"info": {
|
||||||
|
"title": "Test API",
|
||||||
|
"version": "1.33.7",
|
||||||
|
"description": "An amazing, fully-ish 😉 generated API spec",
|
||||||
|
"termsOfService": "https://example.com",
|
||||||
|
"contact": {
|
||||||
|
"name": "Homer Simpson",
|
||||||
|
"url": "https://gph.is/1NPUDiM",
|
||||||
|
"email": "chunkylover53@aol.com"
|
||||||
|
},
|
||||||
|
"license": {
|
||||||
|
"name": "MIT",
|
||||||
|
"url": "https://github.com/bkbnio/kompendium/blob/main/LICENSE"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"servers": [
|
||||||
|
{
|
||||||
|
"url": "https://myawesomeapi.com",
|
||||||
|
"description": "Production instance of my API"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://staging.myawesomeapi.com",
|
||||||
|
"description": "Where the fun stuff happens"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"paths": {
|
||||||
|
"/": {
|
||||||
|
"get": {
|
||||||
|
"tags": [],
|
||||||
|
"summary": "Great Summary!",
|
||||||
|
"description": "testing more",
|
||||||
|
"parameters": [],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "A Successful Endeavor",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/TestResponse"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"500": {
|
||||||
|
"description": "Bad Things Happened",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/FlibbityGibbit"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"deprecated": false
|
||||||
|
},
|
||||||
|
"parameters": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"webhooks": {},
|
||||||
|
"components": {
|
||||||
|
"schemas": {
|
||||||
|
"TestResponse": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"c": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"c"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"ComplexGibbit": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"b": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"c": {
|
||||||
|
"type": "number",
|
||||||
|
"format": "int32"
|
||||||
|
},
|
||||||
|
"z": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"b",
|
||||||
|
"c",
|
||||||
|
"z"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"SimpleGibbit": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"a": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"z": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"a"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"FlibbityGibbit": {
|
||||||
|
"anyOf": [
|
||||||
|
{
|
||||||
|
"$ref": "#/components/schemas/ComplexGibbit"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"$ref": "#/components/schemas/SimpleGibbit"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"securitySchemes": {}
|
||||||
|
},
|
||||||
|
"security": [],
|
||||||
|
"tags": []
|
||||||
|
}
|
118
core/src/test/resources/T0019__generic_exception.json
Normal file
118
core/src/test/resources/T0019__generic_exception.json
Normal file
@ -0,0 +1,118 @@
|
|||||||
|
{
|
||||||
|
"openapi": "3.1.0",
|
||||||
|
"jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
|
||||||
|
"info": {
|
||||||
|
"title": "Test API",
|
||||||
|
"version": "1.33.7",
|
||||||
|
"description": "An amazing, fully-ish 😉 generated API spec",
|
||||||
|
"termsOfService": "https://example.com",
|
||||||
|
"contact": {
|
||||||
|
"name": "Homer Simpson",
|
||||||
|
"url": "https://gph.is/1NPUDiM",
|
||||||
|
"email": "chunkylover53@aol.com"
|
||||||
|
},
|
||||||
|
"license": {
|
||||||
|
"name": "MIT",
|
||||||
|
"url": "https://github.com/bkbnio/kompendium/blob/main/LICENSE"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"servers": [
|
||||||
|
{
|
||||||
|
"url": "https://myawesomeapi.com",
|
||||||
|
"description": "Production instance of my API"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://staging.myawesomeapi.com",
|
||||||
|
"description": "Where the fun stuff happens"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"paths": {
|
||||||
|
"/": {
|
||||||
|
"get": {
|
||||||
|
"tags": [],
|
||||||
|
"summary": "Great Summary!",
|
||||||
|
"description": "testing more",
|
||||||
|
"parameters": [],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "A Successful Endeavor",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/TestResponse"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"400": {
|
||||||
|
"description": "Bad Things Happened",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/Flibbity-String"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"deprecated": false
|
||||||
|
},
|
||||||
|
"parameters": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"webhooks": {},
|
||||||
|
"components": {
|
||||||
|
"schemas": {
|
||||||
|
"TestResponse": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"c": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"c"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"Bibbity-String": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"b": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"f": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"b",
|
||||||
|
"f"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"Gibbity-String": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"a": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"a"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"Flibbity-String": {
|
||||||
|
"anyOf": [
|
||||||
|
{
|
||||||
|
"$ref": "#/components/schemas/Bibbity-String"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"$ref": "#/components/schemas/Gibbity-String"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"securitySchemes": {}
|
||||||
|
},
|
||||||
|
"security": [],
|
||||||
|
"tags": []
|
||||||
|
}
|
136
core/src/test/resources/T0020__example_req_and_resp.json
Normal file
136
core/src/test/resources/T0020__example_req_and_resp.json
Normal file
@ -0,0 +1,136 @@
|
|||||||
|
{
|
||||||
|
"openapi": "3.1.0",
|
||||||
|
"jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
|
||||||
|
"info": {
|
||||||
|
"title": "Test API",
|
||||||
|
"version": "1.33.7",
|
||||||
|
"description": "An amazing, fully-ish 😉 generated API spec",
|
||||||
|
"termsOfService": "https://example.com",
|
||||||
|
"contact": {
|
||||||
|
"name": "Homer Simpson",
|
||||||
|
"url": "https://gph.is/1NPUDiM",
|
||||||
|
"email": "chunkylover53@aol.com"
|
||||||
|
},
|
||||||
|
"license": {
|
||||||
|
"name": "MIT",
|
||||||
|
"url": "https://github.com/bkbnio/kompendium/blob/main/LICENSE"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"servers": [
|
||||||
|
{
|
||||||
|
"url": "https://myawesomeapi.com",
|
||||||
|
"description": "Production instance of my API"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://staging.myawesomeapi.com",
|
||||||
|
"description": "Where the fun stuff happens"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"paths": {
|
||||||
|
"/": {
|
||||||
|
"post": {
|
||||||
|
"tags": [],
|
||||||
|
"summary": "Great Summary!",
|
||||||
|
"description": "testing more",
|
||||||
|
"parameters": [],
|
||||||
|
"requestBody": {
|
||||||
|
"description": "You gotta send it",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/TestRequest"
|
||||||
|
},
|
||||||
|
"examples": {
|
||||||
|
"Testerina": {
|
||||||
|
"value": {
|
||||||
|
"fieldName": {
|
||||||
|
"nesty": "asdf"
|
||||||
|
},
|
||||||
|
"b": 1.5,
|
||||||
|
"aaa": []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "A Successful Endeavor",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/TestResponse"
|
||||||
|
},
|
||||||
|
"examples": {
|
||||||
|
"Testerino": {
|
||||||
|
"value": {
|
||||||
|
"c": "Heya"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"deprecated": false
|
||||||
|
},
|
||||||
|
"parameters": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"webhooks": {},
|
||||||
|
"components": {
|
||||||
|
"schemas": {
|
||||||
|
"TestResponse": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"c": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"c"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"TestRequest": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"aaa": {
|
||||||
|
"items": {
|
||||||
|
"type": "number",
|
||||||
|
"format": "int64"
|
||||||
|
},
|
||||||
|
"type": "array"
|
||||||
|
},
|
||||||
|
"b": {
|
||||||
|
"type": "number",
|
||||||
|
"format": "double"
|
||||||
|
},
|
||||||
|
"fieldName": {
|
||||||
|
"$ref": "#/components/schemas/TestNested"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"aaa",
|
||||||
|
"b",
|
||||||
|
"fieldName"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"TestNested": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"nesty": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"nesty"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"securitySchemes": {}
|
||||||
|
},
|
||||||
|
"security": [],
|
||||||
|
"tags": []
|
||||||
|
}
|
87
core/src/test/resources/T0021__example_parameters.json
Normal file
87
core/src/test/resources/T0021__example_parameters.json
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
{
|
||||||
|
"openapi": "3.1.0",
|
||||||
|
"jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
|
||||||
|
"info": {
|
||||||
|
"title": "Test API",
|
||||||
|
"version": "1.33.7",
|
||||||
|
"description": "An amazing, fully-ish 😉 generated API spec",
|
||||||
|
"termsOfService": "https://example.com",
|
||||||
|
"contact": {
|
||||||
|
"name": "Homer Simpson",
|
||||||
|
"url": "https://gph.is/1NPUDiM",
|
||||||
|
"email": "chunkylover53@aol.com"
|
||||||
|
},
|
||||||
|
"license": {
|
||||||
|
"name": "MIT",
|
||||||
|
"url": "https://github.com/bkbnio/kompendium/blob/main/LICENSE"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"servers": [
|
||||||
|
{
|
||||||
|
"url": "https://myawesomeapi.com",
|
||||||
|
"description": "Production instance of my API"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://staging.myawesomeapi.com",
|
||||||
|
"description": "Where the fun stuff happens"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"paths": {
|
||||||
|
"/": {
|
||||||
|
"get": {
|
||||||
|
"tags": [],
|
||||||
|
"summary": "Great Summary!",
|
||||||
|
"description": "testing more",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "id",
|
||||||
|
"in": "path",
|
||||||
|
"schema": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"required": true,
|
||||||
|
"deprecated": false,
|
||||||
|
"examples": {
|
||||||
|
"foo": {
|
||||||
|
"value": "testing"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "A Successful Endeavor",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/TestResponse"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"deprecated": false
|
||||||
|
},
|
||||||
|
"parameters": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"webhooks": {},
|
||||||
|
"components": {
|
||||||
|
"schemas": {
|
||||||
|
"TestResponse": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"c": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"c"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"securitySchemes": {}
|
||||||
|
},
|
||||||
|
"security": [],
|
||||||
|
"tags": []
|
||||||
|
}
|
@ -0,0 +1,83 @@
|
|||||||
|
{
|
||||||
|
"openapi": "3.1.0",
|
||||||
|
"jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
|
||||||
|
"info": {
|
||||||
|
"title": "Test API",
|
||||||
|
"version": "1.33.7",
|
||||||
|
"description": "An amazing, fully-ish 😉 generated API spec",
|
||||||
|
"termsOfService": "https://example.com",
|
||||||
|
"contact": {
|
||||||
|
"name": "Homer Simpson",
|
||||||
|
"url": "https://gph.is/1NPUDiM",
|
||||||
|
"email": "chunkylover53@aol.com"
|
||||||
|
},
|
||||||
|
"license": {
|
||||||
|
"name": "MIT",
|
||||||
|
"url": "https://github.com/bkbnio/kompendium/blob/main/LICENSE"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"servers": [
|
||||||
|
{
|
||||||
|
"url": "https://myawesomeapi.com",
|
||||||
|
"description": "Production instance of my API"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://staging.myawesomeapi.com",
|
||||||
|
"description": "Where the fun stuff happens"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"paths": {
|
||||||
|
"/": {
|
||||||
|
"get": {
|
||||||
|
"tags": [],
|
||||||
|
"summary": "Great Summary!",
|
||||||
|
"description": "testing more",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "id",
|
||||||
|
"in": "path",
|
||||||
|
"schema": {
|
||||||
|
"type": "string",
|
||||||
|
"default": "IDK"
|
||||||
|
},
|
||||||
|
"required": true,
|
||||||
|
"deprecated": false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "A Successful Endeavor",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/TestResponse"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"deprecated": false
|
||||||
|
},
|
||||||
|
"parameters": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"webhooks": {},
|
||||||
|
"components": {
|
||||||
|
"schemas": {
|
||||||
|
"TestResponse": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"c": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"c"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"securitySchemes": {}
|
||||||
|
},
|
||||||
|
"security": [],
|
||||||
|
"tags": []
|
||||||
|
}
|
82
core/src/test/resources/T0023__required_param.json
Normal file
82
core/src/test/resources/T0023__required_param.json
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
{
|
||||||
|
"openapi": "3.1.0",
|
||||||
|
"jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
|
||||||
|
"info": {
|
||||||
|
"title": "Test API",
|
||||||
|
"version": "1.33.7",
|
||||||
|
"description": "An amazing, fully-ish 😉 generated API spec",
|
||||||
|
"termsOfService": "https://example.com",
|
||||||
|
"contact": {
|
||||||
|
"name": "Homer Simpson",
|
||||||
|
"url": "https://gph.is/1NPUDiM",
|
||||||
|
"email": "chunkylover53@aol.com"
|
||||||
|
},
|
||||||
|
"license": {
|
||||||
|
"name": "MIT",
|
||||||
|
"url": "https://github.com/bkbnio/kompendium/blob/main/LICENSE"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"servers": [
|
||||||
|
{
|
||||||
|
"url": "https://myawesomeapi.com",
|
||||||
|
"description": "Production instance of my API"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://staging.myawesomeapi.com",
|
||||||
|
"description": "Where the fun stuff happens"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"paths": {
|
||||||
|
"/": {
|
||||||
|
"get": {
|
||||||
|
"tags": [],
|
||||||
|
"summary": "Great Summary!",
|
||||||
|
"description": "testing more",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "id",
|
||||||
|
"in": "path",
|
||||||
|
"schema": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"required": true,
|
||||||
|
"deprecated": false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "A Successful Endeavor",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/TestResponse"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"deprecated": false
|
||||||
|
},
|
||||||
|
"parameters": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"webhooks": {},
|
||||||
|
"components": {
|
||||||
|
"schemas": {
|
||||||
|
"TestResponse": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"c": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"c"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"securitySchemes": {}
|
||||||
|
},
|
||||||
|
"security": [],
|
||||||
|
"tags": []
|
||||||
|
}
|
82
core/src/test/resources/T0024__non_required_param.json
Normal file
82
core/src/test/resources/T0024__non_required_param.json
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
{
|
||||||
|
"openapi": "3.1.0",
|
||||||
|
"jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
|
||||||
|
"info": {
|
||||||
|
"title": "Test API",
|
||||||
|
"version": "1.33.7",
|
||||||
|
"description": "An amazing, fully-ish 😉 generated API spec",
|
||||||
|
"termsOfService": "https://example.com",
|
||||||
|
"contact": {
|
||||||
|
"name": "Homer Simpson",
|
||||||
|
"url": "https://gph.is/1NPUDiM",
|
||||||
|
"email": "chunkylover53@aol.com"
|
||||||
|
},
|
||||||
|
"license": {
|
||||||
|
"name": "MIT",
|
||||||
|
"url": "https://github.com/bkbnio/kompendium/blob/main/LICENSE"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"servers": [
|
||||||
|
{
|
||||||
|
"url": "https://myawesomeapi.com",
|
||||||
|
"description": "Production instance of my API"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://staging.myawesomeapi.com",
|
||||||
|
"description": "Where the fun stuff happens"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"paths": {
|
||||||
|
"/": {
|
||||||
|
"get": {
|
||||||
|
"tags": [],
|
||||||
|
"summary": "Great Summary!",
|
||||||
|
"description": "testing more",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "id",
|
||||||
|
"in": "query",
|
||||||
|
"schema": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"required": false,
|
||||||
|
"deprecated": false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "A Successful Endeavor",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/TestResponse"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"deprecated": false
|
||||||
|
},
|
||||||
|
"parameters": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"webhooks": {},
|
||||||
|
"components": {
|
||||||
|
"schemas": {
|
||||||
|
"TestResponse": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"c": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"c"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"securitySchemes": {}
|
||||||
|
},
|
||||||
|
"security": [],
|
||||||
|
"tags": []
|
||||||
|
}
|
76
core/src/test/resources/T0025__default_field.json
Normal file
76
core/src/test/resources/T0025__default_field.json
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
{
|
||||||
|
"openapi": "3.1.0",
|
||||||
|
"jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
|
||||||
|
"info": {
|
||||||
|
"title": "Test API",
|
||||||
|
"version": "1.33.7",
|
||||||
|
"description": "An amazing, fully-ish 😉 generated API spec",
|
||||||
|
"termsOfService": "https://example.com",
|
||||||
|
"contact": {
|
||||||
|
"name": "Homer Simpson",
|
||||||
|
"url": "https://gph.is/1NPUDiM",
|
||||||
|
"email": "chunkylover53@aol.com"
|
||||||
|
},
|
||||||
|
"license": {
|
||||||
|
"name": "MIT",
|
||||||
|
"url": "https://github.com/bkbnio/kompendium/blob/main/LICENSE"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"servers": [
|
||||||
|
{
|
||||||
|
"url": "https://myawesomeapi.com",
|
||||||
|
"description": "Production instance of my API"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://staging.myawesomeapi.com",
|
||||||
|
"description": "Where the fun stuff happens"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"paths": {
|
||||||
|
"/": {
|
||||||
|
"get": {
|
||||||
|
"tags": [],
|
||||||
|
"summary": "Great Summary!",
|
||||||
|
"description": "testing more",
|
||||||
|
"parameters": [],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "A Successful Endeavor",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/DefaultField"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"deprecated": false
|
||||||
|
},
|
||||||
|
"parameters": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"webhooks": {},
|
||||||
|
"components": {
|
||||||
|
"schemas": {
|
||||||
|
"DefaultField": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"a": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"b": {
|
||||||
|
"type": "number",
|
||||||
|
"format": "int32"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"b"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"securitySchemes": {}
|
||||||
|
},
|
||||||
|
"security": [],
|
||||||
|
"tags": []
|
||||||
|
}
|
77
core/src/test/resources/T0026__nullable_field.json
Normal file
77
core/src/test/resources/T0026__nullable_field.json
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
{
|
||||||
|
"openapi": "3.1.0",
|
||||||
|
"jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
|
||||||
|
"info": {
|
||||||
|
"title": "Test API",
|
||||||
|
"version": "1.33.7",
|
||||||
|
"description": "An amazing, fully-ish 😉 generated API spec",
|
||||||
|
"termsOfService": "https://example.com",
|
||||||
|
"contact": {
|
||||||
|
"name": "Homer Simpson",
|
||||||
|
"url": "https://gph.is/1NPUDiM",
|
||||||
|
"email": "chunkylover53@aol.com"
|
||||||
|
},
|
||||||
|
"license": {
|
||||||
|
"name": "MIT",
|
||||||
|
"url": "https://github.com/bkbnio/kompendium/blob/main/LICENSE"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"servers": [
|
||||||
|
{
|
||||||
|
"url": "https://myawesomeapi.com",
|
||||||
|
"description": "Production instance of my API"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://staging.myawesomeapi.com",
|
||||||
|
"description": "Where the fun stuff happens"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"paths": {
|
||||||
|
"/": {
|
||||||
|
"get": {
|
||||||
|
"tags": [],
|
||||||
|
"summary": "Great Summary!",
|
||||||
|
"description": "testing more",
|
||||||
|
"parameters": [],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "A Successful Endeavor",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/NullableField"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"deprecated": false
|
||||||
|
},
|
||||||
|
"parameters": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"webhooks": {},
|
||||||
|
"components": {
|
||||||
|
"schemas": {
|
||||||
|
"NullableField": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"a": {
|
||||||
|
"oneOf": [
|
||||||
|
{
|
||||||
|
"type": "null"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"securitySchemes": {}
|
||||||
|
},
|
||||||
|
"security": [],
|
||||||
|
"tags": []
|
||||||
|
}
|
105
core/src/test/resources/T0027__polymorphic_response.json
Normal file
105
core/src/test/resources/T0027__polymorphic_response.json
Normal file
@ -0,0 +1,105 @@
|
|||||||
|
{
|
||||||
|
"openapi": "3.1.0",
|
||||||
|
"jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
|
||||||
|
"info": {
|
||||||
|
"title": "Test API",
|
||||||
|
"version": "1.33.7",
|
||||||
|
"description": "An amazing, fully-ish 😉 generated API spec",
|
||||||
|
"termsOfService": "https://example.com",
|
||||||
|
"contact": {
|
||||||
|
"name": "Homer Simpson",
|
||||||
|
"url": "https://gph.is/1NPUDiM",
|
||||||
|
"email": "chunkylover53@aol.com"
|
||||||
|
},
|
||||||
|
"license": {
|
||||||
|
"name": "MIT",
|
||||||
|
"url": "https://github.com/bkbnio/kompendium/blob/main/LICENSE"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"servers": [
|
||||||
|
{
|
||||||
|
"url": "https://myawesomeapi.com",
|
||||||
|
"description": "Production instance of my API"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://staging.myawesomeapi.com",
|
||||||
|
"description": "Where the fun stuff happens"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"paths": {
|
||||||
|
"/": {
|
||||||
|
"get": {
|
||||||
|
"tags": [],
|
||||||
|
"summary": "Great Summary!",
|
||||||
|
"description": "testing more",
|
||||||
|
"parameters": [],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "A Successful Endeavor",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/FlibbityGibbit"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"deprecated": false
|
||||||
|
},
|
||||||
|
"parameters": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"webhooks": {},
|
||||||
|
"components": {
|
||||||
|
"schemas": {
|
||||||
|
"ComplexGibbit": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"b": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"c": {
|
||||||
|
"type": "number",
|
||||||
|
"format": "int32"
|
||||||
|
},
|
||||||
|
"z": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"b",
|
||||||
|
"c",
|
||||||
|
"z"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"SimpleGibbit": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"a": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"z": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"a"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"FlibbityGibbit": {
|
||||||
|
"anyOf": [
|
||||||
|
{
|
||||||
|
"$ref": "#/components/schemas/ComplexGibbit"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"$ref": "#/components/schemas/SimpleGibbit"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"securitySchemes": {}
|
||||||
|
},
|
||||||
|
"security": [],
|
||||||
|
"tags": []
|
||||||
|
}
|
108
core/src/test/resources/T0028__polymorphic_list_response.json
Normal file
108
core/src/test/resources/T0028__polymorphic_list_response.json
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
{
|
||||||
|
"openapi": "3.1.0",
|
||||||
|
"jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
|
||||||
|
"info": {
|
||||||
|
"title": "Test API",
|
||||||
|
"version": "1.33.7",
|
||||||
|
"description": "An amazing, fully-ish 😉 generated API spec",
|
||||||
|
"termsOfService": "https://example.com",
|
||||||
|
"contact": {
|
||||||
|
"name": "Homer Simpson",
|
||||||
|
"url": "https://gph.is/1NPUDiM",
|
||||||
|
"email": "chunkylover53@aol.com"
|
||||||
|
},
|
||||||
|
"license": {
|
||||||
|
"name": "MIT",
|
||||||
|
"url": "https://github.com/bkbnio/kompendium/blob/main/LICENSE"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"servers": [
|
||||||
|
{
|
||||||
|
"url": "https://myawesomeapi.com",
|
||||||
|
"description": "Production instance of my API"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://staging.myawesomeapi.com",
|
||||||
|
"description": "Where the fun stuff happens"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"paths": {
|
||||||
|
"/": {
|
||||||
|
"get": {
|
||||||
|
"tags": [],
|
||||||
|
"summary": "Great Summary!",
|
||||||
|
"description": "testing more",
|
||||||
|
"parameters": [],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "A Successful Endeavor",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/List-FlibbityGibbit"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"deprecated": false
|
||||||
|
},
|
||||||
|
"parameters": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"webhooks": {},
|
||||||
|
"components": {
|
||||||
|
"schemas": {
|
||||||
|
"ComplexGibbit": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"b": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"c": {
|
||||||
|
"type": "number",
|
||||||
|
"format": "int32"
|
||||||
|
},
|
||||||
|
"z": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"b",
|
||||||
|
"c",
|
||||||
|
"z"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"SimpleGibbit": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"a": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"z": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"a"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"List-FlibbityGibbit": {
|
||||||
|
"items": {
|
||||||
|
"anyOf": [
|
||||||
|
{
|
||||||
|
"$ref": "#/components/schemas/ComplexGibbit"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"$ref": "#/components/schemas/SimpleGibbit"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"type": "array"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"securitySchemes": {}
|
||||||
|
},
|
||||||
|
"security": [],
|
||||||
|
"tags": []
|
||||||
|
}
|
108
core/src/test/resources/T0029__polymorphic_map_response.json
Normal file
108
core/src/test/resources/T0029__polymorphic_map_response.json
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
{
|
||||||
|
"openapi": "3.1.0",
|
||||||
|
"jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
|
||||||
|
"info": {
|
||||||
|
"title": "Test API",
|
||||||
|
"version": "1.33.7",
|
||||||
|
"description": "An amazing, fully-ish 😉 generated API spec",
|
||||||
|
"termsOfService": "https://example.com",
|
||||||
|
"contact": {
|
||||||
|
"name": "Homer Simpson",
|
||||||
|
"url": "https://gph.is/1NPUDiM",
|
||||||
|
"email": "chunkylover53@aol.com"
|
||||||
|
},
|
||||||
|
"license": {
|
||||||
|
"name": "MIT",
|
||||||
|
"url": "https://github.com/bkbnio/kompendium/blob/main/LICENSE"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"servers": [
|
||||||
|
{
|
||||||
|
"url": "https://myawesomeapi.com",
|
||||||
|
"description": "Production instance of my API"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://staging.myawesomeapi.com",
|
||||||
|
"description": "Where the fun stuff happens"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"paths": {
|
||||||
|
"/": {
|
||||||
|
"get": {
|
||||||
|
"tags": [],
|
||||||
|
"summary": "Great Summary!",
|
||||||
|
"description": "testing more",
|
||||||
|
"parameters": [],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "A Successful Endeavor",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/Map-String-FlibbityGibbit"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"deprecated": false
|
||||||
|
},
|
||||||
|
"parameters": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"webhooks": {},
|
||||||
|
"components": {
|
||||||
|
"schemas": {
|
||||||
|
"ComplexGibbit": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"b": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"c": {
|
||||||
|
"type": "number",
|
||||||
|
"format": "int32"
|
||||||
|
},
|
||||||
|
"z": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"b",
|
||||||
|
"c",
|
||||||
|
"z"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"SimpleGibbit": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"a": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"z": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"a"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"Map-String-FlibbityGibbit": {
|
||||||
|
"additionalProperties": {
|
||||||
|
"anyOf": [
|
||||||
|
{
|
||||||
|
"$ref": "#/components/schemas/ComplexGibbit"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"$ref": "#/components/schemas/SimpleGibbit"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"type": "object"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"securitySchemes": {}
|
||||||
|
},
|
||||||
|
"security": [],
|
||||||
|
"tags": []
|
||||||
|
}
|
72
core/src/test/resources/T0030__simple_generic_response.json
Normal file
72
core/src/test/resources/T0030__simple_generic_response.json
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
{
|
||||||
|
"openapi": "3.1.0",
|
||||||
|
"jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
|
||||||
|
"info": {
|
||||||
|
"title": "Test API",
|
||||||
|
"version": "1.33.7",
|
||||||
|
"description": "An amazing, fully-ish 😉 generated API spec",
|
||||||
|
"termsOfService": "https://example.com",
|
||||||
|
"contact": {
|
||||||
|
"name": "Homer Simpson",
|
||||||
|
"url": "https://gph.is/1NPUDiM",
|
||||||
|
"email": "chunkylover53@aol.com"
|
||||||
|
},
|
||||||
|
"license": {
|
||||||
|
"name": "MIT",
|
||||||
|
"url": "https://github.com/bkbnio/kompendium/blob/main/LICENSE"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"servers": [
|
||||||
|
{
|
||||||
|
"url": "https://myawesomeapi.com",
|
||||||
|
"description": "Production instance of my API"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://staging.myawesomeapi.com",
|
||||||
|
"description": "Where the fun stuff happens"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"paths": {
|
||||||
|
"/": {
|
||||||
|
"get": {
|
||||||
|
"tags": [],
|
||||||
|
"summary": "Great Summary!",
|
||||||
|
"description": "testing more",
|
||||||
|
"parameters": [],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "A Successful Endeavor",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/Gibbity-String"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"deprecated": false
|
||||||
|
},
|
||||||
|
"parameters": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"webhooks": {},
|
||||||
|
"components": {
|
||||||
|
"schemas": {
|
||||||
|
"Gibbity-String": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"a": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"a"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"securitySchemes": {}
|
||||||
|
},
|
||||||
|
"security": [],
|
||||||
|
"tags": []
|
||||||
|
}
|
75
core/src/test/resources/T0031__nested_generic_response.json
Normal file
75
core/src/test/resources/T0031__nested_generic_response.json
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
{
|
||||||
|
"openapi": "3.1.0",
|
||||||
|
"jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
|
||||||
|
"info": {
|
||||||
|
"title": "Test API",
|
||||||
|
"version": "1.33.7",
|
||||||
|
"description": "An amazing, fully-ish 😉 generated API spec",
|
||||||
|
"termsOfService": "https://example.com",
|
||||||
|
"contact": {
|
||||||
|
"name": "Homer Simpson",
|
||||||
|
"url": "https://gph.is/1NPUDiM",
|
||||||
|
"email": "chunkylover53@aol.com"
|
||||||
|
},
|
||||||
|
"license": {
|
||||||
|
"name": "MIT",
|
||||||
|
"url": "https://github.com/bkbnio/kompendium/blob/main/LICENSE"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"servers": [
|
||||||
|
{
|
||||||
|
"url": "https://myawesomeapi.com",
|
||||||
|
"description": "Production instance of my API"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://staging.myawesomeapi.com",
|
||||||
|
"description": "Where the fun stuff happens"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"paths": {
|
||||||
|
"/": {
|
||||||
|
"get": {
|
||||||
|
"tags": [],
|
||||||
|
"summary": "Great Summary!",
|
||||||
|
"description": "testing more",
|
||||||
|
"parameters": [],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "A Successful Endeavor",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/Gibbity-Map"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"deprecated": false
|
||||||
|
},
|
||||||
|
"parameters": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"webhooks": {},
|
||||||
|
"components": {
|
||||||
|
"schemas": {
|
||||||
|
"Gibbity-Map": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"a": {
|
||||||
|
"additionalProperties": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"type": "object"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"a"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"securitySchemes": {}
|
||||||
|
},
|
||||||
|
"security": [],
|
||||||
|
"tags": []
|
||||||
|
}
|
@ -0,0 +1,99 @@
|
|||||||
|
{
|
||||||
|
"openapi": "3.1.0",
|
||||||
|
"jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
|
||||||
|
"info": {
|
||||||
|
"title": "Test API",
|
||||||
|
"version": "1.33.7",
|
||||||
|
"description": "An amazing, fully-ish 😉 generated API spec",
|
||||||
|
"termsOfService": "https://example.com",
|
||||||
|
"contact": {
|
||||||
|
"name": "Homer Simpson",
|
||||||
|
"url": "https://gph.is/1NPUDiM",
|
||||||
|
"email": "chunkylover53@aol.com"
|
||||||
|
},
|
||||||
|
"license": {
|
||||||
|
"name": "MIT",
|
||||||
|
"url": "https://github.com/bkbnio/kompendium/blob/main/LICENSE"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"servers": [
|
||||||
|
{
|
||||||
|
"url": "https://myawesomeapi.com",
|
||||||
|
"description": "Production instance of my API"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://staging.myawesomeapi.com",
|
||||||
|
"description": "Where the fun stuff happens"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"paths": {
|
||||||
|
"/": {
|
||||||
|
"get": {
|
||||||
|
"tags": [],
|
||||||
|
"summary": "Great Summary!",
|
||||||
|
"description": "testing more",
|
||||||
|
"parameters": [],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "A Successful Endeavor",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/Flibbity-Double"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"deprecated": false
|
||||||
|
},
|
||||||
|
"parameters": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"webhooks": {},
|
||||||
|
"components": {
|
||||||
|
"schemas": {
|
||||||
|
"Bibbity-Double": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"b": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"f": {
|
||||||
|
"type": "number",
|
||||||
|
"format": "double"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"b",
|
||||||
|
"f"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"Gibbity-Double": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"a": {
|
||||||
|
"type": "number",
|
||||||
|
"format": "double"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"a"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"Flibbity-Double": {
|
||||||
|
"anyOf": [
|
||||||
|
{
|
||||||
|
"$ref": "#/components/schemas/Bibbity-Double"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"$ref": "#/components/schemas/Gibbity-Double"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"securitySchemes": {}
|
||||||
|
},
|
||||||
|
"security": [],
|
||||||
|
"tags": []
|
||||||
|
}
|
145
core/src/test/resources/T0033__crazy_polymorphic_example.json
Normal file
145
core/src/test/resources/T0033__crazy_polymorphic_example.json
Normal file
@ -0,0 +1,145 @@
|
|||||||
|
{
|
||||||
|
"openapi": "3.1.0",
|
||||||
|
"jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
|
||||||
|
"info": {
|
||||||
|
"title": "Test API",
|
||||||
|
"version": "1.33.7",
|
||||||
|
"description": "An amazing, fully-ish 😉 generated API spec",
|
||||||
|
"termsOfService": "https://example.com",
|
||||||
|
"contact": {
|
||||||
|
"name": "Homer Simpson",
|
||||||
|
"url": "https://gph.is/1NPUDiM",
|
||||||
|
"email": "chunkylover53@aol.com"
|
||||||
|
},
|
||||||
|
"license": {
|
||||||
|
"name": "MIT",
|
||||||
|
"url": "https://github.com/bkbnio/kompendium/blob/main/LICENSE"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"servers": [
|
||||||
|
{
|
||||||
|
"url": "https://myawesomeapi.com",
|
||||||
|
"description": "Production instance of my API"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://staging.myawesomeapi.com",
|
||||||
|
"description": "Where the fun stuff happens"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"paths": {
|
||||||
|
"/": {
|
||||||
|
"get": {
|
||||||
|
"tags": [],
|
||||||
|
"summary": "Great Summary!",
|
||||||
|
"description": "testing more",
|
||||||
|
"parameters": [],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "A Successful Endeavor",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/Flibbity-FlibbityGibbit"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"deprecated": false
|
||||||
|
},
|
||||||
|
"parameters": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"webhooks": {},
|
||||||
|
"components": {
|
||||||
|
"schemas": {
|
||||||
|
"ComplexGibbit": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"b": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"c": {
|
||||||
|
"type": "number",
|
||||||
|
"format": "int32"
|
||||||
|
},
|
||||||
|
"z": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"b",
|
||||||
|
"c",
|
||||||
|
"z"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"SimpleGibbit": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"a": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"z": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"a"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"Bibbity-FlibbityGibbit": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"b": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"f": {
|
||||||
|
"anyOf": [
|
||||||
|
{
|
||||||
|
"$ref": "#/components/schemas/ComplexGibbit"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"$ref": "#/components/schemas/SimpleGibbit"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"b",
|
||||||
|
"f"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"Gibbity-FlibbityGibbit": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"a": {
|
||||||
|
"anyOf": [
|
||||||
|
{
|
||||||
|
"$ref": "#/components/schemas/ComplexGibbit"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"$ref": "#/components/schemas/SimpleGibbit"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"a"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"Flibbity-FlibbityGibbit": {
|
||||||
|
"anyOf": [
|
||||||
|
{
|
||||||
|
"$ref": "#/components/schemas/Bibbity-FlibbityGibbit"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"$ref": "#/components/schemas/Gibbity-FlibbityGibbit"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"securitySchemes": {}
|
||||||
|
},
|
||||||
|
"security": [],
|
||||||
|
"tags": []
|
||||||
|
}
|
@ -0,0 +1,73 @@
|
|||||||
|
{
|
||||||
|
"openapi": "3.1.0",
|
||||||
|
"jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
|
||||||
|
"info": {
|
||||||
|
"title": "Test API",
|
||||||
|
"version": "1.33.7",
|
||||||
|
"description": "An amazing, fully-ish 😉 generated API spec",
|
||||||
|
"termsOfService": "https://example.com",
|
||||||
|
"contact": {
|
||||||
|
"name": "Homer Simpson",
|
||||||
|
"url": "https://gph.is/1NPUDiM",
|
||||||
|
"email": "chunkylover53@aol.com"
|
||||||
|
},
|
||||||
|
"license": {
|
||||||
|
"name": "MIT",
|
||||||
|
"url": "https://github.com/bkbnio/kompendium/blob/main/LICENSE"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"servers": [
|
||||||
|
{
|
||||||
|
"url": "https://myawesomeapi.com",
|
||||||
|
"description": "Production instance of my API"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://staging.myawesomeapi.com",
|
||||||
|
"description": "Where the fun stuff happens"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"paths": {
|
||||||
|
"/": {
|
||||||
|
"get": {
|
||||||
|
"tags": [],
|
||||||
|
"summary": "Great Summary!",
|
||||||
|
"description": "testing more",
|
||||||
|
"operationId": "getThisDude",
|
||||||
|
"parameters": [],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "A Successful Endeavor",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/TestResponse"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"deprecated": false
|
||||||
|
},
|
||||||
|
"parameters": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"webhooks": {},
|
||||||
|
"components": {
|
||||||
|
"schemas": {
|
||||||
|
"TestResponse": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"c": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"c"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"securitySchemes": {}
|
||||||
|
},
|
||||||
|
"security": [],
|
||||||
|
"tags": []
|
||||||
|
}
|
82
core/src/test/resources/T0035__override_parameter_name.json
Normal file
82
core/src/test/resources/T0035__override_parameter_name.json
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
{
|
||||||
|
"openapi": "3.1.0",
|
||||||
|
"jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
|
||||||
|
"info": {
|
||||||
|
"title": "Test API",
|
||||||
|
"version": "1.33.7",
|
||||||
|
"description": "An amazing, fully-ish 😉 generated API spec",
|
||||||
|
"termsOfService": "https://example.com",
|
||||||
|
"contact": {
|
||||||
|
"name": "Homer Simpson",
|
||||||
|
"url": "https://gph.is/1NPUDiM",
|
||||||
|
"email": "chunkylover53@aol.com"
|
||||||
|
},
|
||||||
|
"license": {
|
||||||
|
"name": "MIT",
|
||||||
|
"url": "https://github.com/bkbnio/kompendium/blob/main/LICENSE"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"servers": [
|
||||||
|
{
|
||||||
|
"url": "https://myawesomeapi.com",
|
||||||
|
"description": "Production instance of my API"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://staging.myawesomeapi.com",
|
||||||
|
"description": "Where the fun stuff happens"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"paths": {
|
||||||
|
"/": {
|
||||||
|
"get": {
|
||||||
|
"tags": [],
|
||||||
|
"summary": "Great Summary!",
|
||||||
|
"description": "testing more",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "X-User-Email",
|
||||||
|
"in": "header",
|
||||||
|
"schema": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"required": true,
|
||||||
|
"deprecated": false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "A Successful Endeavor",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/TestResponse"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"deprecated": false
|
||||||
|
},
|
||||||
|
"parameters": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"webhooks": {},
|
||||||
|
"components": {
|
||||||
|
"schemas": {
|
||||||
|
"TestResponse": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"c": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"c"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"securitySchemes": {}
|
||||||
|
},
|
||||||
|
"security": [],
|
||||||
|
"tags": []
|
||||||
|
}
|
124
core/src/test/resources/T0036__nullable_fields.json
Normal file
124
core/src/test/resources/T0036__nullable_fields.json
Normal file
@ -0,0 +1,124 @@
|
|||||||
|
{
|
||||||
|
"openapi": "3.1.0",
|
||||||
|
"jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
|
||||||
|
"info": {
|
||||||
|
"title": "Test API",
|
||||||
|
"version": "1.33.7",
|
||||||
|
"description": "An amazing, fully-ish 😉 generated API spec",
|
||||||
|
"termsOfService": "https://example.com",
|
||||||
|
"contact": {
|
||||||
|
"name": "Homer Simpson",
|
||||||
|
"url": "https://gph.is/1NPUDiM",
|
||||||
|
"email": "chunkylover53@aol.com"
|
||||||
|
},
|
||||||
|
"license": {
|
||||||
|
"name": "MIT",
|
||||||
|
"url": "https://github.com/bkbnio/kompendium/blob/main/LICENSE"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"servers": [
|
||||||
|
{
|
||||||
|
"url": "https://myawesomeapi.com",
|
||||||
|
"description": "Production instance of my API"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://staging.myawesomeapi.com",
|
||||||
|
"description": "Where the fun stuff happens"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"paths": {
|
||||||
|
"/": {
|
||||||
|
"get": {
|
||||||
|
"tags": [],
|
||||||
|
"summary": "Great Summary!",
|
||||||
|
"description": "testing more",
|
||||||
|
"parameters": [],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "A Successful Endeavor",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/ProfileUpdateRequest"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"deprecated": false
|
||||||
|
},
|
||||||
|
"parameters": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"webhooks": {},
|
||||||
|
"components": {
|
||||||
|
"schemas": {
|
||||||
|
"ProfileUpdateRequest": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"metadata": {
|
||||||
|
"oneOf": [
|
||||||
|
{
|
||||||
|
"type": "null"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"$ref": "#/components/schemas/ProfileMetadataUpdateRequest"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"mood": {
|
||||||
|
"oneOf": [
|
||||||
|
{
|
||||||
|
"type": "null"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"viewCount": {
|
||||||
|
"oneOf": [
|
||||||
|
{
|
||||||
|
"type": "null"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "number",
|
||||||
|
"format": "int64"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": []
|
||||||
|
},
|
||||||
|
"ProfileMetadataUpdateRequest": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"isPrivate": {
|
||||||
|
"oneOf": [
|
||||||
|
{
|
||||||
|
"type": "null"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "boolean"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"otherThing": {
|
||||||
|
"oneOf": [
|
||||||
|
{
|
||||||
|
"type": "null"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"securitySchemes": {}
|
||||||
|
},
|
||||||
|
"security": [],
|
||||||
|
"tags": []
|
||||||
|
}
|
85
core/src/test/resources/T0037__nullable_enum_field.json
Normal file
85
core/src/test/resources/T0037__nullable_enum_field.json
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
{
|
||||||
|
"openapi": "3.1.0",
|
||||||
|
"jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
|
||||||
|
"info": {
|
||||||
|
"title": "Test API",
|
||||||
|
"version": "1.33.7",
|
||||||
|
"description": "An amazing, fully-ish 😉 generated API spec",
|
||||||
|
"termsOfService": "https://example.com",
|
||||||
|
"contact": {
|
||||||
|
"name": "Homer Simpson",
|
||||||
|
"url": "https://gph.is/1NPUDiM",
|
||||||
|
"email": "chunkylover53@aol.com"
|
||||||
|
},
|
||||||
|
"license": {
|
||||||
|
"name": "MIT",
|
||||||
|
"url": "https://github.com/bkbnio/kompendium/blob/main/LICENSE"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"servers": [
|
||||||
|
{
|
||||||
|
"url": "https://myawesomeapi.com",
|
||||||
|
"description": "Production instance of my API"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://staging.myawesomeapi.com",
|
||||||
|
"description": "Where the fun stuff happens"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"paths": {
|
||||||
|
"/": {
|
||||||
|
"get": {
|
||||||
|
"tags": [],
|
||||||
|
"summary": "Great Summary!",
|
||||||
|
"description": "testing more",
|
||||||
|
"parameters": [],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "A Successful Endeavor",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/NullableEnum"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"deprecated": false
|
||||||
|
},
|
||||||
|
"parameters": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"webhooks": {},
|
||||||
|
"components": {
|
||||||
|
"schemas": {
|
||||||
|
"NullableEnum": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"a": {
|
||||||
|
"oneOf": [
|
||||||
|
{
|
||||||
|
"type": "null"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"$ref": "#/components/schemas/TestEnum"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": []
|
||||||
|
},
|
||||||
|
"TestEnum":
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"enum": [
|
||||||
|
"YES",
|
||||||
|
"NO"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"securitySchemes": {}
|
||||||
|
},
|
||||||
|
"security": [],
|
||||||
|
"tags": []
|
||||||
|
}
|
@ -0,0 +1,77 @@
|
|||||||
|
{
|
||||||
|
"openapi": "3.1.0",
|
||||||
|
"jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
|
||||||
|
"info": {
|
||||||
|
"title": "Test API",
|
||||||
|
"version": "1.33.7",
|
||||||
|
"description": "An amazing, fully-ish 😉 generated API spec",
|
||||||
|
"termsOfService": "https://example.com",
|
||||||
|
"contact": {
|
||||||
|
"name": "Homer Simpson",
|
||||||
|
"url": "https://gph.is/1NPUDiM",
|
||||||
|
"email": "chunkylover53@aol.com"
|
||||||
|
},
|
||||||
|
"license": {
|
||||||
|
"name": "MIT",
|
||||||
|
"url": "https://github.com/bkbnio/kompendium/blob/main/LICENSE"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"servers": [
|
||||||
|
{
|
||||||
|
"url": "https://myawesomeapi.com",
|
||||||
|
"description": "Production instance of my API"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://staging.myawesomeapi.com",
|
||||||
|
"description": "Where the fun stuff happens"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"paths": {
|
||||||
|
"/": {
|
||||||
|
"get": {
|
||||||
|
"tags": [],
|
||||||
|
"summary": "Great Summary!",
|
||||||
|
"description": "testing more",
|
||||||
|
"parameters": [],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "A Successful Endeavor",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/DateTimeString"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"deprecated": false
|
||||||
|
},
|
||||||
|
"parameters": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"webhooks": {},
|
||||||
|
"components": {
|
||||||
|
"schemas": {
|
||||||
|
"Instant": {
|
||||||
|
"type": "string",
|
||||||
|
"format": "date"
|
||||||
|
},
|
||||||
|
"DateTimeString": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"a": {
|
||||||
|
"type": "string",
|
||||||
|
"format": "date"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"a"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"securitySchemes": {}
|
||||||
|
},
|
||||||
|
"security": [],
|
||||||
|
"tags": []
|
||||||
|
}
|
101
core/src/test/resources/T0039__nested_generic_collection.json
Normal file
101
core/src/test/resources/T0039__nested_generic_collection.json
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
{
|
||||||
|
"openapi": "3.1.0",
|
||||||
|
"jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
|
||||||
|
"info": {
|
||||||
|
"title": "Test API",
|
||||||
|
"version": "1.33.7",
|
||||||
|
"description": "An amazing, fully-ish 😉 generated API spec",
|
||||||
|
"termsOfService": "https://example.com",
|
||||||
|
"contact": {
|
||||||
|
"name": "Homer Simpson",
|
||||||
|
"url": "https://gph.is/1NPUDiM",
|
||||||
|
"email": "chunkylover53@aol.com"
|
||||||
|
},
|
||||||
|
"license": {
|
||||||
|
"name": "MIT",
|
||||||
|
"url": "https://github.com/bkbnio/kompendium/blob/main/LICENSE"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"servers": [
|
||||||
|
{
|
||||||
|
"url": "https://myawesomeapi.com",
|
||||||
|
"description": "Production instance of my API"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://staging.myawesomeapi.com",
|
||||||
|
"description": "Where the fun stuff happens"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"paths": {
|
||||||
|
"/": {
|
||||||
|
"get": {
|
||||||
|
"tags": [],
|
||||||
|
"summary": "Great Summary!",
|
||||||
|
"description": "testing more",
|
||||||
|
"parameters": [],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "A Successful Endeavor",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/Page-Int"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"deprecated": false
|
||||||
|
},
|
||||||
|
"parameters": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"webhooks": {},
|
||||||
|
"components": {
|
||||||
|
"schemas": {
|
||||||
|
"Page-Int": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"content": {
|
||||||
|
"items": {
|
||||||
|
"type": "number",
|
||||||
|
"format": "int32"
|
||||||
|
},
|
||||||
|
"type": "array"
|
||||||
|
},
|
||||||
|
"number": {
|
||||||
|
"type": "number",
|
||||||
|
"format": "int32"
|
||||||
|
},
|
||||||
|
"numberOfElements": {
|
||||||
|
"type": "number",
|
||||||
|
"format": "int32"
|
||||||
|
},
|
||||||
|
"size": {
|
||||||
|
"type": "number",
|
||||||
|
"format": "int32"
|
||||||
|
},
|
||||||
|
"totalElements": {
|
||||||
|
"type": "number",
|
||||||
|
"format": "int64"
|
||||||
|
},
|
||||||
|
"totalPages": {
|
||||||
|
"type": "number",
|
||||||
|
"format": "int32"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"content",
|
||||||
|
"number",
|
||||||
|
"numberOfElements",
|
||||||
|
"size",
|
||||||
|
"totalElements",
|
||||||
|
"totalPages"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"securitySchemes": {}
|
||||||
|
},
|
||||||
|
"security": [],
|
||||||
|
"tags": []
|
||||||
|
}
|
@ -0,0 +1,133 @@
|
|||||||
|
{
|
||||||
|
"openapi": "3.1.0",
|
||||||
|
"jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
|
||||||
|
"info": {
|
||||||
|
"title": "Test API",
|
||||||
|
"version": "1.33.7",
|
||||||
|
"description": "An amazing, fully-ish 😉 generated API spec",
|
||||||
|
"termsOfService": "https://example.com",
|
||||||
|
"contact": {
|
||||||
|
"name": "Homer Simpson",
|
||||||
|
"url": "https://gph.is/1NPUDiM",
|
||||||
|
"email": "chunkylover53@aol.com"
|
||||||
|
},
|
||||||
|
"license": {
|
||||||
|
"name": "MIT",
|
||||||
|
"url": "https://github.com/bkbnio/kompendium/blob/main/LICENSE"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"servers": [
|
||||||
|
{
|
||||||
|
"url": "https://myawesomeapi.com",
|
||||||
|
"description": "Production instance of my API"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://staging.myawesomeapi.com",
|
||||||
|
"description": "Where the fun stuff happens"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"paths": {
|
||||||
|
"/": {
|
||||||
|
"get": {
|
||||||
|
"tags": [],
|
||||||
|
"summary": "Great Summary!",
|
||||||
|
"description": "testing more",
|
||||||
|
"parameters": [],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "A Successful Endeavor",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/MultiNestedGenerics-String-ComplexRequest"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"deprecated": false
|
||||||
|
},
|
||||||
|
"parameters": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"webhooks": {},
|
||||||
|
"components": {
|
||||||
|
"schemas": {
|
||||||
|
"CrazyItem": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"enumeration": {
|
||||||
|
"$ref": "#/components/schemas/SimpleEnum"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"enumeration"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"NestedComplexItem": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"alias": {
|
||||||
|
"additionalProperties": {
|
||||||
|
"$ref": "#/components/schemas/CrazyItem"
|
||||||
|
},
|
||||||
|
"type": "object"
|
||||||
|
},
|
||||||
|
"name": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"alias",
|
||||||
|
"name"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"ComplexRequest": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"amazingField": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"org": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"tables": {
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/components/schemas/NestedComplexItem"
|
||||||
|
},
|
||||||
|
"type": "array"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"amazingField",
|
||||||
|
"org",
|
||||||
|
"tables"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"MultiNestedGenerics-String-ComplexRequest": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"content": {
|
||||||
|
"additionalProperties": {
|
||||||
|
"$ref": "#/components/schemas/ComplexRequest"
|
||||||
|
},
|
||||||
|
"type": "object"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"content"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"SimpleEnum": {
|
||||||
|
"type": "string",
|
||||||
|
"enum": [
|
||||||
|
"ONE",
|
||||||
|
"TWO"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"securitySchemes": {}
|
||||||
|
},
|
||||||
|
"security": [],
|
||||||
|
"tags": []
|
||||||
|
}
|
98
core/src/test/resources/T0041__nullable_reference.json
Normal file
98
core/src/test/resources/T0041__nullable_reference.json
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
{
|
||||||
|
"openapi": "3.1.0",
|
||||||
|
"jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
|
||||||
|
"info": {
|
||||||
|
"title": "Test API",
|
||||||
|
"version": "1.33.7",
|
||||||
|
"description": "An amazing, fully-ish 😉 generated API spec",
|
||||||
|
"termsOfService": "https://example.com",
|
||||||
|
"contact": {
|
||||||
|
"name": "Homer Simpson",
|
||||||
|
"url": "https://gph.is/1NPUDiM",
|
||||||
|
"email": "chunkylover53@aol.com"
|
||||||
|
},
|
||||||
|
"license": {
|
||||||
|
"name": "MIT",
|
||||||
|
"url": "https://github.com/bkbnio/kompendium/blob/main/LICENSE"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"servers": [
|
||||||
|
{
|
||||||
|
"url": "https://myawesomeapi.com",
|
||||||
|
"description": "Production instance of my API"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://staging.myawesomeapi.com",
|
||||||
|
"description": "Where the fun stuff happens"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"paths": {
|
||||||
|
"/": {
|
||||||
|
"get": {
|
||||||
|
"tags": [],
|
||||||
|
"summary": "Great Summary!",
|
||||||
|
"description": "testing more",
|
||||||
|
"parameters": [],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "A Successful Endeavor",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/ManyThings"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"deprecated": false
|
||||||
|
},
|
||||||
|
"parameters": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"webhooks": {},
|
||||||
|
"components": {
|
||||||
|
"schemas": {
|
||||||
|
"Something": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"a": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"b": {
|
||||||
|
"type": "number",
|
||||||
|
"format": "int32"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"a",
|
||||||
|
"b"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"ManyThings": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"someA": {
|
||||||
|
"$ref": "#/components/schemas/Something"
|
||||||
|
},
|
||||||
|
"someB": {
|
||||||
|
"oneOf": [
|
||||||
|
{
|
||||||
|
"type": "null"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"$ref": "#/components/schemas/Something"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"someA"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"securitySchemes": {}
|
||||||
|
},
|
||||||
|
"security": [],
|
||||||
|
"tags": []
|
||||||
|
}
|
98
core/src/test/resources/T0042__simple_recursive.json
Normal file
98
core/src/test/resources/T0042__simple_recursive.json
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
{
|
||||||
|
"openapi": "3.1.0",
|
||||||
|
"jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
|
||||||
|
"info": {
|
||||||
|
"title": "Test API",
|
||||||
|
"version": "1.33.7",
|
||||||
|
"description": "An amazing, fully-ish 😉 generated API spec",
|
||||||
|
"termsOfService": "https://example.com",
|
||||||
|
"contact": {
|
||||||
|
"name": "Homer Simpson",
|
||||||
|
"url": "https://gph.is/1NPUDiM",
|
||||||
|
"email": "chunkylover53@aol.com"
|
||||||
|
},
|
||||||
|
"license": {
|
||||||
|
"name": "MIT",
|
||||||
|
"url": "https://github.com/bkbnio/kompendium/blob/main/LICENSE"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"servers": [
|
||||||
|
{
|
||||||
|
"url": "https://myawesomeapi.com",
|
||||||
|
"description": "Production instance of my API"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://staging.myawesomeapi.com",
|
||||||
|
"description": "Where the fun stuff happens"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"paths": {
|
||||||
|
"/": {
|
||||||
|
"get": {
|
||||||
|
"tags": [],
|
||||||
|
"summary": "Great Summary!",
|
||||||
|
"description": "testing more",
|
||||||
|
"parameters": [],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "A Successful Endeavor",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/ColumnSchema"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"deprecated": false
|
||||||
|
},
|
||||||
|
"parameters": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"webhooks": {},
|
||||||
|
"components": {
|
||||||
|
"schemas": {
|
||||||
|
"ColumnMode": {
|
||||||
|
"type": "string",
|
||||||
|
"enum": [
|
||||||
|
"NULLABLE",
|
||||||
|
"REQUIRED",
|
||||||
|
"REPEATED"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"ColumnSchema": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"description": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"mode": {
|
||||||
|
"$ref": "#/components/schemas/ColumnMode"
|
||||||
|
},
|
||||||
|
"name": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"subColumns": {
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/components/schemas/ColumnSchema"
|
||||||
|
},
|
||||||
|
"type": "array"
|
||||||
|
},
|
||||||
|
"type": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"description",
|
||||||
|
"mode",
|
||||||
|
"name",
|
||||||
|
"type"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"securitySchemes": {}
|
||||||
|
},
|
||||||
|
"security": [],
|
||||||
|
"tags": []
|
||||||
|
}
|
91
core/src/test/resources/T0043__gnarly_generic_example.json
Normal file
91
core/src/test/resources/T0043__gnarly_generic_example.json
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
{
|
||||||
|
"openapi": "3.1.0",
|
||||||
|
"jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
|
||||||
|
"info": {
|
||||||
|
"title": "Test API",
|
||||||
|
"version": "1.33.7",
|
||||||
|
"description": "An amazing, fully-ish 😉 generated API spec",
|
||||||
|
"termsOfService": "https://example.com",
|
||||||
|
"contact": {
|
||||||
|
"name": "Homer Simpson",
|
||||||
|
"url": "https://gph.is/1NPUDiM",
|
||||||
|
"email": "chunkylover53@aol.com"
|
||||||
|
},
|
||||||
|
"license": {
|
||||||
|
"name": "MIT",
|
||||||
|
"url": "https://github.com/bkbnio/kompendium/blob/main/LICENSE"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"servers": [
|
||||||
|
{
|
||||||
|
"url": "https://myawesomeapi.com",
|
||||||
|
"description": "Production instance of my API"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://staging.myawesomeapi.com",
|
||||||
|
"description": "Where the fun stuff happens"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"paths": {
|
||||||
|
"/": {
|
||||||
|
"get": {
|
||||||
|
"tags": [],
|
||||||
|
"summary": "Great Summary!",
|
||||||
|
"description": "testing more",
|
||||||
|
"parameters": [],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "A Successful Endeavor",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/Foosy-Barzo-String"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"deprecated": false
|
||||||
|
},
|
||||||
|
"parameters": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"webhooks": {},
|
||||||
|
"components": {
|
||||||
|
"schemas": {
|
||||||
|
"Foosy-Barzo-String": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"otherThing": {
|
||||||
|
"items": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"type": "array"
|
||||||
|
},
|
||||||
|
"test": {
|
||||||
|
"$ref": "#/components/schemas/Barzo-Int"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"otherThing",
|
||||||
|
"test"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"Barzo-Int": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"result": {
|
||||||
|
"type": "number",
|
||||||
|
"format": "int32"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"result"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"securitySchemes": {}
|
||||||
|
},
|
||||||
|
"security": [],
|
||||||
|
"tags": []
|
||||||
|
}
|
72
core/src/test/resources/T0044__nested_type_name.json
Normal file
72
core/src/test/resources/T0044__nested_type_name.json
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
{
|
||||||
|
"openapi": "3.1.0",
|
||||||
|
"jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
|
||||||
|
"info": {
|
||||||
|
"title": "Test API",
|
||||||
|
"version": "1.33.7",
|
||||||
|
"description": "An amazing, fully-ish 😉 generated API spec",
|
||||||
|
"termsOfService": "https://example.com",
|
||||||
|
"contact": {
|
||||||
|
"name": "Homer Simpson",
|
||||||
|
"url": "https://gph.is/1NPUDiM",
|
||||||
|
"email": "chunkylover53@aol.com"
|
||||||
|
},
|
||||||
|
"license": {
|
||||||
|
"name": "MIT",
|
||||||
|
"url": "https://github.com/bkbnio/kompendium/blob/main/LICENSE"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"servers": [
|
||||||
|
{
|
||||||
|
"url": "https://myawesomeapi.com",
|
||||||
|
"description": "Production instance of my API"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://staging.myawesomeapi.com",
|
||||||
|
"description": "Where the fun stuff happens"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"paths": {
|
||||||
|
"/": {
|
||||||
|
"get": {
|
||||||
|
"tags": [],
|
||||||
|
"summary": "Great Summary!",
|
||||||
|
"description": "testing more",
|
||||||
|
"parameters": [],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "A Successful Endeavor",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/NestedResponse"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"deprecated": false
|
||||||
|
},
|
||||||
|
"parameters": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"webhooks": {},
|
||||||
|
"components": {
|
||||||
|
"schemas": {
|
||||||
|
"NestedResponse": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"idk": {
|
||||||
|
"type": "boolean"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"idk"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"securitySchemes": {}
|
||||||
|
},
|
||||||
|
"security": [],
|
||||||
|
"tags": []
|
||||||
|
}
|
82
core/src/test/resources/T0045__default_auth_config.json
Normal file
82
core/src/test/resources/T0045__default_auth_config.json
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
{
|
||||||
|
"openapi": "3.1.0",
|
||||||
|
"jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
|
||||||
|
"info": {
|
||||||
|
"title": "Test API",
|
||||||
|
"version": "1.33.7",
|
||||||
|
"description": "An amazing, fully-ish 😉 generated API spec",
|
||||||
|
"termsOfService": "https://example.com",
|
||||||
|
"contact": {
|
||||||
|
"name": "Homer Simpson",
|
||||||
|
"url": "https://gph.is/1NPUDiM",
|
||||||
|
"email": "chunkylover53@aol.com"
|
||||||
|
},
|
||||||
|
"license": {
|
||||||
|
"name": "MIT",
|
||||||
|
"url": "https://github.com/bkbnio/kompendium/blob/main/LICENSE"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"servers": [
|
||||||
|
{
|
||||||
|
"url": "https://myawesomeapi.com",
|
||||||
|
"description": "Production instance of my API"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://staging.myawesomeapi.com",
|
||||||
|
"description": "Where the fun stuff happens"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"paths": {
|
||||||
|
"/": {
|
||||||
|
"get": {
|
||||||
|
"tags": [],
|
||||||
|
"summary": "Great Summary!",
|
||||||
|
"description": "testing more",
|
||||||
|
"parameters": [],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "A Successful Endeavor",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/TestResponse"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"deprecated": false,
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"basic": []
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"parameters": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"webhooks": {},
|
||||||
|
"components": {
|
||||||
|
"schemas": {
|
||||||
|
"TestResponse": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"c": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"c"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"securitySchemes": {
|
||||||
|
"basic": {
|
||||||
|
"type": "http",
|
||||||
|
"scheme": "basic"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"security": [],
|
||||||
|
"tags": []
|
||||||
|
}
|
92
core/src/test/resources/T0046__custom_auth_config.json
Normal file
92
core/src/test/resources/T0046__custom_auth_config.json
Normal file
@ -0,0 +1,92 @@
|
|||||||
|
{
|
||||||
|
"openapi": "3.1.0",
|
||||||
|
"jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
|
||||||
|
"info": {
|
||||||
|
"title": "Test API",
|
||||||
|
"version": "1.33.7",
|
||||||
|
"description": "An amazing, fully-ish 😉 generated API spec",
|
||||||
|
"termsOfService": "https://example.com",
|
||||||
|
"contact": {
|
||||||
|
"name": "Homer Simpson",
|
||||||
|
"url": "https://gph.is/1NPUDiM",
|
||||||
|
"email": "chunkylover53@aol.com"
|
||||||
|
},
|
||||||
|
"license": {
|
||||||
|
"name": "MIT",
|
||||||
|
"url": "https://github.com/bkbnio/kompendium/blob/main/LICENSE"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"servers": [
|
||||||
|
{
|
||||||
|
"url": "https://myawesomeapi.com",
|
||||||
|
"description": "Production instance of my API"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://staging.myawesomeapi.com",
|
||||||
|
"description": "Where the fun stuff happens"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"paths": {
|
||||||
|
"/": {
|
||||||
|
"get": {
|
||||||
|
"tags": [],
|
||||||
|
"summary": "Great Summary!",
|
||||||
|
"description": "testing more",
|
||||||
|
"parameters": [],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "A Successful Endeavor",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/TestResponse"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"deprecated": false,
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"auth-oauth-google": [
|
||||||
|
"read:pets"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"parameters": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"webhooks": {},
|
||||||
|
"components": {
|
||||||
|
"schemas": {
|
||||||
|
"TestResponse": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"c": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"c"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"securitySchemes": {
|
||||||
|
"auth-oauth-google": {
|
||||||
|
"flows": {
|
||||||
|
"implicit": {
|
||||||
|
"authorizationUrl": "https://accounts.google.com/o/oauth2/auth",
|
||||||
|
"scopes": {
|
||||||
|
"write:pets": "modify pets in your account",
|
||||||
|
"read:pets": "read your pets"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"type": "oauth2"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"security": [],
|
||||||
|
"tags": []
|
||||||
|
}
|
91
core/src/test/resources/T0047__multiple_auth_strategies.json
Normal file
91
core/src/test/resources/T0047__multiple_auth_strategies.json
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
{
|
||||||
|
"openapi": "3.1.0",
|
||||||
|
"jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
|
||||||
|
"info": {
|
||||||
|
"title": "Test API",
|
||||||
|
"version": "1.33.7",
|
||||||
|
"description": "An amazing, fully-ish 😉 generated API spec",
|
||||||
|
"termsOfService": "https://example.com",
|
||||||
|
"contact": {
|
||||||
|
"name": "Homer Simpson",
|
||||||
|
"url": "https://gph.is/1NPUDiM",
|
||||||
|
"email": "chunkylover53@aol.com"
|
||||||
|
},
|
||||||
|
"license": {
|
||||||
|
"name": "MIT",
|
||||||
|
"url": "https://github.com/bkbnio/kompendium/blob/main/LICENSE"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"servers": [
|
||||||
|
{
|
||||||
|
"url": "https://myawesomeapi.com",
|
||||||
|
"description": "Production instance of my API"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://staging.myawesomeapi.com",
|
||||||
|
"description": "Where the fun stuff happens"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"paths": {
|
||||||
|
"/": {
|
||||||
|
"get": {
|
||||||
|
"tags": [],
|
||||||
|
"summary": "Great Summary!",
|
||||||
|
"description": "testing more",
|
||||||
|
"parameters": [],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "A Successful Endeavor",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/TestResponse"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"deprecated": false,
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"jwt": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"api-key": []
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"parameters": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"webhooks": {},
|
||||||
|
"components": {
|
||||||
|
"schemas": {
|
||||||
|
"TestResponse": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"c": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"c"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"securitySchemes": {
|
||||||
|
"jwt": {
|
||||||
|
"bearerFormat": "JWT",
|
||||||
|
"type": "http",
|
||||||
|
"scheme": "bearer"
|
||||||
|
},
|
||||||
|
"api-key": {
|
||||||
|
"in": "header",
|
||||||
|
"name": "X-API-KEY",
|
||||||
|
"type": "apiKey"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"security": [],
|
||||||
|
"tags": []
|
||||||
|
}
|
72
core/src/test/resources/T0048__ignored_property.json
Normal file
72
core/src/test/resources/T0048__ignored_property.json
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
{
|
||||||
|
"openapi": "3.1.0",
|
||||||
|
"jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
|
||||||
|
"info": {
|
||||||
|
"title": "Test API",
|
||||||
|
"version": "1.33.7",
|
||||||
|
"description": "An amazing, fully-ish 😉 generated API spec",
|
||||||
|
"termsOfService": "https://example.com",
|
||||||
|
"contact": {
|
||||||
|
"name": "Homer Simpson",
|
||||||
|
"url": "https://gph.is/1NPUDiM",
|
||||||
|
"email": "chunkylover53@aol.com"
|
||||||
|
},
|
||||||
|
"license": {
|
||||||
|
"name": "MIT",
|
||||||
|
"url": "https://github.com/bkbnio/kompendium/blob/main/LICENSE"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"servers": [
|
||||||
|
{
|
||||||
|
"url": "https://myawesomeapi.com",
|
||||||
|
"description": "Production instance of my API"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://staging.myawesomeapi.com",
|
||||||
|
"description": "Where the fun stuff happens"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"paths": {
|
||||||
|
"/": {
|
||||||
|
"get": {
|
||||||
|
"tags": [],
|
||||||
|
"summary": "Great Summary!",
|
||||||
|
"description": "testing more",
|
||||||
|
"parameters": [],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "A Successful Endeavor",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/TransientObject"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"deprecated": false
|
||||||
|
},
|
||||||
|
"parameters": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"webhooks": {},
|
||||||
|
"components": {
|
||||||
|
"schemas": {
|
||||||
|
"TransientObject": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"nonTransient": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"nonTransient"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"securitySchemes": {}
|
||||||
|
},
|
||||||
|
"security": [],
|
||||||
|
"tags": []
|
||||||
|
}
|
72
core/src/test/resources/T0049__unbacked_property.json
Normal file
72
core/src/test/resources/T0049__unbacked_property.json
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
{
|
||||||
|
"openapi": "3.1.0",
|
||||||
|
"jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
|
||||||
|
"info": {
|
||||||
|
"title": "Test API",
|
||||||
|
"version": "1.33.7",
|
||||||
|
"description": "An amazing, fully-ish 😉 generated API spec",
|
||||||
|
"termsOfService": "https://example.com",
|
||||||
|
"contact": {
|
||||||
|
"name": "Homer Simpson",
|
||||||
|
"url": "https://gph.is/1NPUDiM",
|
||||||
|
"email": "chunkylover53@aol.com"
|
||||||
|
},
|
||||||
|
"license": {
|
||||||
|
"name": "MIT",
|
||||||
|
"url": "https://github.com/bkbnio/kompendium/blob/main/LICENSE"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"servers": [
|
||||||
|
{
|
||||||
|
"url": "https://myawesomeapi.com",
|
||||||
|
"description": "Production instance of my API"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://staging.myawesomeapi.com",
|
||||||
|
"description": "Where the fun stuff happens"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"paths": {
|
||||||
|
"/": {
|
||||||
|
"get": {
|
||||||
|
"tags": [],
|
||||||
|
"summary": "Great Summary!",
|
||||||
|
"description": "testing more",
|
||||||
|
"parameters": [],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "A Successful Endeavor",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/UnbackedObject"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"deprecated": false
|
||||||
|
},
|
||||||
|
"parameters": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"webhooks": {},
|
||||||
|
"components": {
|
||||||
|
"schemas": {
|
||||||
|
"UnbackedObject": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"backed": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"backed"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"securitySchemes": {}
|
||||||
|
},
|
||||||
|
"security": [],
|
||||||
|
"tags": []
|
||||||
|
}
|
72
core/src/test/resources/T0050__custom_named_property.json
Normal file
72
core/src/test/resources/T0050__custom_named_property.json
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
{
|
||||||
|
"openapi": "3.1.0",
|
||||||
|
"jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
|
||||||
|
"info": {
|
||||||
|
"title": "Test API",
|
||||||
|
"version": "1.33.7",
|
||||||
|
"description": "An amazing, fully-ish 😉 generated API spec",
|
||||||
|
"termsOfService": "https://example.com",
|
||||||
|
"contact": {
|
||||||
|
"name": "Homer Simpson",
|
||||||
|
"url": "https://gph.is/1NPUDiM",
|
||||||
|
"email": "chunkylover53@aol.com"
|
||||||
|
},
|
||||||
|
"license": {
|
||||||
|
"name": "MIT",
|
||||||
|
"url": "https://github.com/bkbnio/kompendium/blob/main/LICENSE"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"servers": [
|
||||||
|
{
|
||||||
|
"url": "https://myawesomeapi.com",
|
||||||
|
"description": "Production instance of my API"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://staging.myawesomeapi.com",
|
||||||
|
"description": "Where the fun stuff happens"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"paths": {
|
||||||
|
"/": {
|
||||||
|
"get": {
|
||||||
|
"tags": [],
|
||||||
|
"summary": "Great Summary!",
|
||||||
|
"description": "testing more",
|
||||||
|
"parameters": [],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "A Successful Endeavor",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/SerialNameObject"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"deprecated": false
|
||||||
|
},
|
||||||
|
"parameters": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"webhooks": {},
|
||||||
|
"components": {
|
||||||
|
"schemas": {
|
||||||
|
"SerialNameObject": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"snake_case_name": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"snake_case_name"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"securitySchemes": {}
|
||||||
|
},
|
||||||
|
"security": [],
|
||||||
|
"tags": []
|
||||||
|
}
|
79
core/src/test/resources/T0051__top_level_nullable.json
Normal file
79
core/src/test/resources/T0051__top_level_nullable.json
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
{
|
||||||
|
"openapi": "3.1.0",
|
||||||
|
"jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
|
||||||
|
"info": {
|
||||||
|
"title": "Test API",
|
||||||
|
"version": "1.33.7",
|
||||||
|
"description": "An amazing, fully-ish 😉 generated API spec",
|
||||||
|
"termsOfService": "https://example.com",
|
||||||
|
"contact": {
|
||||||
|
"name": "Homer Simpson",
|
||||||
|
"url": "https://gph.is/1NPUDiM",
|
||||||
|
"email": "chunkylover53@aol.com"
|
||||||
|
},
|
||||||
|
"license": {
|
||||||
|
"name": "MIT",
|
||||||
|
"url": "https://github.com/bkbnio/kompendium/blob/main/LICENSE"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"servers": [
|
||||||
|
{
|
||||||
|
"url": "https://myawesomeapi.com",
|
||||||
|
"description": "Production instance of my API"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://staging.myawesomeapi.com",
|
||||||
|
"description": "Where the fun stuff happens"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"paths": {
|
||||||
|
"/": {
|
||||||
|
"get": {
|
||||||
|
"tags": [],
|
||||||
|
"summary": "Great Summary!",
|
||||||
|
"description": "testing more",
|
||||||
|
"parameters": [],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "A Successful Endeavor",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"oneOf": [
|
||||||
|
{
|
||||||
|
"type": "null"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"$ref": "#/components/schemas/TestResponse"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"deprecated": false
|
||||||
|
},
|
||||||
|
"parameters": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"webhooks": {},
|
||||||
|
"components": {
|
||||||
|
"schemas": {
|
||||||
|
"TestResponse": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"c": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"c"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"securitySchemes": {}
|
||||||
|
},
|
||||||
|
"security": [],
|
||||||
|
"tags": []
|
||||||
|
}
|
@ -1,7 +1,7 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>Test API</title>
|
<title>Docs</title>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
<link href="https://fonts.googleapis.com/css?family=Montserrat:300,400,700|Roboto:300,400,700" rel="stylesheet">
|
<link href="https://fonts.googleapis.com/css?family=Montserrat:300,400,700|Roboto:300,400,700" rel="stylesheet">
|
@ -0,0 +1,54 @@
|
|||||||
|
package io.bkbn.kompendium.core.fixtures
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnore
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty
|
||||||
|
import com.google.gson.annotations.Expose
|
||||||
|
import com.google.gson.annotations.SerializedName
|
||||||
|
import io.bkbn.kompendium.json.schema.SchemaConfigurator
|
||||||
|
import kotlin.reflect.KClass
|
||||||
|
import kotlin.reflect.KProperty1
|
||||||
|
import kotlin.reflect.full.memberProperties
|
||||||
|
import kotlin.reflect.jvm.javaField
|
||||||
|
|
||||||
|
/*
|
||||||
|
These are test implementation and may well be a good starting point for creating production ones.
|
||||||
|
Both Gson and Jackson are complex and can achieve this things is more than one way therefore
|
||||||
|
these will not always work hence why they are in the test package
|
||||||
|
*/
|
||||||
|
|
||||||
|
class GsonSchemaConfigurator: SchemaConfigurator {
|
||||||
|
|
||||||
|
override fun serializableMemberProperties(clazz: KClass<*>): Collection<KProperty1<out Any, *>> {
|
||||||
|
// NOTE: This is test logic Expose is set at a global Gson level so configure to match your Gson set up
|
||||||
|
val hasAnyExpose = clazz.memberProperties.any { it.hasJavaAnnotation<Expose>() }
|
||||||
|
return if(hasAnyExpose) {
|
||||||
|
clazz.memberProperties
|
||||||
|
.filter { it.hasJavaAnnotation<Expose>() }
|
||||||
|
} else clazz.memberProperties
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun serializableName(property: KProperty1<out Any, *>): String =
|
||||||
|
property.getJavaAnnotation<SerializedName>()?.value?: property.name
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
class JacksonSchemaConfigurator: SchemaConfigurator {
|
||||||
|
|
||||||
|
override fun serializableMemberProperties(clazz: KClass<*>): Collection<KProperty1<out Any, *>> =
|
||||||
|
clazz.memberProperties
|
||||||
|
.filterNot {
|
||||||
|
it.hasJavaAnnotation<JsonIgnore>()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun serializableName(property: KProperty1<out Any, *>): String =
|
||||||
|
property.getJavaAnnotation<JsonProperty>()?.value?: property.name
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
inline fun <reified T: Annotation> KProperty1<*, *>.hasJavaAnnotation(): Boolean {
|
||||||
|
return javaField?.isAnnotationPresent(T::class.java)?: false
|
||||||
|
}
|
||||||
|
|
||||||
|
inline fun <reified T: Annotation> KProperty1<*, *>.getJavaAnnotation(): T? {
|
||||||
|
return javaField?.getDeclaredAnnotation(T::class.java)
|
||||||
|
}
|
@ -0,0 +1,7 @@
|
|||||||
|
package io.bkbn.kompendium.core.fixtures
|
||||||
|
|
||||||
|
enum class SupportedSerializer {
|
||||||
|
KOTLINX,
|
||||||
|
GSON,
|
||||||
|
JACKSON
|
||||||
|
}
|
@ -0,0 +1,110 @@
|
|||||||
|
package io.bkbn.kompendium.core.fixtures
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude
|
||||||
|
import com.fasterxml.jackson.databind.SerializationFeature
|
||||||
|
import io.bkbn.kompendium.core.fixtures.TestSpecs.defaultSpec
|
||||||
|
import io.bkbn.kompendium.core.plugin.NotarizedApplication
|
||||||
|
import io.bkbn.kompendium.core.routes.redoc
|
||||||
|
import io.bkbn.kompendium.json.schema.KotlinXSchemaConfigurator
|
||||||
|
import io.bkbn.kompendium.json.schema.definition.JsonSchema
|
||||||
|
import io.bkbn.kompendium.oas.OpenApiSpec
|
||||||
|
import io.bkbn.kompendium.oas.serialization.KompendiumSerializersModule
|
||||||
|
import io.kotest.assertions.json.shouldEqualJson
|
||||||
|
import io.kotest.assertions.ktor.client.shouldHaveStatus
|
||||||
|
import io.kotest.matchers.shouldNot
|
||||||
|
import io.kotest.matchers.string.beBlank
|
||||||
|
import io.ktor.client.request.get
|
||||||
|
import io.ktor.client.statement.bodyAsText
|
||||||
|
import io.ktor.http.ContentType
|
||||||
|
import io.ktor.http.HttpStatusCode
|
||||||
|
import io.ktor.serialization.gson.gson
|
||||||
|
import io.ktor.serialization.jackson.jackson
|
||||||
|
import io.ktor.serialization.kotlinx.json.json
|
||||||
|
import io.ktor.server.application.Application
|
||||||
|
import io.ktor.server.plugins.contentnegotiation.ContentNegotiation
|
||||||
|
import io.ktor.server.routing.Routing
|
||||||
|
import io.ktor.server.testing.ApplicationTestBuilder
|
||||||
|
import io.ktor.server.testing.testApplication
|
||||||
|
import kotlin.reflect.KType
|
||||||
|
import kotlinx.serialization.json.Json
|
||||||
|
import java.io.File
|
||||||
|
|
||||||
|
object TestHelpers {
|
||||||
|
private const val OPEN_API_ENDPOINT = "/openapi.json"
|
||||||
|
|
||||||
|
fun getFileSnapshot(fileName: String): String {
|
||||||
|
val snapshotPath = "src/test/resources"
|
||||||
|
val file = File("$snapshotPath/$fileName")
|
||||||
|
return file.readText()
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Performs the baseline expected tests on an OpenAPI result. Confirms that the endpoint
|
||||||
|
* exists as expected, and that the content matches the expected blob found in the specified file
|
||||||
|
* @param snapshotName The snapshot file to retrieve from the resources folder
|
||||||
|
*/
|
||||||
|
private suspend fun ApplicationTestBuilder.compareOpenAPISpec(snapshotName: String) {
|
||||||
|
val response = client.get(OPEN_API_ENDPOINT)
|
||||||
|
response shouldHaveStatus HttpStatusCode.OK
|
||||||
|
response.bodyAsText() shouldNot beBlank()
|
||||||
|
response.bodyAsText() shouldEqualJson getFileSnapshot(snapshotName)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This will take a provided JSON snapshot file, retrieve it from the resource folder,
|
||||||
|
* and build a test ktor server to compare the expected output with the output found in the default
|
||||||
|
* OpenAPI json endpoint. By default, this will run the same test with Gson, Kotlinx, and Jackson serializers
|
||||||
|
* @param snapshotName The snapshot file to retrieve from the resources folder
|
||||||
|
*/
|
||||||
|
fun openApiTestAllSerializers(
|
||||||
|
snapshotName: String,
|
||||||
|
customTypes: Map<KType, JsonSchema> = emptyMap(),
|
||||||
|
applicationSetup: Application.() -> Unit = { },
|
||||||
|
specOverrides: OpenApiSpec.() -> OpenApiSpec = { this },
|
||||||
|
routeUnderTest: Routing.() -> Unit
|
||||||
|
) {
|
||||||
|
openApiTest(snapshotName, SupportedSerializer.KOTLINX, routeUnderTest, applicationSetup, specOverrides, customTypes)
|
||||||
|
openApiTest(snapshotName, SupportedSerializer.JACKSON, routeUnderTest, applicationSetup, specOverrides, customTypes)
|
||||||
|
openApiTest(snapshotName, SupportedSerializer.GSON, routeUnderTest, applicationSetup, specOverrides, customTypes)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun openApiTest(
|
||||||
|
snapshotName: String,
|
||||||
|
serializer: SupportedSerializer,
|
||||||
|
routeUnderTest: Routing.() -> Unit,
|
||||||
|
applicationSetup: Application.() -> Unit,
|
||||||
|
specOverrides: OpenApiSpec.() -> OpenApiSpec,
|
||||||
|
typeOverrides: Map<KType, JsonSchema> = emptyMap()
|
||||||
|
) = testApplication {
|
||||||
|
install(NotarizedApplication()) {
|
||||||
|
customTypes = typeOverrides
|
||||||
|
spec = defaultSpec().specOverrides()
|
||||||
|
schemaConfigurator = when (serializer) {
|
||||||
|
SupportedSerializer.KOTLINX -> KotlinXSchemaConfigurator()
|
||||||
|
SupportedSerializer.GSON -> GsonSchemaConfigurator()
|
||||||
|
SupportedSerializer.JACKSON -> JacksonSchemaConfigurator()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
install(ContentNegotiation) {
|
||||||
|
when (serializer) {
|
||||||
|
SupportedSerializer.KOTLINX -> json(Json {
|
||||||
|
encodeDefaults = true
|
||||||
|
explicitNulls = false
|
||||||
|
serializersModule = KompendiumSerializersModule.module
|
||||||
|
})
|
||||||
|
|
||||||
|
SupportedSerializer.GSON -> gson()
|
||||||
|
SupportedSerializer.JACKSON -> jackson(ContentType.Application.Json) {
|
||||||
|
enable(SerializationFeature.INDENT_OUTPUT)
|
||||||
|
setSerializationInclusion(JsonInclude.Include.NON_NULL)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
application(applicationSetup)
|
||||||
|
routing {
|
||||||
|
redoc()
|
||||||
|
routeUnderTest()
|
||||||
|
}
|
||||||
|
compareOpenAPISpec(snapshotName)
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,189 @@
|
|||||||
|
package io.bkbn.kompendium.core.fixtures
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnore
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty
|
||||||
|
import com.google.gson.annotations.Expose
|
||||||
|
import com.google.gson.annotations.SerializedName
|
||||||
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
import kotlinx.serialization.Transient
|
||||||
|
import java.time.Instant
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class TestNested(val nesty: String)
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class TestRequest(
|
||||||
|
val fieldName: TestNested,
|
||||||
|
val b: Double,
|
||||||
|
val aaa: List<Long>
|
||||||
|
)
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class TestSimpleRequest(
|
||||||
|
val a: String,
|
||||||
|
val b: Int
|
||||||
|
)
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class TestResponse(val c: String)
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
enum class TestEnum {
|
||||||
|
YES,
|
||||||
|
NO
|
||||||
|
}
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class NullableEnum(val a: TestEnum? = null)
|
||||||
|
|
||||||
|
data class TestCreatedResponse(val id: Int, val c: String)
|
||||||
|
|
||||||
|
data class DateTimeString(
|
||||||
|
val a: Instant
|
||||||
|
)
|
||||||
|
|
||||||
|
data class DefaultField(
|
||||||
|
val a: String = "hi",
|
||||||
|
val b: Int
|
||||||
|
)
|
||||||
|
|
||||||
|
data class NullableField(
|
||||||
|
val a: String?
|
||||||
|
)
|
||||||
|
|
||||||
|
data class ComplexRequest(
|
||||||
|
val org: String,
|
||||||
|
val amazingField: String,
|
||||||
|
val tables: List<NestedComplexItem>
|
||||||
|
)
|
||||||
|
|
||||||
|
data class NestedComplexItem(
|
||||||
|
val name: String,
|
||||||
|
val alias: CustomAlias
|
||||||
|
)
|
||||||
|
|
||||||
|
typealias CustomAlias = Map<String, CrazyItem>
|
||||||
|
|
||||||
|
data class CrazyItem(val enumeration: SimpleEnum)
|
||||||
|
|
||||||
|
enum class SimpleEnum {
|
||||||
|
ONE,
|
||||||
|
TWO
|
||||||
|
}
|
||||||
|
|
||||||
|
data class ExceptionResponse(val message: String)
|
||||||
|
|
||||||
|
sealed class FlibbityGibbit {
|
||||||
|
abstract val z: String
|
||||||
|
}
|
||||||
|
|
||||||
|
data class SimpleGibbit(val a: String, override val z: String = "z") : FlibbityGibbit()
|
||||||
|
data class ComplexGibbit(val b: String, val c: Int, override val z: String) : FlibbityGibbit()
|
||||||
|
|
||||||
|
sealed interface SlammaJamma
|
||||||
|
|
||||||
|
data class OneJamma(val a: Int) : SlammaJamma
|
||||||
|
data class AnothaJamma(val b: Float) : SlammaJamma
|
||||||
|
|
||||||
|
data class InsaneJamma(val c: SlammaJamma) : SlammaJamma
|
||||||
|
|
||||||
|
sealed interface Flibbity<T>
|
||||||
|
|
||||||
|
data class Gibbity<T>(val a: T) : Flibbity<T>
|
||||||
|
data class Bibbity<T>(val b: String, val f: T) : Flibbity<T>
|
||||||
|
|
||||||
|
data class NestedFlibbity<T>(
|
||||||
|
val flibbity: Flibbity<T>
|
||||||
|
)
|
||||||
|
|
||||||
|
enum class ColumnMode {
|
||||||
|
NULLABLE,
|
||||||
|
REQUIRED,
|
||||||
|
REPEATED
|
||||||
|
}
|
||||||
|
|
||||||
|
data class ColumnSchema(
|
||||||
|
val name: String,
|
||||||
|
val type: String,
|
||||||
|
val description: String,
|
||||||
|
val mode: ColumnMode,
|
||||||
|
val subColumns: List<ColumnSchema> = emptyList()
|
||||||
|
)
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
public data class ProfileUpdateRequest(
|
||||||
|
public val mood: String?,
|
||||||
|
public val viewCount: Long?,
|
||||||
|
public val metadata: ProfileMetadataUpdateRequest?
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
public data class ProfileMetadataUpdateRequest(
|
||||||
|
public val isPrivate: Boolean?,
|
||||||
|
public val otherThing: String?
|
||||||
|
)
|
||||||
|
|
||||||
|
data class Page<T>(
|
||||||
|
val content: List<T>,
|
||||||
|
val totalElements: Long,
|
||||||
|
val totalPages: Int,
|
||||||
|
val numberOfElements: Int,
|
||||||
|
val number: Int,
|
||||||
|
val size: Int
|
||||||
|
)
|
||||||
|
|
||||||
|
data class MultiNestedGenerics<T, E>(
|
||||||
|
val content: Map<T, E>
|
||||||
|
)
|
||||||
|
|
||||||
|
data class Something(val a: String, val b: Int)
|
||||||
|
|
||||||
|
data class ManyThings(
|
||||||
|
val someA: Something,
|
||||||
|
val someB: Something?
|
||||||
|
)
|
||||||
|
|
||||||
|
data class Foosy<T, K>(val test: T, val otherThing: List<K>)
|
||||||
|
data class Barzo<G>(val result: G)
|
||||||
|
|
||||||
|
object Nested {
|
||||||
|
@Serializable
|
||||||
|
data class Response(val idk: Boolean)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class TransientObject(
|
||||||
|
@field:Expose
|
||||||
|
val nonTransient: String,
|
||||||
|
@field:JsonIgnore
|
||||||
|
@Transient
|
||||||
|
val transient: String = "transient"
|
||||||
|
)
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class UnbackedObject(
|
||||||
|
val backed: String
|
||||||
|
) {
|
||||||
|
val unbacked: String get() = "unbacked"
|
||||||
|
}
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class SerialNameObject(
|
||||||
|
@field:JsonProperty("snake_case_name")
|
||||||
|
@field:SerializedName("snake_case_name")
|
||||||
|
@SerialName("snake_case_name")
|
||||||
|
val camelCaseName: String
|
||||||
|
)
|
||||||
|
|
||||||
|
enum class Color {
|
||||||
|
RED,
|
||||||
|
GREEN,
|
||||||
|
BLUE
|
||||||
|
}
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class ObjectWithEnum(
|
||||||
|
val color: Color
|
||||||
|
)
|
@ -0,0 +1,40 @@
|
|||||||
|
package io.bkbn.kompendium.core.fixtures
|
||||||
|
|
||||||
|
import io.bkbn.kompendium.oas.OpenApiSpec
|
||||||
|
import io.bkbn.kompendium.oas.info.Contact
|
||||||
|
import io.bkbn.kompendium.oas.info.Info
|
||||||
|
import io.bkbn.kompendium.oas.info.License
|
||||||
|
import io.bkbn.kompendium.oas.server.Server
|
||||||
|
import java.net.URI
|
||||||
|
|
||||||
|
object TestSpecs {
|
||||||
|
val defaultSpec: () -> OpenApiSpec = {
|
||||||
|
OpenApiSpec(
|
||||||
|
info = Info(
|
||||||
|
title = "Test API",
|
||||||
|
version = "1.33.7",
|
||||||
|
description = "An amazing, fully-ish \uD83D\uDE09 generated API spec",
|
||||||
|
termsOfService = URI("https://example.com"),
|
||||||
|
contact = Contact(
|
||||||
|
name = "Homer Simpson",
|
||||||
|
email = "chunkylover53@aol.com",
|
||||||
|
url = URI("https://gph.is/1NPUDiM")
|
||||||
|
),
|
||||||
|
license = License(
|
||||||
|
name = "MIT",
|
||||||
|
url = URI("https://github.com/bkbnio/kompendium/blob/main/LICENSE")
|
||||||
|
)
|
||||||
|
),
|
||||||
|
servers = mutableListOf(
|
||||||
|
Server(
|
||||||
|
url = URI("https://myawesomeapi.com"),
|
||||||
|
description = "Production instance of my API"
|
||||||
|
),
|
||||||
|
Server(
|
||||||
|
url = URI("https://staging.myawesomeapi.com"),
|
||||||
|
description = "Where the fun stuff happens"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
708
detekt.yml
708
detekt.yml
@ -1,710 +1,30 @@
|
|||||||
build:
|
|
||||||
maxIssues: 0
|
|
||||||
excludeCorrectable: false
|
|
||||||
weights:
|
|
||||||
# complexity: 2
|
|
||||||
# LongParameterList: 1
|
|
||||||
# style: 1
|
|
||||||
# comments: 1
|
|
||||||
|
|
||||||
config:
|
|
||||||
validation: true
|
|
||||||
warningsAsErrors: false
|
|
||||||
# when writing own rules with new properties, exclude the property path e.g.: 'my_rule_set,.*>.*>[my_property]'
|
|
||||||
excludes: ''
|
|
||||||
|
|
||||||
processors:
|
|
||||||
active: true
|
|
||||||
exclude:
|
|
||||||
- 'DetektProgressListener'
|
|
||||||
|
|
||||||
console-reports:
|
|
||||||
active: true
|
|
||||||
exclude:
|
|
||||||
- 'ProjectStatisticsReport'
|
|
||||||
- 'ComplexityReport'
|
|
||||||
- 'NotificationReport'
|
|
||||||
- 'FileBasedFindingsReport'
|
|
||||||
|
|
||||||
output-reports:
|
|
||||||
active: true
|
|
||||||
|
|
||||||
comments:
|
|
||||||
active: true
|
|
||||||
excludes: ['**/test/**', '**/testIntegration/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**']
|
|
||||||
AbsentOrWrongFileLicense:
|
|
||||||
active: false
|
|
||||||
licenseTemplateFile: 'license.template'
|
|
||||||
CommentOverPrivateFunction:
|
|
||||||
active: false
|
|
||||||
CommentOverPrivateProperty:
|
|
||||||
active: false
|
|
||||||
EndOfSentenceFormat:
|
|
||||||
active: false
|
|
||||||
endOfSentenceFormat: '([.?!][ \t\n\r\f<])|([.?!:]$)'
|
|
||||||
UndocumentedPublicClass:
|
|
||||||
active: false
|
|
||||||
searchInNestedClass: true
|
|
||||||
searchInInnerClass: true
|
|
||||||
searchInInnerObject: true
|
|
||||||
searchInInnerInterface: true
|
|
||||||
UndocumentedPublicFunction:
|
|
||||||
active: false
|
|
||||||
UndocumentedPublicProperty:
|
|
||||||
active: false
|
|
||||||
|
|
||||||
complexity:
|
complexity:
|
||||||
active: true
|
TooManyFunctions:
|
||||||
ComplexCondition:
|
|
||||||
active: true
|
|
||||||
threshold: 4
|
|
||||||
ComplexInterface:
|
|
||||||
active: false
|
active: false
|
||||||
threshold: 10
|
|
||||||
includeStaticDeclarations: false
|
|
||||||
includePrivateDeclarations: false
|
|
||||||
ComplexMethod:
|
|
||||||
active: true
|
|
||||||
threshold: 25
|
|
||||||
ignoreSingleWhenExpression: false
|
|
||||||
ignoreSimpleWhenEntries: false
|
|
||||||
ignoreNestingFunctions: false
|
|
||||||
nestingFunctions: [run, let, apply, with, also, use, forEach, isNotNull, ifNull]
|
|
||||||
LabeledExpression:
|
|
||||||
active: false
|
|
||||||
ignoredLabels: []
|
|
||||||
LargeClass:
|
|
||||||
active: true
|
|
||||||
threshold: 600
|
|
||||||
LongMethod:
|
|
||||||
active: true
|
|
||||||
threshold: 80
|
|
||||||
LongParameterList:
|
LongParameterList:
|
||||||
active: true
|
active: true
|
||||||
functionThreshold: 10
|
functionThreshold: 10
|
||||||
constructorThreshold: 10
|
constructorThreshold: 15
|
||||||
ignoreDefaultParameters: false
|
ComplexMethod:
|
||||||
ignoreDataClasses: true
|
threshold: 20
|
||||||
ignoreAnnotated: []
|
style:
|
||||||
MethodOverloading:
|
MaxLineLength:
|
||||||
active: false
|
excludes: ['**/test/**/*']
|
||||||
threshold: 6
|
|
||||||
NamedArguments:
|
|
||||||
active: false
|
|
||||||
threshold: 3
|
|
||||||
NestedBlockDepth:
|
|
||||||
active: true
|
active: true
|
||||||
threshold: 6
|
maxLineLength: 120
|
||||||
ReplaceSafeCallChainWithRun:
|
excludeCommentStatements: true
|
||||||
active: false
|
MagicNumber:
|
||||||
StringLiteralDuplication:
|
excludes: ['**/kompendium-playground/**/*', '**/test/**/*']
|
||||||
active: false
|
ForbiddenMethodCall:
|
||||||
excludes: ['**/test/**', '**/testIntegration/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**']
|
|
||||||
threshold: 3
|
|
||||||
ignoreAnnotation: true
|
|
||||||
excludeStringsWithLessThan5Characters: true
|
|
||||||
ignoreStringsRegex: '$^'
|
|
||||||
TooManyFunctions:
|
|
||||||
active: false
|
|
||||||
excludes: ['**/test/**', '**/testIntegration/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**']
|
|
||||||
thresholdInFiles: 11
|
|
||||||
thresholdInClasses: 11
|
|
||||||
thresholdInInterfaces: 11
|
|
||||||
thresholdInObjects: 11
|
|
||||||
thresholdInEnums: 11
|
|
||||||
ignoreDeprecated: false
|
|
||||||
ignorePrivate: false
|
|
||||||
ignoreOverridden: false
|
|
||||||
|
|
||||||
coroutines:
|
|
||||||
active: true
|
|
||||||
GlobalCoroutineUsage:
|
|
||||||
active: false
|
|
||||||
RedundantSuspendModifier:
|
|
||||||
active: false
|
|
||||||
SleepInsteadOfDelay:
|
|
||||||
active: false
|
|
||||||
SuspendFunWithFlowReturnType:
|
|
||||||
active: false
|
|
||||||
|
|
||||||
empty-blocks:
|
|
||||||
active: true
|
|
||||||
EmptyCatchBlock:
|
|
||||||
active: true
|
active: true
|
||||||
allowedExceptionNameRegex: '_|(ignore|expected).*'
|
|
||||||
EmptyClassBlock:
|
|
||||||
active: true
|
|
||||||
EmptyDefaultConstructor:
|
|
||||||
active: true
|
|
||||||
EmptyDoWhileBlock:
|
|
||||||
active: true
|
|
||||||
EmptyElseBlock:
|
|
||||||
active: true
|
|
||||||
EmptyFinallyBlock:
|
|
||||||
active: true
|
|
||||||
EmptyForBlock:
|
|
||||||
active: true
|
|
||||||
EmptyFunctionBlock:
|
|
||||||
active: true
|
|
||||||
ignoreOverridden: false
|
|
||||||
EmptyIfBlock:
|
|
||||||
active: true
|
|
||||||
EmptyInitBlock:
|
|
||||||
active: true
|
|
||||||
EmptyKtFile:
|
|
||||||
active: true
|
|
||||||
EmptySecondaryConstructor:
|
|
||||||
active: true
|
|
||||||
EmptyTryBlock:
|
|
||||||
active: true
|
|
||||||
EmptyWhenBlock:
|
|
||||||
active: true
|
|
||||||
EmptyWhileBlock:
|
|
||||||
active: true
|
|
||||||
|
|
||||||
exceptions:
|
|
||||||
active: true
|
|
||||||
ExceptionRaisedInUnexpectedLocation:
|
|
||||||
active: true
|
|
||||||
methodNames: [toString, hashCode, equals, finalize]
|
|
||||||
InstanceOfCheckForException:
|
|
||||||
active: false
|
|
||||||
excludes: ['**/test/**', '**/testIntegration/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**']
|
|
||||||
NotImplementedDeclaration:
|
|
||||||
active: false
|
|
||||||
ObjectExtendsThrowable:
|
|
||||||
active: false
|
|
||||||
PrintStackTrace:
|
|
||||||
active: true
|
|
||||||
RethrowCaughtException:
|
|
||||||
active: true
|
|
||||||
ReturnFromFinally:
|
|
||||||
active: true
|
|
||||||
ignoreLabeled: false
|
|
||||||
SwallowedException:
|
|
||||||
active: true
|
|
||||||
ignoredExceptionTypes:
|
|
||||||
- InterruptedException
|
|
||||||
- NumberFormatException
|
|
||||||
- ParseException
|
|
||||||
- MalformedURLException
|
|
||||||
allowedExceptionNameRegex: '_|(ignore|expected).*'
|
|
||||||
ThrowingExceptionFromFinally:
|
|
||||||
active: true
|
|
||||||
ThrowingExceptionInMain:
|
|
||||||
active: false
|
|
||||||
ThrowingExceptionsWithoutMessageOrCause:
|
|
||||||
active: true
|
|
||||||
excludes: ['**/test/**', '**/testIntegration/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**']
|
|
||||||
exceptions:
|
|
||||||
- IllegalArgumentException
|
|
||||||
- IllegalStateException
|
|
||||||
- IOException
|
|
||||||
ThrowingNewInstanceOfSameException:
|
|
||||||
active: true
|
|
||||||
TooGenericExceptionCaught:
|
|
||||||
active: true
|
|
||||||
excludes: ['**/test/**', '**/testIntegration/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**']
|
|
||||||
exceptionNames:
|
|
||||||
- ArrayIndexOutOfBoundsException
|
|
||||||
- Error
|
|
||||||
- Exception
|
|
||||||
- IllegalMonitorStateException
|
|
||||||
- NullPointerException
|
|
||||||
- IndexOutOfBoundsException
|
|
||||||
- RuntimeException
|
|
||||||
- Throwable
|
|
||||||
allowedExceptionNameRegex: '_|(ignore|expected).*'
|
|
||||||
TooGenericExceptionThrown:
|
|
||||||
active: true
|
|
||||||
exceptionNames:
|
|
||||||
- Error
|
|
||||||
- Exception
|
|
||||||
- Throwable
|
|
||||||
- RuntimeException
|
|
||||||
|
|
||||||
formatting:
|
formatting:
|
||||||
active: true
|
Indentation:
|
||||||
android: false
|
indentSize: 2
|
||||||
autoCorrect: true
|
|
||||||
AnnotationOnSeparateLine:
|
|
||||||
active: false
|
|
||||||
autoCorrect: true
|
|
||||||
AnnotationSpacing:
|
|
||||||
active: false
|
|
||||||
autoCorrect: true
|
|
||||||
ArgumentListWrapping:
|
|
||||||
active: false
|
|
||||||
autoCorrect: true
|
|
||||||
ChainWrapping:
|
|
||||||
active: true
|
|
||||||
autoCorrect: true
|
|
||||||
CommentSpacing:
|
|
||||||
active: true
|
|
||||||
autoCorrect: true
|
|
||||||
EnumEntryNameCase:
|
|
||||||
active: false
|
|
||||||
autoCorrect: true
|
|
||||||
Filename:
|
|
||||||
active: true
|
|
||||||
FinalNewline:
|
|
||||||
active: true
|
|
||||||
autoCorrect: true
|
|
||||||
insertFinalNewLine: true
|
|
||||||
ImportOrdering:
|
ImportOrdering:
|
||||||
active: false
|
active: false
|
||||||
autoCorrect: true
|
|
||||||
layout: 'idea'
|
|
||||||
Indentation:
|
|
||||||
active: false
|
|
||||||
autoCorrect: true
|
|
||||||
indentSize: 4
|
|
||||||
continuationIndentSize: 4
|
|
||||||
MaximumLineLength:
|
|
||||||
active: true
|
|
||||||
maxLineLength: 120
|
|
||||||
ModifierOrdering:
|
|
||||||
active: true
|
|
||||||
autoCorrect: true
|
|
||||||
MultiLineIfElse:
|
|
||||||
active: true
|
|
||||||
autoCorrect: true
|
|
||||||
NoBlankLineBeforeRbrace:
|
|
||||||
active: true
|
|
||||||
autoCorrect: true
|
|
||||||
NoConsecutiveBlankLines:
|
|
||||||
active: true
|
|
||||||
autoCorrect: true
|
|
||||||
NoEmptyClassBody:
|
|
||||||
active: true
|
|
||||||
autoCorrect: true
|
|
||||||
NoEmptyFirstLineInMethodBlock:
|
|
||||||
active: false
|
|
||||||
autoCorrect: true
|
|
||||||
NoLineBreakAfterElse:
|
|
||||||
active: true
|
|
||||||
autoCorrect: true
|
|
||||||
NoLineBreakBeforeAssignment:
|
|
||||||
active: true
|
|
||||||
autoCorrect: true
|
|
||||||
NoMultipleSpaces:
|
|
||||||
active: true
|
|
||||||
autoCorrect: true
|
|
||||||
NoSemicolons:
|
|
||||||
active: true
|
|
||||||
autoCorrect: true
|
|
||||||
NoTrailingSpaces:
|
|
||||||
active: true
|
|
||||||
autoCorrect: true
|
|
||||||
NoUnitReturn:
|
|
||||||
active: true
|
|
||||||
autoCorrect: true
|
|
||||||
NoUnusedImports:
|
|
||||||
active: true
|
|
||||||
autoCorrect: true
|
|
||||||
NoWildcardImports:
|
|
||||||
active: true
|
|
||||||
PackageName:
|
|
||||||
active: true
|
|
||||||
autoCorrect: true
|
|
||||||
ParameterListWrapping:
|
|
||||||
active: false
|
|
||||||
autoCorrect: true
|
|
||||||
indentSize: 4
|
|
||||||
SpacingAroundAngleBrackets:
|
|
||||||
active: false
|
|
||||||
autoCorrect: true
|
|
||||||
SpacingAroundColon:
|
|
||||||
active: true
|
|
||||||
autoCorrect: true
|
|
||||||
SpacingAroundComma:
|
|
||||||
active: true
|
|
||||||
autoCorrect: true
|
|
||||||
SpacingAroundCurly:
|
|
||||||
active: true
|
|
||||||
autoCorrect: true
|
|
||||||
SpacingAroundDot:
|
|
||||||
active: true
|
|
||||||
autoCorrect: true
|
|
||||||
SpacingAroundDoubleColon:
|
|
||||||
active: false
|
|
||||||
autoCorrect: true
|
|
||||||
SpacingAroundKeyword:
|
|
||||||
active: true
|
|
||||||
autoCorrect: true
|
|
||||||
SpacingAroundOperators:
|
|
||||||
active: true
|
|
||||||
autoCorrect: true
|
|
||||||
SpacingAroundParens:
|
|
||||||
active: true
|
|
||||||
autoCorrect: true
|
|
||||||
SpacingAroundRangeOperator:
|
|
||||||
active: true
|
|
||||||
autoCorrect: true
|
|
||||||
SpacingAroundUnaryOperator:
|
|
||||||
active: false
|
|
||||||
autoCorrect: true
|
|
||||||
SpacingBetweenDeclarationsWithAnnotations:
|
|
||||||
active: false
|
|
||||||
autoCorrect: true
|
|
||||||
SpacingBetweenDeclarationsWithComments:
|
|
||||||
active: false
|
|
||||||
autoCorrect: true
|
|
||||||
StringTemplate:
|
|
||||||
active: true
|
|
||||||
autoCorrect: true
|
|
||||||
|
|
||||||
naming:
|
naming:
|
||||||
active: true
|
|
||||||
ClassNaming:
|
|
||||||
active: true
|
|
||||||
excludes: ['**/test/**', '**/testIntegration/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**']
|
|
||||||
classPattern: '[A-Z][a-zA-Z0-9]*'
|
|
||||||
ConstructorParameterNaming:
|
ConstructorParameterNaming:
|
||||||
active: false
|
active: false
|
||||||
excludes: ['**/test/**', '**/testIntegration/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**']
|
|
||||||
parameterPattern: '[a-z][A-Za-z0-9]*'
|
|
||||||
privateParameterPattern: '[a-z][A-Za-z0-9]*'
|
|
||||||
excludeClassPattern: '$^'
|
|
||||||
ignoreOverridden: true
|
|
||||||
EnumNaming:
|
|
||||||
active: true
|
|
||||||
excludes: ['**/test/**', '**/testIntegration/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**']
|
|
||||||
enumEntryPattern: '[A-Z][_a-zA-Z0-9]*'
|
|
||||||
ForbiddenClassName:
|
|
||||||
active: false
|
|
||||||
excludes: ['**/test/**', '**/testIntegration/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**']
|
|
||||||
forbiddenName: []
|
|
||||||
FunctionMaxLength:
|
|
||||||
active: false
|
|
||||||
excludes: ['**/test/**', '**/testIntegration/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**']
|
|
||||||
maximumFunctionNameLength: 30
|
|
||||||
FunctionMinLength:
|
|
||||||
active: false
|
|
||||||
excludes: ['**/test/**', '**/testIntegration/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**']
|
|
||||||
minimumFunctionNameLength: 3
|
|
||||||
FunctionNaming:
|
|
||||||
active: true
|
|
||||||
excludes: ['**/test/**', '**/testIntegration/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**']
|
|
||||||
functionPattern: '([a-z][a-zA-Z0-9]*)|(`.*`)'
|
|
||||||
excludeClassPattern: '$^'
|
|
||||||
ignoreOverridden: true
|
|
||||||
ignoreAnnotated: ['Composable']
|
|
||||||
FunctionParameterNaming:
|
|
||||||
active: true
|
|
||||||
excludes: ['**/test/**', '**/testIntegration/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**']
|
|
||||||
parameterPattern: '[a-z][A-Za-z0-9]*'
|
|
||||||
excludeClassPattern: '$^'
|
|
||||||
ignoreOverridden: true
|
|
||||||
InvalidPackageDeclaration:
|
|
||||||
active: false
|
|
||||||
excludes: ['*.kts']
|
|
||||||
rootPackage: ''
|
|
||||||
MatchingDeclarationName:
|
|
||||||
active: true
|
|
||||||
mustBeFirst: true
|
|
||||||
MemberNameEqualsClassName:
|
|
||||||
active: true
|
|
||||||
ignoreOverridden: true
|
|
||||||
NonBooleanPropertyPrefixedWithIs:
|
|
||||||
active: false
|
|
||||||
excludes: ['**/test/**', '**/testIntegration/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**']
|
|
||||||
ObjectPropertyNaming:
|
|
||||||
active: true
|
|
||||||
excludes: ['**/test/**', '**/testIntegration/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**']
|
|
||||||
constantPattern: '[A-Za-z][_A-Za-z0-9]*'
|
|
||||||
propertyPattern: '[A-Za-z][_A-Za-z0-9]*'
|
|
||||||
privatePropertyPattern: '(_)?[A-Za-z][_A-Za-z0-9]*'
|
|
||||||
PackageNaming:
|
|
||||||
active: true
|
|
||||||
excludes: ['**/test/**', '**/testIntegration/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**']
|
|
||||||
packagePattern: '[a-z]+(\.[a-z][A-Za-z0-9]*)*'
|
|
||||||
TopLevelPropertyNaming:
|
|
||||||
active: true
|
|
||||||
excludes: ['**/test/**', '**/testIntegration/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**']
|
|
||||||
constantPattern: '[A-Z][_A-Z0-9]*'
|
|
||||||
propertyPattern: '[A-Za-z][_A-Za-z0-9]*'
|
|
||||||
privatePropertyPattern: '_?[A-Za-z][_A-Za-z0-9]*'
|
|
||||||
VariableMaxLength:
|
|
||||||
active: false
|
|
||||||
excludes: ['**/test/**', '**/testIntegration/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**']
|
|
||||||
maximumVariableNameLength: 64
|
|
||||||
VariableMinLength:
|
|
||||||
active: false
|
|
||||||
excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**']
|
|
||||||
minimumVariableNameLength: 1
|
|
||||||
VariableNaming:
|
|
||||||
active: true
|
|
||||||
excludes: ['**/test/**', '**/testIntegration/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**']
|
|
||||||
variablePattern: '[a-z][A-Za-z0-9]*'
|
|
||||||
privateVariablePattern: '(_)?[a-z][A-Za-z0-9]*'
|
|
||||||
excludeClassPattern: '$^'
|
|
||||||
ignoreOverridden: true
|
|
||||||
|
|
||||||
performance:
|
performance:
|
||||||
active: true
|
|
||||||
ArrayPrimitive:
|
|
||||||
active: true
|
|
||||||
ForEachOnRange:
|
|
||||||
active: true
|
|
||||||
excludes: ['**/test/**', '**/testIntegration/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**']
|
|
||||||
SpreadOperator:
|
SpreadOperator:
|
||||||
active: true
|
|
||||||
excludes: ['**/test/**', '**/testIntegration/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**']
|
|
||||||
UnnecessaryTemporaryInstantiation:
|
|
||||||
active: true
|
|
||||||
|
|
||||||
potential-bugs:
|
|
||||||
active: true
|
|
||||||
Deprecation:
|
|
||||||
active: false
|
active: false
|
||||||
DontDowncastCollectionTypes:
|
|
||||||
active: false
|
|
||||||
DuplicateCaseInWhenExpression:
|
|
||||||
active: true
|
|
||||||
EqualsAlwaysReturnsTrueOrFalse:
|
|
||||||
active: true
|
|
||||||
EqualsWithHashCodeExist:
|
|
||||||
active: true
|
|
||||||
ExitOutsideMain:
|
|
||||||
active: false
|
|
||||||
ExplicitGarbageCollectionCall:
|
|
||||||
active: true
|
|
||||||
HasPlatformType:
|
|
||||||
active: false
|
|
||||||
IgnoredReturnValue:
|
|
||||||
active: false
|
|
||||||
restrictToAnnotatedMethods: true
|
|
||||||
returnValueAnnotations: ['*.CheckReturnValue', '*.CheckResult']
|
|
||||||
ImplicitDefaultLocale:
|
|
||||||
active: true
|
|
||||||
ImplicitUnitReturnType:
|
|
||||||
active: false
|
|
||||||
allowExplicitReturnType: true
|
|
||||||
InvalidRange:
|
|
||||||
active: true
|
|
||||||
IteratorHasNextCallsNextMethod:
|
|
||||||
active: true
|
|
||||||
IteratorNotThrowingNoSuchElementException:
|
|
||||||
active: true
|
|
||||||
LateinitUsage:
|
|
||||||
active: false
|
|
||||||
excludes: ['**/test/**', '**/testIntegration/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**']
|
|
||||||
excludeAnnotatedProperties: []
|
|
||||||
ignoreOnClassesPattern: ''
|
|
||||||
MapGetWithNotNullAssertionOperator:
|
|
||||||
active: false
|
|
||||||
MissingWhenCase:
|
|
||||||
active: true
|
|
||||||
allowElseExpression: true
|
|
||||||
NullableToStringCall:
|
|
||||||
active: false
|
|
||||||
RedundantElseInWhen:
|
|
||||||
active: true
|
|
||||||
UnconditionalJumpStatementInLoop:
|
|
||||||
active: false
|
|
||||||
UnnecessaryNotNullOperator:
|
|
||||||
active: true
|
|
||||||
UnnecessarySafeCall:
|
|
||||||
active: true
|
|
||||||
UnreachableCatchBlock:
|
|
||||||
active: false
|
|
||||||
UnreachableCode:
|
|
||||||
active: true
|
|
||||||
UnsafeCallOnNullableType:
|
|
||||||
active: true
|
|
||||||
UnsafeCast:
|
|
||||||
active: true
|
|
||||||
UselessPostfixExpression:
|
|
||||||
active: false
|
|
||||||
WrongEqualsTypeParameter:
|
|
||||||
active: true
|
|
||||||
|
|
||||||
style:
|
|
||||||
active: true
|
|
||||||
ClassOrdering:
|
|
||||||
active: false
|
|
||||||
CollapsibleIfStatements:
|
|
||||||
active: false
|
|
||||||
DataClassContainsFunctions:
|
|
||||||
active: false
|
|
||||||
conversionFunctionPrefix: 'to'
|
|
||||||
DataClassShouldBeImmutable:
|
|
||||||
active: false
|
|
||||||
DestructuringDeclarationWithTooManyEntries:
|
|
||||||
active: false
|
|
||||||
maxDestructuringEntries: 3
|
|
||||||
EqualsNullCall:
|
|
||||||
active: true
|
|
||||||
EqualsOnSignatureLine:
|
|
||||||
active: false
|
|
||||||
ExplicitCollectionElementAccessMethod:
|
|
||||||
active: false
|
|
||||||
ExplicitItLambdaParameter:
|
|
||||||
active: false
|
|
||||||
ExpressionBodySyntax:
|
|
||||||
active: false
|
|
||||||
includeLineWrapping: false
|
|
||||||
ForbiddenComment:
|
|
||||||
active: true
|
|
||||||
values: ['TODO:', 'FIXME:', 'STOPSHIP:']
|
|
||||||
allowedPatterns: ''
|
|
||||||
ForbiddenImport:
|
|
||||||
active: false
|
|
||||||
imports: []
|
|
||||||
forbiddenPatterns: ''
|
|
||||||
ForbiddenMethodCall:
|
|
||||||
active: false
|
|
||||||
methods: ['kotlin.io.println', 'kotlin.io.print']
|
|
||||||
ForbiddenPublicDataClass:
|
|
||||||
active: true
|
|
||||||
excludes: ['**']
|
|
||||||
ignorePackages: ['*.internal', '*.internal.*']
|
|
||||||
ForbiddenVoid:
|
|
||||||
active: false
|
|
||||||
ignoreOverridden: false
|
|
||||||
ignoreUsageInGenerics: false
|
|
||||||
FunctionOnlyReturningConstant:
|
|
||||||
active: true
|
|
||||||
ignoreOverridableFunction: true
|
|
||||||
ignoreActualFunction: true
|
|
||||||
excludedFunctions: 'describeContents'
|
|
||||||
excludeAnnotatedFunction: ['dagger.Provides']
|
|
||||||
LibraryCodeMustSpecifyReturnType:
|
|
||||||
active: true
|
|
||||||
excludes: ['**']
|
|
||||||
LibraryEntitiesShouldNotBePublic:
|
|
||||||
active: true
|
|
||||||
excludes: ['**']
|
|
||||||
LoopWithTooManyJumpStatements:
|
|
||||||
active: true
|
|
||||||
maxJumpCount: 1
|
|
||||||
MagicNumber:
|
|
||||||
active: true
|
|
||||||
excludes: ['**/test/**', '**/testIntegration/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**']
|
|
||||||
ignoreNumbers: ['-1', '0', '1', '2']
|
|
||||||
ignoreHashCodeFunction: true
|
|
||||||
ignorePropertyDeclaration: false
|
|
||||||
ignoreLocalVariableDeclaration: false
|
|
||||||
ignoreConstantDeclaration: true
|
|
||||||
ignoreCompanionObjectPropertyDeclaration: true
|
|
||||||
ignoreAnnotation: false
|
|
||||||
ignoreNamedArgument: true
|
|
||||||
ignoreEnums: false
|
|
||||||
ignoreRanges: false
|
|
||||||
ignoreExtensionFunctions: true
|
|
||||||
MandatoryBracesIfStatements:
|
|
||||||
active: false
|
|
||||||
MandatoryBracesLoops:
|
|
||||||
active: false
|
|
||||||
MaxLineLength:
|
|
||||||
active: true
|
|
||||||
maxLineLength: 120
|
|
||||||
excludePackageStatements: true
|
|
||||||
excludeImportStatements: true
|
|
||||||
excludeCommentStatements: false
|
|
||||||
MayBeConst:
|
|
||||||
active: true
|
|
||||||
ModifierOrder:
|
|
||||||
active: true
|
|
||||||
MultilineLambdaItParameter:
|
|
||||||
active: false
|
|
||||||
NestedClassesVisibility:
|
|
||||||
active: true
|
|
||||||
NewLineAtEndOfFile:
|
|
||||||
active: true
|
|
||||||
NoTabs:
|
|
||||||
active: false
|
|
||||||
OptionalAbstractKeyword:
|
|
||||||
active: true
|
|
||||||
OptionalUnit:
|
|
||||||
active: false
|
|
||||||
OptionalWhenBraces:
|
|
||||||
active: false
|
|
||||||
PreferToOverPairSyntax:
|
|
||||||
active: false
|
|
||||||
ProtectedMemberInFinalClass:
|
|
||||||
active: true
|
|
||||||
RedundantExplicitType:
|
|
||||||
active: false
|
|
||||||
RedundantHigherOrderMapUsage:
|
|
||||||
active: false
|
|
||||||
RedundantVisibilityModifierRule:
|
|
||||||
active: false
|
|
||||||
ReturnCount:
|
|
||||||
active: true
|
|
||||||
max: 2
|
|
||||||
excludedFunctions: 'equals'
|
|
||||||
excludeLabeled: false
|
|
||||||
excludeReturnFromLambda: true
|
|
||||||
excludeGuardClauses: false
|
|
||||||
SafeCast:
|
|
||||||
active: true
|
|
||||||
SerialVersionUIDInSerializableClass:
|
|
||||||
active: true
|
|
||||||
SpacingBetweenPackageAndImports:
|
|
||||||
active: false
|
|
||||||
ThrowsCount:
|
|
||||||
active: true
|
|
||||||
max: 2
|
|
||||||
TrailingWhitespace:
|
|
||||||
active: false
|
|
||||||
UnderscoresInNumericLiterals:
|
|
||||||
active: false
|
|
||||||
acceptableDecimalLength: 5
|
|
||||||
UnnecessaryAbstractClass:
|
|
||||||
active: true
|
|
||||||
excludeAnnotatedClasses: ['dagger.Module']
|
|
||||||
UnnecessaryAnnotationUseSiteTarget:
|
|
||||||
active: false
|
|
||||||
UnnecessaryApply:
|
|
||||||
active: true
|
|
||||||
UnnecessaryFilter:
|
|
||||||
active: false
|
|
||||||
UnnecessaryInheritance:
|
|
||||||
active: true
|
|
||||||
UnnecessaryLet:
|
|
||||||
active: false
|
|
||||||
UnnecessaryParentheses:
|
|
||||||
active: false
|
|
||||||
UntilInsteadOfRangeTo:
|
|
||||||
active: false
|
|
||||||
UnusedImports:
|
|
||||||
active: false
|
|
||||||
UnusedPrivateClass:
|
|
||||||
active: true
|
|
||||||
UnusedPrivateMember:
|
|
||||||
active: true
|
|
||||||
allowedNames: '(_|ignored|expected|serialVersionUID)'
|
|
||||||
UseArrayLiteralsInAnnotations:
|
|
||||||
active: false
|
|
||||||
UseCheckNotNull:
|
|
||||||
active: false
|
|
||||||
UseCheckOrError:
|
|
||||||
active: false
|
|
||||||
UseDataClass:
|
|
||||||
active: false
|
|
||||||
excludeAnnotatedClasses: []
|
|
||||||
allowVars: false
|
|
||||||
UseEmptyCounterpart:
|
|
||||||
active: false
|
|
||||||
UseIfEmptyOrIfBlank:
|
|
||||||
active: false
|
|
||||||
UseIfInsteadOfWhen:
|
|
||||||
active: false
|
|
||||||
UseIsNullOrEmpty:
|
|
||||||
active: false
|
|
||||||
UseRequire:
|
|
||||||
active: false
|
|
||||||
UseRequireNotNull:
|
|
||||||
active: false
|
|
||||||
UselessCallOnNotNull:
|
|
||||||
active: true
|
|
||||||
UtilityClassWithPublicConstructor:
|
|
||||||
active: true
|
|
||||||
VarCouldBeVal:
|
|
||||||
active: true
|
|
||||||
WildcardImport:
|
|
||||||
active: true
|
|
||||||
excludes: ['**/test/**', '**/testIntegration/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**']
|
|
||||||
excludeImports: ['java.util.*', 'kotlinx.android.synthetic.*']
|
|
||||||
|
9
docs/SUMMARY.md
Normal file
9
docs/SUMMARY.md
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
# Summary
|
||||||
|
|
||||||
|
* [Introduction](index.md)
|
||||||
|
* [Plugins](plugins/index.md)
|
||||||
|
* [Notarized Application](plugins/notarized_application.md)
|
||||||
|
* [Notarized Route](plugins/notarized_route.md)
|
||||||
|
* [Notarized Locations](plugins/notarized_locations.md)
|
||||||
|
* [Notarized Resources](plugins/notarized_resources.md)
|
||||||
|
* [The Playground](playground.md)
|
101
docs/index.md
Normal file
101
docs/index.md
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
Kompendium is intended to be a non-invasive OpenAPI spec generator for [Ktor](https://ktor.io) APIs. By operating
|
||||||
|
entirely through Ktor's plugin architecture, Kompendium allows you to incrementally document your API without requiring
|
||||||
|
you to rip out and replace the amazing code you have already written.
|
||||||
|
|
||||||
|
# Compatibility
|
||||||
|
|
||||||
|
| Kompendium | Ktor | OpenAPI |
|
||||||
|
|------------|------|---------|
|
||||||
|
| 1.X | 1 | 3.0 |
|
||||||
|
| 2.X | 1 | 3.0 |
|
||||||
|
| 3.X | 2 | 3.1 |
|
||||||
|
|
||||||
|
> These docs are focused solely on Kompendium 3, previous versions should be considered deprecated and no longer
|
||||||
|
> maintained
|
||||||
|
|
||||||
|
# Getting Started
|
||||||
|
|
||||||
|
## Adding the Artifact
|
||||||
|
|
||||||
|
All Kompendium artifacts are published to Maven Central. Most Kompendium users will only need to import the core
|
||||||
|
dependency
|
||||||
|
|
||||||
|
```kotlin
|
||||||
|
dependencies {
|
||||||
|
// other dependencies...
|
||||||
|
implementation("io.bkbn:kompendium-core:latest.release")
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Notarizing a Ktor Application
|
||||||
|
|
||||||
|
Once we have added the dependencies, installed the `NotarizedApplication` plugin. This is an application-level
|
||||||
|
Ktor plugin that is used to instantiate and configure Kompendium. Your OpenAPI spec metadata will go here, along with
|
||||||
|
custom type overrides (typically useful for custom scalars such as dates and times), along with other configurations.
|
||||||
|
|
||||||
|
```kotlin
|
||||||
|
private fun Application.mainModule() {
|
||||||
|
install(NotarizedApplication()) {
|
||||||
|
spec = OpenApiSpec(
|
||||||
|
// ...
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
At this point, you will have a valid OpenAPI specification generated at runtime, which can be accessed by default
|
||||||
|
at the `/openapi.json` path of your api.
|
||||||
|
|
||||||
|
For more detail on the `NotarizedApplication` plugin, please see the [docs](./plugins/notarized_application.md)
|
||||||
|
|
||||||
|
## Notarizing a Ktor Route
|
||||||
|
|
||||||
|
Once you have notarized your application, you can begin to notarize individual routes using the `NotarizedRoute` plugin.
|
||||||
|
This is a route-level Ktor plugin that is used to configure the documentation for a specific endpoint of your API. The
|
||||||
|
route documentation will be piped back to the application-level plugin, and will be automatically injected into the
|
||||||
|
OpenApi specification.
|
||||||
|
|
||||||
|
Setting up documentation on a route is easiest achieved by creating an extension function on the Ktor `Route` class
|
||||||
|
|
||||||
|
```kotlin
|
||||||
|
private fun Route.documentation() {
|
||||||
|
install(NotarizedRoute()) {
|
||||||
|
parameters = listOf(
|
||||||
|
Parameter(
|
||||||
|
name = "id",
|
||||||
|
`in` = Parameter.Location.path,
|
||||||
|
schema = TypeDefinition.STRING
|
||||||
|
)
|
||||||
|
)
|
||||||
|
get = GetInfo.builder {
|
||||||
|
summary("Get user by id")
|
||||||
|
description("A very neat endpoint!")
|
||||||
|
response {
|
||||||
|
responseCode(HttpStatusCode.OK)
|
||||||
|
responseType<ExampleResponse>()
|
||||||
|
description("Will return whether or not the user is real 😱")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Once you have created your documentation function, it can be attached to the route simply by calling it at the desired
|
||||||
|
path.
|
||||||
|
|
||||||
|
```kotlin
|
||||||
|
private fun Application.mainModule() {
|
||||||
|
// ...
|
||||||
|
routing {
|
||||||
|
// ...
|
||||||
|
route("/{id}") {
|
||||||
|
documentation()
|
||||||
|
get {
|
||||||
|
// ...
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
For more details on the `NotarizedRoute` plugin, please see the [docs](./plugins/notarized_route.md)
|
20
docs/playground.md
Normal file
20
docs/playground.md
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
The Playground is a module inside the Kompendium repository that provides out of the box examples for a variety of
|
||||||
|
Kompendium features.
|
||||||
|
|
||||||
|
At the moment, the following playground applications are
|
||||||
|
|
||||||
|
| Example | Description |
|
||||||
|
|--------------|------------------------------------------------------------|
|
||||||
|
| Basic | A minimally viable Kompendium application |
|
||||||
|
| Auth | Documenting authenticated routes |
|
||||||
|
| Custom Types | Documenting custom scalars to be used by Kompendium |
|
||||||
|
| Exceptions | Documenting exception responses |
|
||||||
|
| Gson | Serialization using Gson instead of the default Kotlinx |
|
||||||
|
| Hidden Docs | Place your generated documentation behind authorization |
|
||||||
|
| Jackson | Serialization using Jackson instead of the default KotlinX |
|
||||||
|
| Locations | Using the Ktor Locations API to define routes |
|
||||||
|
| Resources | Using the Ktor Resources API to define routes |
|
||||||
|
|
||||||
|
You can find all of the playground
|
||||||
|
examples [here](https://github.com/bkbnio/kompendium/tree/main/playground/src/main/kotlin/io/bkbn/kompendium/playground)
|
||||||
|
in the Kompendium repository
|
11
docs/plugins/index.md
Normal file
11
docs/plugins/index.md
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
Plugins are the lifeblood of Kompendium.
|
||||||
|
|
||||||
|
It starts with the `NotarizedApplication`, where Kompendium is instantiated and attached to the API. This is where spec
|
||||||
|
metadata is defined, custom types are defined, and more.
|
||||||
|
|
||||||
|
From there, a `NotarizedRoute` plugin is attached to each route you wish to document. This allows API documentation to
|
||||||
|
be an iterative process. Each route you notarize will be picked up and injected into the OpenAPI spec that Kompendium
|
||||||
|
generates for you.
|
||||||
|
|
||||||
|
Finally, there is the `NotarizedLocations` plugin that allows you to leverage and document your usage of the
|
||||||
|
Ktor [Locations](https://ktor.io/docs/locations.html) API.
|
105
docs/plugins/notarized_application.md
Normal file
105
docs/plugins/notarized_application.md
Normal file
@ -0,0 +1,105 @@
|
|||||||
|
The `NotarizedApplication` plugin sits at the center of the entire Kompendium setup. It is a pre-requisite to
|
||||||
|
installing any other Kompendium plugins.
|
||||||
|
|
||||||
|
# Configuration
|
||||||
|
|
||||||
|
Very little configuration is needed for a basic documentation setup, but
|
||||||
|
several configuration options are available that allow you to modify Kompendium to fit your needs.
|
||||||
|
|
||||||
|
## Spec
|
||||||
|
|
||||||
|
This is where you will define the server metadata that lives outside the scope of any specific route. For
|
||||||
|
full information, you can inspect the `OpenApiSpec` data class, and of course
|
||||||
|
reference [OpenAPI spec](https://spec.openapis.org/oas/v3.1.0) itself.
|
||||||
|
|
||||||
|
> ⚠️ Please note, the `path` field of the `OpenApiSpec` is intended to be filled in by `NotarizedRoute` plugin
|
||||||
|
> definitions. Writing custom paths manually could lead to unexpected behavior
|
||||||
|
|
||||||
|
## Custom Routing
|
||||||
|
|
||||||
|
For public facing APIs, having the default endpoint exposed at `/openapi.json` is totally fine. However, if you need
|
||||||
|
more granular control over the route that exposes the generated schema, you can modify the `openApiJson` config value.
|
||||||
|
|
||||||
|
For example, if we want to hide our schema behind a basic auth check, we could do the following
|
||||||
|
|
||||||
|
```kotlin
|
||||||
|
private fun Application.mainModule() {
|
||||||
|
// Install content negotiation, auth, etc...
|
||||||
|
install(NotarizedApplication()) {
|
||||||
|
// ...
|
||||||
|
openApiJson = {
|
||||||
|
authenticate("basic") {
|
||||||
|
route("/openapi.json") {
|
||||||
|
get {
|
||||||
|
call.respond(
|
||||||
|
HttpStatusCode.OK,
|
||||||
|
this@route.application.attributes[KompendiumAttributes.openApiSpec]
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Custom Types
|
||||||
|
|
||||||
|
Kompendium is _really_ good at converting simple scalar and complex objects into JsonSchema compliant specs. However,
|
||||||
|
there is a subset of values that cause it trouble. These are most commonly classes that produce "complex scalars",
|
||||||
|
such as dates and times, along with object representations of scalars such as `BigInteger`.
|
||||||
|
|
||||||
|
In situations like this, you will need to define a map of custom types to JsonSchema definitions that Kompendium can use
|
||||||
|
to short-circuit its type analysis.
|
||||||
|
|
||||||
|
For example, say we would like to serialize `kotlinx.datetime.Instant` entities as a field in our response objects. We
|
||||||
|
would need to add it as a custom type.
|
||||||
|
|
||||||
|
```kotlin
|
||||||
|
private fun Application.mainModule() {
|
||||||
|
// ...
|
||||||
|
install(NotarizedApplication()) {
|
||||||
|
spec = baseSpec
|
||||||
|
customTypes = mapOf(
|
||||||
|
typeOf<Instant>() to TypeDefinition(type = "string", format = "date-time")
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Doing this will save it in a cache that our `NotarizedRoute` plugin definitions will check from prior to attempting to
|
||||||
|
perform type inspection.
|
||||||
|
|
||||||
|
This means that we only need to define our custom type once, and then Kompendium will reuse it across the entire
|
||||||
|
application.
|
||||||
|
|
||||||
|
> While intended for custom scalars, there is nothing stopping you from leveraging custom types to circumvent type
|
||||||
|
> analysis
|
||||||
|
> on any class you choose. If you have an alternative method of generating JsonSchema definitions, you could put them
|
||||||
|
> all
|
||||||
|
> in this map and effectively prevent Kompendium from having to do any reflection
|
||||||
|
|
||||||
|
## Schema Configurator
|
||||||
|
|
||||||
|
The `SchemaConfigurator` is an interface that allows users to bridge the gap between Kompendium serialization and custom
|
||||||
|
serialization strategies that the serializer they are using for their API. For example, if you are using KotlinX
|
||||||
|
serialization in order to convert kotlin fields from camel case to snake case, you could leverage
|
||||||
|
the `KotlinXSchemaConfigurator` in order to instruct Kompendium on how to serialize values properly.
|
||||||
|
|
||||||
|
```kotlin
|
||||||
|
private fun Application.mainModule() {
|
||||||
|
install(ContentNegotiation) {
|
||||||
|
json(Json {
|
||||||
|
serializersModule = KompendiumSerializersModule.module
|
||||||
|
encodeDefaults = true
|
||||||
|
explicitNulls = false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
install(NotarizedApplication()) {
|
||||||
|
spec = baseSpec
|
||||||
|
// Adds support for @Transient and @SerialName
|
||||||
|
// If you are not using them this is not required.
|
||||||
|
schemaConfigurator = KotlinXSchemaConfigurator()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
62
docs/plugins/notarized_locations.md
Normal file
62
docs/plugins/notarized_locations.md
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
The Ktor Locations API is an experimental API that allows users to add increased type safety to their defined routes.
|
||||||
|
|
||||||
|
You can read more about it [here](https://ktor.io/docs/locations.html).
|
||||||
|
|
||||||
|
Kompendium supports Locations through an ancillary module `kompendium-locations`
|
||||||
|
|
||||||
|
## Adding the Artifact
|
||||||
|
|
||||||
|
Prior to documenting your locations, you will need to add the artifact to your gradle build file.
|
||||||
|
|
||||||
|
```kotlin
|
||||||
|
dependencies {
|
||||||
|
implementation("io.bkbn:kompendium-locations:latest.release")
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Installing Plugin
|
||||||
|
|
||||||
|
Once you have installed the dependency, you can install the plugin. The `NotarizedLocations` plugin is an _application_
|
||||||
|
level plugin, and **must** be install after both the `NotarizedApplication` plugin and the Ktor `Locations` plugin.
|
||||||
|
|
||||||
|
```kotlin
|
||||||
|
private fun Application.mainModule() {
|
||||||
|
install(Locations)
|
||||||
|
install(NotarizedApplication()) {
|
||||||
|
spec = baseSpec
|
||||||
|
}
|
||||||
|
install(NotarizedLocations()) {
|
||||||
|
locations = mapOf(
|
||||||
|
Listing::class to NotarizedLocations.LocationMetadata(
|
||||||
|
parameters = listOf(
|
||||||
|
Parameter(
|
||||||
|
name = "name",
|
||||||
|
`in` = Parameter.Location.path,
|
||||||
|
schema = TypeDefinition.STRING
|
||||||
|
),
|
||||||
|
Parameter(
|
||||||
|
name = "page",
|
||||||
|
`in` = Parameter.Location.path,
|
||||||
|
schema = TypeDefinition.INT
|
||||||
|
)
|
||||||
|
),
|
||||||
|
get = GetInfo.builder {
|
||||||
|
summary("Get user by id")
|
||||||
|
description("A very neat endpoint!")
|
||||||
|
response {
|
||||||
|
responseCode(HttpStatusCode.OK)
|
||||||
|
responseType<ExampleResponse>()
|
||||||
|
description("Will return whether or not the user is real 😱")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Here, the `locations` property is a map of `KClass<*>` to metadata describing that locations metadata. This
|
||||||
|
metadata is functionally identical to how a standard `NotarizedRoute` is defined.
|
||||||
|
|
||||||
|
> ⚠️ If you try to map a class that is not annotated with the ktor `@Location` annotation, you will get a runtime
|
||||||
|
> exception!
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user